提交 af02b6a4 编写于 作者: yma16's avatar yma16

gitcode

gitcode
上级 1d226ec5
......@@ -71,6 +71,26 @@ App({
this.globalData = { setting: setting };
console.log('onLaunch', options)
},
//
// 引入`towxml3.0`解析方法
towxml:require('/towxml/index'),
//声明一个数据请求方法
getText: (url, callback) => {
wx.request({
url: url,
header: {
'content-type': 'application/x-www-form-urlencoded'
},
success: (res) => {
if (typeof callback === 'function') {
callback(res);
};
}
});
},
onShow(options) {
// Do something when show.
console.info('show', options)
......
......@@ -18,20 +18,41 @@ Page({
*/
data: {
content:'子组件的content',
homeHeaderItem:''
homeHeaderItem:'',
isLoading: true,
article: {}
},
observers:{
},
/**
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log('进入homePage home-content 渲染开始 onload')
console.log('传递的header-item',options,this)
onLoad: function () {
const _ts = this;
app.getText('https://www.vvadd.com/wxml_demo/demo.txt?v=2',res => {
let obj = app.towxml(res.data,'markdown',{
// theme:'dark',
events:{
tap:e => {
console.log('tap',e);
},
change:e => {
console.log('todo',e);
}
}
});
_ts.setData({
article:obj,
isLoading: false
});
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
......
{
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"usingComponents": {
"towxml":"/towxml/towxml"
}
}
\ No newline at end of file
<!--pages/homeContent/homeContent.wxml-->
<!-- <text>pages/homeContent/homeContent.wxml</text> -->
<view class="container">
<text>content内容</text>
{{headerItem}}
{{content + headerItem}}
<!-- <view class="container"> -->
<!-- <text>content内容</text> -->
<!-- {{headerItem}} -->
<!-- {{content + headerItem}} -->
<!-- <web-view src="https://yongma16.xyz/" /> -->
<!-- </view> -->
<!--index.wxml-->
<!--loading-->
<view class="loading" wx:if="{{isLoading}}">
<image class="loading__icon" src="/images/loading.svg"></image>
</view>
<!--使用towxml-->
<towxml nodes="{{article}}"/>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册