【发布时间】: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); ```