场景:标记内容用了editor,后续有修改功能,需要将内容回显上去。
博主使用的是uni-app,翻阅了文档,editor组件对内容的属性只有@input,用v-modal 和 :value绑定无效,这时只能通过插入html的方法来实现
// view
<editor :id="editor" placeholder="请输入文字内容" @input="inputText"></editor>
// js
this.createSelectorQuery().select('#editor').context((res)=> {
if(!res) return
res.context.setContents({
html: 需要回显的富文本内容
})
}).exec()