WeChat applet content component text (text)


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')
      })
    }
  }
})