下面是HTML代码
<span>
内容:
<editor
id="editor"
class="ql-container"
:show-img-size="true"
:show-img-toolbar="true"
:show-img-resize="true"
@input="changetxt"
style="height: 100%;"
></editor>
</span>
其中可以通过@input拿到编辑修改后的值
然后是js代码
onEditorReady(e) {
uni.createSelectorQuery()
.in(this)
.select('.ql-container')
.fields(
{
size: true,
context: true
},
res => {
this.editorCtx = res.context;
this.editorCtx.setContents({
html: this.txt
});
}
)
exec();
},
this.txt就是我们需要解析的富文本代码