【问题标题】:vuejs & ukit html editor not displaying contentvuejs & ukit html 编辑器不显示内容
【发布时间】:2015-11-16 07:31:13
【问题描述】:

当我尝试将内容(使用 vue-resource 检索的运行时)放入 textarea(htmleditor markdown 组件)时,我将 UIKIT 和 vuejs 用于前端,

它不会在 htmleditor 中显示内容

但是硬编码文本可以工作,当显示动态检索的数据时它不工作

** html代码:**

<textarea data-uk-htmleditor="{markdown:true,mode:'tab'}">{{hotel.description}}</textarea>

** 如果使用硬编码属性,这将起作用 ** <textarea data-uk-htmleditor="{markdown:true,mode:'tab'}">{{description}}</textarea> ** Vue js 代码 **

 export default {
  data () {
    return {
      is_edit:false,
      description:"This is hardcoded value",
      hotel: {}
    }
  },

  route: {
    data ({ to }) {
      return {
        hotel:this.details(to.params.slug) 
      }
    }
  },

  methods:{
     details (slug) {
        this.$http.get('/admin/hotels/' + slug)
                .success(function(hotel) {
                    this.hotel = hotel;
                }).error(function (error) {
                    alert("error")
                });
     }

  }

【问题讨论】:

  • ``` $.UIkit.htmleditor('#description', { /* options */ }); var editor = $('.CodeMirror')[0].CodeMirror; editor.setValue(this.hotel.description); ```

标签: uikit vue.js


【解决方案1】:

你应该这样做;将它绑定到表单元素

<textarea data-uk-htmleditor="{markdown:true,mode:'tab'}" v-model="hotel.description"></textarea>

【讨论】:

    猜你喜欢
    • 2021-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多