1. 程式人生 > >微信小程式 富文字rich-text使用

微信小程式 富文字rich-text使用

 html

<view>
<rich-text  nodes="{{html}}"></rich-text>
</view>

 js

Page({
  data: {
    html:''
  },

  onLoad: function (options) {
    var that = this
    that.setData({
     html: '<p class="colorred">上九天攬月下五湖捉鱉</p>'
    })
  },
 
})

 css

.colorred{
  text-indent:2em
}

使用方法很簡單 希望對大家有所幫助