支付寶小程序填坑

rich-text nodes屬性需要數組,所有需要轉換成數組

import parse from 'mini-html-parser2'

//標籤需要結束符
this.setData({
          contentStr: this.data.specialStore.introduction.replace(/<br>/g,'<br/>')
        }) 

parse(this.data.contentStr, (err, htmlNodes) => {
        if (!err) {
                  console.log(htmlNodes)
          self.setData({
                "introduction":htmlNodes
          });
        }
      })  

轉換後成數組後還是無法解析,那可能img轉換有誤,可能是因爲同樣缺少結束標識符/,所以還需要轉換下

 
 
 
 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章