text
文本节点,支持转义符"\"。
除了文本节点以外的其他节点都无法长按选中
示例:
<view class="section section_gap">
<text>{{text}}</text>
<view class="btn-area">
<button bindtap="add">add line</button>
<button bindtap="remove">remove line</button>
</view>
</view>
var initData = 'this is first line\nthis is second line'
Page({
data: {
text: initData
},
extraLine: [],
add: function(e) {
this.extraLine.push('other line')
this.setData({
text: initData + '\n' + this.extraLine.join('\n')
})
},
remove: function(e) {
if (this.extraLine.length > 0) {
this.extraLine.pop()
this.setData({
text: initData + '\n' + this.extraLine.join('\n')
})
}
}
})