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
相關文章
相關標籤/搜索