mcll

方法一:rich-text

文档:https://developers.weixin.qq.com/miniprogram/dev/component/rich-text.html

 

方法二(当需要触发点击事件时可以使用):

使用wxParse:https://github.com/icindy/wxParse  gitHub网站

1.在github上下载下来代码,找到WxParse模块并引入

var WxParse = require(\'../../wxParse/wxParse.js\');

2.进行数据绑定

 var article = \'<div>我是HTML代码</div>\';

/**
* WxParse.wxParse(bindName , type, data, target,imagePadding)
* 1.bindName绑定的数据名(必填)
* 2.type可以为html或者md(必填)
* 3.data为传入的具体数据(必填)
* 4.target为Page对象,一般为this(必填)
* 5.imagePadding为当图片自适应是左右的单一padding(默认为0,可选)
*/
WxParse.wxParse(\'article\', \'html\', article, this, 5);

3.模版引用
// 引入模板
<import src="你的路径/wxParse/wxParse.wxml"/>
//这里data中article为bindName
<template is="wxParse" data="{{wxParseData:article.nodes}}"/>
 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2022-01-31
  • 2021-11-22
猜你喜欢
  • 2022-12-23
  • 2021-09-05
  • 2022-01-30
  • 2021-05-21
  • 2021-11-12
  • 2021-05-20
  • 2022-12-23
相关资源
相似解决方案