WeChat Mini Programs displays the html tag returned by the rich text editor

for the business needs of the company, the details section of a page of Mini Program is the html tag edited by the rich text editor returned from the API, and the image matches the text. I originally thought that Mini Program did not recognize the html tag, so it could not display the html tag returned by the API, and then the survey found that you can use rich-text or wxParse plug-ins to display the html tag. Which method achieves good results? is it true that wxParse only appeared when the official did not provide rich-text in the past?


rich-text is supported from 1.4.0. The lower version needs to be compatible and can only parse html content.
wxParse can parse two kinds of html/markdown scripts, which is very powerful. However, in the process of parsing rich text, calling Mini Program's setData () method many times has a certain impact on performance.
there is also web-view, a new component pushed out by Mini Program in version 1.6.4, which is very powerful, can directly display web page content, and can do a link jump.


the landlord will find out by giving it a try.

rich-text has limited support for html.


from the design point of view of mini programs, it is not intended to fully support HTML, because full support and rendering of all HTML will be very slow, and Mini Program's goal is to start and use, mixing native and Web. So it certainly won't fully support HTML.

therefore, it is recommended that the landlord discuss with the product department how to reduce the dependence on HTML before deciding on the solution. If you have to support it, maybe webview would be better; if it's not that important, consider replacing it with specific tags.

Menu