【发布时间】:2015-12-14 14:20:17
【问题描述】:
我正在尝试使用 Vue.js 将一些内容加载到组件中。我正在尝试使用 :is 属性来做到这一点。我不断收到“[Vue 警告]:无法解析组件:面试”
<todo-tabs :list="items"></todo-tabs>
<template id="interview-slot">
//Interview Slot Content
</template>
<template id="membership-slot">
//Interview Slot Content
</template>
<script>
Vue.component('todo-tabs', {
template: '#todo-tabs',
props: ['list'],
data: function(){
return {
currentView: 'interview',
components:{
interview:{
template: '#interview-slot'
},
membership:{
template: '#membership-slot'
}
}
}
}
});
var vm = new Vue({
el: "#todo",
data: {
items : [
{id: 'interview', name: 'interview', complete: true, body: 'something1', step_content: 'SOME',current: true },
{id: 'membership', name: 'membership', complete: true, body: 'something2', step_content: 'SOME' },
{id: 'profile', name: 'profile', complete: false, body: 'something3', step_content: 'SOME' },
{id: 'handoff', name: 'handoff', complete: false, body: 'something4', step_content: 'SOME'}
]
}
});
</script>
如果可能的话,我真的不想将我的 html 放入 json 中,因为它包含很多表单元素。
提前感谢您的任何帮助
【问题讨论】:
-
我看到的唯一注册组件是 todo-tabs。面试不是。
标签: javascript vue.js