码迷,mamicode.com
首页 > 其他好文 > 详细

【已解决】iView-admin Editor 组件 绑定默认值问题

时间:2018-12-27 15:38:28      阅读:244      评论:0      收藏:0      [点我收藏+]

标签:自动   this   edit   esc   false   component   ref   set   str   

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>

  

【已解决】iView-admin Editor 组件 绑定默认值问题

标签:自动   this   edit   esc   false   component   ref   set   str   

原文地址:https://www.cnblogs.com/yanzhen/p/10184534.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!