rich-text
属性:nodes 类型:Array / String 结点列表 / HTML String
结点类型:type = node , name 标签名 String 是 支持部分受信任的HTML结点, attrs 属性 Object 否 支持部分受信任的属性,遵循Pascal命名法 , children 子结点列表 Array 否 结构和nodes一致
结点类型:type = text ,text 文本 String 是 支持entities
nodes 不推荐使用 String 类型,性能会有所下降
rich-text 组件内屏蔽所有结点的事件。
name 属性大小写不敏感。
如果使用了不受信任的HTML结点,该结点及其所有子结点将会被移除。
<rich-text nodes={{nodes}} /> <rich-text nodes={{nodes1}} /> <rich-text nodes={{nodes2}} />
this.setData({ nodes: <h1 style='color:red;'>html标题</h1>, nodes1: [{ name: h1, attrs: { style: color:red, class: red }, children: [{ type: text, text: '结点列表标题' }] }], nodes2: [{ name: ul, attrs: { style: padding:20px;border:1px solid blue;, class: red }, children: [ { name: li, attrs: { style: color:red, class: red }, children: [{ type: text, text: '多层结点 无序列表' }], }, { name: li, attrs: { style: color:red, class: red }, children: [{ type: text, text: '多层结点 无序列表1' }], }] }] })
原文地址:https://www.jb51.cc/weapp/1202683.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。