效果图

【Kevin Learn 小程序】-->text_xml

属性

参考:​​text​

代码

  1. 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
}
})
  1. app.json
{
"pages": [
"pages/text/text"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}
  1. text.js
var initData = 'this is first line\nthis is second line';
var extraLine = [];
Page({
data: {
text: initData
}
})
  1. text.json
{
"navigationBarTitleText": "text 组件"
}
  1. text.wxml
<!--pages/text/text.wxml-->
<view class="btn-area">
<view class="body-view">
<text selectable="true" space="emsp" decode="true">{{text}}</text>
</view>
</view>