我正在尝试使用道具渲染组件。但是仅当内容道具不是组件时才起作用。
这是一个示例:https : //jsfiddle.net/eugenio4/onf54vt5/
// register modal component
Vue.component('component', {
template: '<span class="component-tag">This is component</span>',
})
// start app
new Vue({
el: '#app',
data: function (){
return {
test1 : '<label>this is label</label>',
test2 : '<component></component>' //this doest work
}
}
})
<!-- app -->
<div id="app">
<span v-html="test1"></span>
<span v-html="test2"></span>
</div>
Run Code Online (Sandbox Code Playgroud)
这可能吗?
| 归档时间: |
|
| 查看次数: |
4620 次 |
| 最近记录: |