<editor id="editor" class="ql-container"
@input="getText"
showImgToolbar
@statuschange="onStatusChange"
:read-only="readOnly"
@ready="onEditorReady">
</editor>
1.调用
that.onEditorReady();
2.给editor设置初始值
onEditorReady() {
var that = this;
uni.createSelectorQuery().select('#editor').context((res) => {
this.editorCtx = res.context;
this.editorCtx.setContents({//赋值
html:that.text
});
}).exec()
},
3.获取editor的内容
getText(e){
var that = this;
console.log(e.detail.html);//带标签内容
console.log(e.detail.text);//纯文本内容
},
编辑器整体页面内容连接:https://download.csdn.net/download/qq_35086913/12108763