WeChat applet content component: text
Text node, supports the escape character "\".
Nodes other than text nodes cannot be selected by long pressing
Example:
<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') }) } } })
Thanks for reading, I hope it can help everyone, thank you for your support of this site!
More WeChat mini programs wxapp content components text For detailed introduction and related articles, please pay attention to the PHP Chinese website!