1.必须加key要不然有警告。
2.先注册组件,再新建Vue.
例如:
Vue.component('todo-item', {
props: ['todo'],
template: '<li>{{ todo.text }}</li>'
})
var app7 = new Vue({
el: '#app-7',
data: {
groceryList: [
{ text: 'Vegetables' },
{ text: 'Cheese' },
{ text: 'Whatever else humans are supposed to eat' }
]
}
Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.
(found in root instance)