小程序开放平台

文档中心
表单组件
基础内容
icon
progress
rich-text
text
媒体组件
地图
视图容器
导航组件
开放能力
画布

rich-text

开发
>
组件
>
基础内容
>
rich-text
>
更新时间:2024-11-13 19:05:26

rich-text

富文本。

属性
类型
默认值
必填
说明
nodesarray,string节点列表/HTML String

扫码预览

组件示例

    <view class="page-section">
      <view class="page-section-title">通过HTML String渲染</view>
      <view class="page-content">
        <scroll-view scroll-y>{{htmlSnip}}</scroll-view>
        <button type="primary" bindtap="renderHtml">渲染HTML</button>
        <block xhs:if="{{renderedByHtml}}">
          <rich-text nodes="{{htmlSnip}}"></rich-text>
        </block>
      </view>
    </view>

    <view class="page-section">
      <view class="page-section-title">通过节点渲染</view>
      <view class="page-content">
        <scroll-view scroll-y>{{nodeSnip}}</scroll-view>
        <button type="primary" bindtap="renderNode">渲染Node</button>
        <block xhs:if="{{renderedByNode}}">
          <rich-text nodes="{{nodes}}"></rich-text>
        </block>
      </view>
    </view>
  </view>
该文档是否对您有帮助?