微信小程序中如何使用wxParse解析html
wxParse插件下载地址
wxParse插件下载地址
.css引用
@import "../../../wxParse/wxParse.wxss";
.js处理
var WxParse = require('../../../wxParse/wxParse.js');
onLoad: function(e) {
this.getDataFromServer(e.id);
},
getDataFromServer: function(id) {
var that = this;
var url = "Wxxxx/xxx";
var data_post = {
id: id
};
app.https_post(url, data_post, (err, res) => {
var article = res.content;
WxParse.wxParse('article', 'html', article, that, 5);
})
}
.wxml显示
<view class="wxParse">
<template is="wxParse" data="{{wxParseData:article.nodes}}"/>
</view>