我处于使用Vue.js的早期阶段,并且在尝试使用组件时遇到了问题。此代码的非组件版本正常工作。使用Vue组件 - setattr - 无效的属性名称
以下返回一个错误,我在解密时遇到了问题,但它看起来像在传递某个应该有对象属性的地方的逗号。
是否清楚问题在哪里出现?
错误
未捕获抛出:DOMException:未能执行的 '元素' 的setAttribute“: '' 是不是有效的属性名称。
HTML
v-for="item in todo_list",
v-bind:todo="item",
v-bind:key="item.id">
JS
Vue.component('todo-item', {
props: ['todo'],
template: '
{{ todo.text }}'})
var todo = new Vue({
el: '#list_render',
data: {
todo_list: [
{ id: 0, text: 'Learn Vue' },
{ id: 1, text: 'Plan project' }
]
}
})