微信小程序和支付宝小程序富文本使用
2024-08-29 06:22:12
微信小程序使用的是
1.
wxml
页面元素的最简单使用<rich-text nodes="{{这是你的数据}}"></rich-text>
2. js部分
如下可以直接获取
支付宝小程序
1.
axml
页面简单使用<rich-text nodes="{{nodes}}" ></rich-text>
2. js部分
import parser from 'rich-text-parser' //这个文件是引用是关键下载地址:https://github.com/Chaunjie/rich-text-parser
Page({
data: {
txte1: “”,
nodes: [],
},
onLoad(e) {
let that = this
let txte1 = e.txte
// const {p} = that.data
// 定义需要解析的特殊标签,value不填默认是div
// parser.definedCustomTag({figure: 'p', figcaption: ''})
const nodes = parser.getRichTextJson(txte1)
that.setData({
nodes: nodes.children
})
},
});
这些数据我是上一个页面传递新来的
首次记录学习过程有不足之处请多见谅!!!
最新文章
- SharePoint 部署解决方案Feature ID冲突
- parseInt第二个参数详解
- VC++ 中使用 std::string 转换字符串编码
- IOS深入学习(3)之Control Object
- ios电话监听状态
- shell 空格问题
- C#WinForm中复制、粘贴文本到剪贴板
- Java 动态绑定
- Linux上的oracle巡检脚本
- Find a way--hdu2612
- python3.4学习笔记(八) Python第三方库安装与使用,包管理工具解惑
- jquery选择器总结2
- IOS statusBarStyle 设置
- Luogu 1220 关路灯(动态规划)
- centos上搭建git服务--4
- Sql Server 2005 镜像后收缩日志
- VS2013下的64位与32位程序配置
- Windows操作系统下给文件夹右键命令菜单添加启动命令行的选项
- AML与PIO整合问题
- Frogs&#39; Neighborhood(POJ1659+Havel-Hakimi定理)
热门文章
- C/C++ 中的宏/Macro
- goweb-搭建服务
- Html5 Canvas动画基础碰撞检测的实现
- This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app&#39;s Info.plist must contain an NSPhotoLibraryAddUsageDescription key with a string value
- ios11下适配UItableView
- Word List
- ubuntu 桌面版, ssh 连接时使用,x转发进行使用 gnome-terminal 时出现:Error calling StartServiceByName for org.gnome.Terminal: Timeout was reached 错误
- Python 对列表嵌套的数据进行排序
- Linux Thermal Framework分析及实施
- ASA 笔记