Home > Article > WeChat Applet > Analysis of pages compatible with h5 tags in mini programs
The content of this article is about the analysis of page compatibility with h5 tags in mini programs. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Sometimes when the mini program retrieves data from the background, it is an article with html tags. When you put it into the mini program, you will find that many tags are incompatible. It is very troublesome to change them one by one. Is there any way? Can it be quickly compatible with html tags?
There is a tool that can do it: wxParse
Download the compressed package and unzip it, copy the wxParse folder and put it in the mini program pages page:
Introduced in wxml, the path here is for reference only:
<import src="../../../../wxParse/wxParse.wxml" />//在需要放置html文本的地方使用wxParse组件 <view class='article_bd'> <template is="wxParse" data="{{wxParseData:content.nodes}}" /> </view>
Introduced in js:
let wxparse = require("../../../../wxParse/wxParse.js"); Page({ /** * 页面的初始数据 */ data: { content: '' }, onLoad: function(options) { var that = this; ..... //在后台拿到content数据后, result.data.content就是拿到的数据 wxparse.wxParse('content', 'html', result.data.content, that); }
Introduced in wxss:
@import "../../../../wxParse/wxParse.wxss";
Related recommendations:
Code analysis of app.json configuration in WeChat mini program
Page layout, absolute positioning and button code in mini programThe above is the detailed content of Analysis of pages compatible with h5 tags in mini programs. For more information, please follow other related articles on the PHP Chinese website!