当前位置: 代码迷 >> 综合 >> uniapp editor编辑器
  详细解决方案

uniapp editor编辑器

热度:31   发布时间:2024-01-25 10:03:43.0
<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);//纯文本内容
},

 

  相关解决方案