我想使用刀片语法将用户名显示为markdown编辑器的默认textarea值。
<textarea v-model="message">
{{ $detailsFromLaravelContoller }}
</textarea>
<div v-html="compiledMarkdown"></div>
但我正在使用v-model组件为textarea,这需要declare message with an empty value这样
window.onload = function()
{
var editor = new Vue({
el: '#editor',
data: {
message: '',
compiledMarkdown: marked('', { sanitize: true }),
},
watch: {
markdown: function () {
this.compiledMarkdown = marked(this.message, { sanitize: true })
}
},
methods: {
}
})
}
这将使用laravel变量的值呈现屏幕。但是在页面加载后不久内容就消失了(因为我已经使用了window.onload)。 我也没有使用内联VueJS。 P.S:我是VueJS和Laravel的新手,减价的来源是here(jsfiddle) 先感谢您!!!