微信小程序wxParse富文本解析
生活随笔
收集整理的這篇文章主要介紹了
微信小程序wxParse富文本解析
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
https://gitee.com/feng-saichong/wx-parse.git下載
首先新建文件夾wxParse將下載解壓好的紅框中的文件復(fù)制當(dāng)中
在js中引用
const WxParse=require('../../wxParse/wxParse.js');在wxss中引用
@import"/wxParse/wxParse.wxss";在wxml中書寫
<import src="/wxParse/wxParse"></import> <template is="wxParse" data="{{wxParseData:article.nodes}}"/>在js聲明周期函數(shù)?onLoad中寫
var articleHtml = '<div>我是HTML代碼</div>'; /** * WxParse.wxParse(bindName , type, data, target,imagePadding) * 1.bindName綁定的數(shù)據(jù)名(必填) 在wxml中調(diào)用的名稱 * 2.type可以為html或者md(必填) * 3.data為傳入的具體數(shù)據(jù)(必填) * 4.target為Page對象,一般為this(必填) * 5.imagePadding為當(dāng)圖片自適應(yīng)是左右的單一padding(默認(rèn)為0,可選) */ WxParse.wxParse('article', 'html', articleHtml, this, 5);總結(jié)
以上是生活随笔為你收集整理的微信小程序wxParse富文本解析的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: combobox之下拉宽度自适应
- 下一篇: 读书笔记:Information Arc