I need to use multidimensional array model in my vuejs project
Fiddle of my code:
I define an array in my vuejs data
new Vue({
el: '#app',
data: {
message: 'Hello Vue.js!',
arr: [[1,2],[3,4]]
}
})
and use:
<p v-if="arr[3][0]">{{ arr[3][0] }} //Vue warn]: Error in render function: "TypeError: Cannot read property '1' of undefined"
</p>
but I have error when I call not defined index
Vue warn]: Error in render function: "TypeError: Cannot read property '1' of undefined"
I use v-if to skip undefined index but it doesn't work Fiddle
How can I solve this problem and skip not defined index?
UPDATE:
v-if not work correctly because of using it in <br> tag I changed <br> to <span> and problem solved
arr[1][0]