
在这里提下使用教程
一、首先将插件文件夹复制到项目里面
二、导入文件
首先在xx.wxml导入文件,在文件头写上:
<import src="../../wxParse/wxParse.wxml"/>
然后再wxss导入文件,在文件头写上:
@import "../../wxParse/wxParse.wxss";
三、在页面xx.js里的onLoad()方法里面写上:
var WxParse = require('../../wxParse/wxParse.js');
WxParse.wxParse('article', 'html', article, that,5)
此方法的含义为:
[javascript] view plain copy
var article = '<div>我是HTML代码</div>';
/**
* WxParse.wxParse(bindName , type, data, target,imagePadding)
* 1.bindName绑定的数据名(必填)
* 2.type可以为html或者md(必填)
* 3.data为传入的具体数据(必填)
* 4.target为Page对象,一般为this(必填)
* 5.imagePadding为当图片自适应是左右的单一padding(默认为0,可选)
*/
var that = this;
WxParse.wxParse('article', 'html', article, that,5);
四、模板引用:
//这里data中article为bindName <template is="wxParse" data="{{wxParseData:article.nodes}}"/>