May 18, 2021 WeChat Mini Program Development Document
The property name | Type | The default | Description | The lowest version |
---|---|---|---|---|
selectable | Boolean | false | Whether the text is optional | 1.1.0 |
space | String | false | Displays consecutive spaces | 1.4.0 |
decode | Boolean | false | Whether to decode | 1.4.0 |
Space valid value:
Value | Description |
---|---|
ensp | Chinese is half the size of a character space |
emsp | Chinese character space size |
nbsp | The space size that is set according to the font |
<
>
&
'
 
 
<text/>
only supported within the
<text/>
component.
Example:
<view class="btn-area">
<view class="body-view">
<text>{{text}}</text>
<button bindtap="add">add line</button>
<button bindtap="remove">remove line</button>
</view>
</view>
var initData = 'this is first line\nthis is second line'
var extraLine = [];
Page({
data: {
text: initData
},
add: function(e) {
extraLine.push('other line')
this.setData({
text: initData + '\n' + extraLine.join('\n')
})
},
remove: function(e) {
if (extraLine.length > 0) {
extraLine.pop()
this.setData({
text: initData + '\n' + extraLine.join('\n')
})
}
}
})