Home >WeChat Applet >Mini Program Development >Analysis of pages compatible with h5 tags in mini programs

Analysis of pages compatible with h5 tags in mini programs

不言
不言Original
2018-08-10 16:49:203787browse

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
Analysis of pages compatible with h5 tags in mini programs
Download the compressed package and unzip it, copy the wxParse folder and put it in the mini program pages page:
Analysis of pages compatible with h5 tags in mini programs
Introduced in wxml, the path here is for reference only:

<import src="../../../../wxParse/wxParse.wxml" />//在需要放置html文本的地方使用wxParse组件 <view class=&#39;article_bd&#39;>
    <template is="wxParse" data="{{wxParseData:content.nodes}}" />
  </view>

Introduced in js:

let wxparse = require("../../../../wxParse/wxParse.js");
Page({  /**
   * 页面的初始数据
   */
  data: {
      content: &#39;&#39;
  },
   onLoad: function(options) {     var that = this;
     .....     //在后台拿到content数据后, result.data.content就是拿到的数据
      wxparse.wxParse(&#39;content&#39;, &#39;html&#39;, 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 program

The 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn