【已解决】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>

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM