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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM