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