效果图
参考:text
代码- app.js
//app.js
App({
onLaunch: function () {
console.log('App Launch')
},
onShow: function () {
console.log('App Show')
},
onHide: function () {
console.log('App Hide')
},
globalData: {
hasLogin: false
}
})
- app.json
{
"pages": [
"pages/text/text"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}
- text.js
var initData = 'this is first line\nthis is second line';
var extraLine = [];
Page({
data: {
text: initData
}
})
- text.json
{
"navigationBarTitleText": "text 组件"
}
- text.wxml
{{text}}