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转换有误,可能是因为同样缺少结束标识符/,所以还需要转换下