微信小程序 rich-text的使用方法
2017-08-04 16:29
471 查看
微信小程序 rich-text的使用方法
rich-text
- 属性:nodes 类型:Array / String 结点列表 / HTML String
- 全局支持class和style属性,不支持id属性。
- 结点类型:type = node , name 标签名 String 是 支持部分受信任的HTML结点, attrs 属性 Object 否 支持部分受信任的属性,遵循Pascal命名法 , children 子结点列表 Array 否 结构和nodes一致
- 结点类型:type = text ,text 文本 String 是 支持entities
- nodes 不推荐使用 String 类型,性能会有所下降
- rich-text 组件内屏蔽所有结点的事件。
- attrs 属性不支持 id ,支持 class 。
- name 属性大小写不敏感。
- 如果使用了不受信任的HTML结点,该结点及其所有子结点将会被移除。
- img 标签仅支持网络图片。
<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' }], }] }] })
以上就是微信小程序 rich-text的介绍,如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
您可能感兴趣的文章:
相关文章推荐
- 微信小程序 rich-text
- 使用TypeScript开发微信小程序的方法
- 关于微信小程序使用不了push()方法的解决办法
- 微信小程序使用image组件显示图片的方法【附源码下载】
- 「微信小程序免费辅导教程」25,基本内容组件text的使用及个人帐号允许的服务类目
- 微信小程序----组件之rich-text
- 微信小程序 setData使用方法及常用错误解决办法
- 在微信小程序里使用watch和computed的方法
- 微信小程序图片轮播组件gallery slider使用方法详解
- 微信小程序 (应用号)开发(教程)文档,内附开发工具及工具使用方法
- 微信小程序中使用自定义图标(阿里icon)的方法
- 微信小程序使用setData方法修改data中对象或数组的属性值
- 微信小程序上拉刷新和下拉加载2种方法实现,onPullDownRefresh,scroll-view使用
- 微信小程序“IU同学”使用方法,一起来找同学!
- 微信小程序 setData的使用方法详解
- 微信小程序使用字体图标的方法
- 微信小程序中使用ECharts 异步加载数据的方法
- 微信小程序实现text文本包裹,和使用网络图片做背景
- 微信小程序例子——使用text组件实现转义符换行
- 微信小程序使用wxParse解析html的方法教程