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