WeChat applet wxapp content component text detailed introduction

高洛峰
Release: 2017-02-14 14:19:29
Original
1781 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:


 {{text}}
 
  
  
 
Copy after login
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')
  })
 }
 }
})
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!