newmiracle

微信小程序显示html代码的方法

直接https://github.com/icindy/wxParse 

然后打开运行就看到了

下面贴个比较简单的代码

index.wxml

<import src="../../wxParse/wxParse.wxml"/> 
<view class="wxParse">
    <template is="wxParse" data="{{wxParseData:article.nodes}}"/>
</view>

  index.js

var WxParse = require(\'../../wxParse/wxParse.js\');
Page({
  data: {
  },
  onLoad: function () {
    var that = this;
   
    /**
     * html解析示例
     */
    var article = `<p>111111111111</p>`;
        
    
    WxParse.wxParse(\'article\', \'html\', article, that, 5);


  
  }


})

然后界面上就可以看到

111111111111

分类:

技术点:

相关文章:

  • 2021-04-04
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2021-09-13
  • 2022-12-23
  • 2021-12-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-05
  • 2021-08-01
  • 2021-09-04
相关资源
相似解决方案