Arrays Vuejs从阵列创建列表
我在使用Vuejs创建列表时遇到了一个奇怪的问题。我有这样一个数组:Arrays Vuejs从阵列创建列表,arrays,vue.js,Arrays,Vue.js,我在使用Vuejs创建列表时遇到了一个奇怪的问题。我有这样一个数组: const sr=新的Vue({ el:“#单一配方应用程序”, 数据:{ checkeditems:[], }, }); 这是在我的HTML中实例化的,如下所示: 并在我的组件中声明为道具: Vue.component('singlerecipe'{ 道具:['checkeditems'], 模板:` {{item.checkeditems}} ` }) 选中项目代码为: {{result.strIngre
const sr=新的Vue({
el:“#单一配方应用程序”,
数据:{
checkeditems:[],
},
});
这是在我的HTML中实例化的,如下所示:
并在我的组件中声明为道具:
Vue.component('singlerecipe'{
道具:['checkeditems'],
模板:`
-
{{item.checkeditems}}
`
})
选中项目代码为:
{{result.strIngredient1}-{{result.strMeasure1}
{{result.strIngredient2}-{result.strMeasure2}
如果我单击其中一个复选框,它肯定会将正确的值添加到数组checkeditems[]中,但奇怪的是,它会创建新的列表项,但不会添加值,因此我得出以下结论:
列表项中没有值。有人知道我做错了什么吗?我想你只是不小心在中添加了一个“checkeditems” 应该是:
Vue.component('singlerecipe'{
道具:['checkeditems'],
模板:`
-
{{item}}
`
})
我想您只是不小心在中添加了一个“checkeditems”
应该是:
Vue.component('singlerecipe'{
道具:['checkeditems'],
模板:`
-
{{item}}
`
})
D'oh!就这样,非常感谢你哦!就这样,非常感谢