The Baidu applet displays the content rich-text of the rich text editor, and the Baidu applet displays the html5 code

Functional background: It is necessary to display background rich text editor settings articles or other html codes in the Baidu applet. Using v-html in vue and wxParse in the WeChat applet does not work. I searched for official documents and found < rich- text > component

code example

.swan code

 <rich-text nodes="{
     
     {content}}"></rich-text>

Introduction to the official property name
insert image description here
Some pictures are not fully displayed after direct reference, and the picture width needs to be set in the .js file

.js code

content = content.replace(/\<img/gi, '<img style="width:100%;height:auto;"')

Perform regular matching on the img tag to set the style for the img tag

Guess you like

Origin blog.csdn.net/gjwgjw1111/article/details/131009314