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

gitcode

gitcode
上级 1d226ec5
...@@ -71,6 +71,26 @@ App({ ...@@ -71,6 +71,26 @@ App({
this.globalData = { setting: setting }; this.globalData = { setting: setting };
console.log('onLaunch', options) 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) { onShow(options) {
// Do something when show. // Do something when show.
console.info('show', options) console.info('show', options)
......
...@@ -18,19 +18,40 @@ Page({ ...@@ -18,19 +18,40 @@ Page({
*/ */
data: { data: {
content:'子组件的content', content:'子组件的content',
homeHeaderItem:'' homeHeaderItem:'',
isLoading: true,
article: {}
}, },
observers:{ observers:{
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function () {
console.log('进入homePage home-content 渲染开始 onload') const _ts = this;
console.log('传递的header-item',options,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": { "usingComponents": {
"towxml":"/towxml/towxml"
} }
} }
\ No newline at end of file
<!--pages/homeContent/homeContent.wxml--> <!--pages/homeContent/homeContent.wxml-->
<!-- <text>pages/homeContent/homeContent.wxml</text> --> <!-- <text>pages/homeContent/homeContent.wxml</text> -->
<view class="container"> <!-- <view class="container"> -->
<text>content内容</text> <!-- <text>content内容</text> -->
{{headerItem}} <!-- {{headerItem}} -->
{{content + headerItem}} <!-- {{content + headerItem}} -->
<!-- <web-view src="https://yongma16.xyz/" /> --> <!-- <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> </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.
先完成此消息的编辑!
想要评论请 注册