WeChat applet wxapp content component text detailed introduction

高洛峰
Release: 2017-02-14 14:19:29
Original
1917 people have browsed it

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>
Copy after login
var initData = &#39;this is first line\nthis is second line&#39;
Page({
 data: {
 text: initData
 },
 extraLine: [],
 add: function(e) {
 this.extraLine.push(&#39;other line&#39;)
 this.setData({
  text: initData + &#39;\n&#39; + this.extraLine.join(&#39;\n&#39;)
 })
 },
 remove: function(e) {
 if (this.extraLine.length > 0) {
  this.extraLine.pop()
  this.setData({
  text: initData + &#39;\n&#39; + this.extraLine.join(&#39;\n&#39;)
  })
 }
 }
})
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template