标签:自动 this edit esc false component ref set str
发现 editor 组件,设置v-model 后, 修改 v-model 数据, editor组件没有自动渲染,需要手动设置渲染
this.$refs.editor.setHtml(this.model.description)
<template>
<div>
<editor v-model="model.description" ref="editor" :cache="false"/>
</div>
</template>
<script>
import Editor from ‘_c/editor‘
export default {
components: { Editor },
data () {
return {
model: { description: ‘‘ }
}
},
methods: {
Bind () {
// 模拟ajax读取数据绑定
this.model.description = ‘hello word‘
this.$refs.editor.setHtml(this.model.description) // 加上这句才可以
}
},
mounted () {
this.Bind()
}
}
</script>
【已解决】iView-admin Editor 组件 绑定默认值问题
标签:自动 this edit esc false component ref set str
原文地址:https://www.cnblogs.com/yanzhen/p/10184534.html