【已解决】iView-admin Editor 组件 绑定默认值问题
iView-admin Editor 组件 绑定默认值问题
发现 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>
如有疑问欢迎留言沟通交流 彦桢博客
 
                    
                     
                    
                 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号