WxParse 微信小程序富文本(html)编辑

GitHub下载地址:https://github.com/icindy/wxParse/tree/master/wxParse

参考:https://www.cnblogs.com/wesky/p/8066233.html

1)下载文件夹放到项目 utils文件夹下

2)若是新闻详情页要解析html代码,新闻详情页路径  pages/news/detail/index

      在index.js中引入 WxParse.js : var WxParse = require('../../../utils/wxParse/wxParse.js'); 【这里要写绝对路径】

   在 onLoad 方法中请求接口

   

    //新闻详情
    app.request({
        url: app.api.News.detail,
        data: {
          id: options.id,
          reg_id: wx.getStorageSync("openid"),
          platform: 'xcx'
        },
        success: function (res) {
            console.log(res)
        }
    })

扫描二维码关注公众号,回复: 4659529 查看本文章

3)

猜你喜欢

转载自www.cnblogs.com/dudu123/p/10180818.html