Pardon, my lack of knowledge here. Still getting the hang of Vue. I am trying to iterate through a loop and keep running into an issue when my length is a hardcoded value. I keep getting:
'"[Vue warn]: Error in render: 'TypeError: Cannot read property 'title' of undefined'
Js:
new Vue({ el: '#app', data: { inputs: [], items: [ { title: 'Blue' }, { title: 'Yellow' }, { title: 'Red' }, { title: 'Purple' } ] } })
Markup:
<div id="app"> <ul> <li v-for="n in 4"> <label> <input type="checkbox" v-model="inputs" :value="n" :disabled="inputs.length > 0 && inputs.indexOf(n) === -1" > Item </label> </li> </ul> </div>
https://stackoverflow.com/questions/67013679/object-error-when-iterating-through-vue-v-for-loop April 09, 2021 at 08:56AM
没有评论:
发表评论