阅读背景:

uniapp的editor标签的使用_斗师——Ace

来源:互联网 
<editor id="editor" class="ql-container text-cyan radius"  @ready="onEditorReady" @input='contentChange' :read-only='false'></editor>	
<script>
    methods:{
			onEditorReady() {
			    uni.createSelectorQuery().select('#editor').context((res) => {
					console.log(res)
			        this.editorCtx =res.context;
					let content={
						html:`<p wx:nodeid="70">import AceRow from "@/xx/Ace_Row"</p><p wx:nodeid="73">components:{</p><p wx:nodeid="79" style='white-space:pre;'>	AceRow</p><p wx:nodeid="76">}</p><p wx:nodeid="76"><br></p><p wx:nodeid="13">&lt;Ace-Row :gutter='10'&gt;</p><p wx:nodeid="66" style='white-space:pre;'>	&lt;Ace-Col :span='5' :offset='1' &gt;&lt;/Ace-Col&gt;						</p><p wx:nodeid="68">&lt;/Ace-Row&gt;</p>`
					}
					this.editorCtx.setContents(content);//设置富文本编辑器的内容
			    }).exec()
			},
			contentChange(e){
				console.log(e.detail)
			}
		}
</script><editor id="editor" class="ql-container text-cy



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: