uniAPP解析支付宝小程序richtext
参考自:https://blog.csdn.net/qq_41925937/article/details/96100980
1.下载文件 https://github.com/dcloudio/hello-uniapp/blob/master/common/html-parser.js
2 渲染内容
<rich-text :nodes="nodes"></rich-text>
3.引入
import parseHtml from "./parsehtml.js"
//处理数据
//#ifdef MP-ALIPAY
let content = val.articles.detail.replace(/\<img/gi, '<img style="max-width:100%;height:auto" ');
let newArr = [];
let arr = parseHtml(content);
arr.forEach((item, index) => {
newArr.push(item)
})
_self.nodes = newArr;
//#endif