小程序开放了原生的富文本编辑组件editor,功能还是挺丰富的,有兴趣的大家可以看下
官方文档:https://developers.weixin.qq.com/miniprogram/dev/component/editor.html
相关api:https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.html
editor组件
使用方法的话很简单,直接复制文档中的示例修改下就能用了
这里提供一个方法,可以初始化editro组件的内容
const query = wx.createSelectorQuery()
query
.select('#editorId')
.context(function (res) {
res.context.setContents({
html: '相关内容'
})
})
.exec()
文章转载于:https://www.jianshu.com/p/d1f5bd64a0bd
原著是一个有趣的人,若有侵权,请通知删除
还没有人抢沙发呢~