text

文本

在使用小程序时,如果想通过长按文字进行复制文字内容,就要把该内容写在text中。

text.wxml文件

view   text{{text}}/text   button type="primary" bindtap="add"add line/button   button type="primary" bindtap="remove"remove line/button/view

text.js文件

var initData='this is first linethis is second line'var extraLine=[];Page({  /**   * 页面的初始数据   */  data: {      text:initData  },  add:function(e){    extraLine.push('other line')    this.setData({      text:initData+''+extraLine.join('')    })  },  remove: function (e) {    if(extraLine.length0){    extraLine.pop()    this.setData({      text: initData + '' + extraLine.join('')     })    }  }  })

效果图
小程序

TAG标签: 微信小程序text

http://www.xiaochengxub.com/read-103645.html