Skip to main content
Version: 1.x

RichText

富文本

属性

属性名类型默认值说明
nodesArray / String[]节点列表 / HTML String

各端支持度

属性微信小程序H5ReactNative百度小程序支付宝小程序字节跳动小程序
nodes
示例:
import Taro, { Component } from '@tarojs/taro'
// 引入 RichText 组件
import { RichText } from '@tarojs/components'

class App extends Components {
state = {
nodes: [{
name: 'div',
attrs: {
class: 'div_class',
style: 'line-height: 60px; color: red;'
},
children: [{
type: 'text',
text: 'Hello World!'
}]
}]
}
render () {
return (
<RichText nodes={this.state.nodes} />
)
}
}