uniAPP解析支付宝小程序richtext

 参考自:https://blog.csdn.net/qq_41925937/article/details/96100980html

1.下载文件  https://github.com/dcloudio/hello-uniapp/blob/master/common/html-parser.jsnode

2 渲染内容git

    <rich-text :nodes="nodes"></rich-text>

3.引入github

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
相关文章
相关标签/搜索