0👍
You should try like this:
html ..
<div v-if="a && a.arr" v-for="k in a.arr">
{{k.name}}
</div>
data()
{
return {
a: {
arr: [],
}
};
}
methods:
{
updateA(){
a.arr=[];
a.arr.push({name:'abc'});
},
updateA2(){
let b = a.arr && a.arr[0];
if(b){
this.$set(b,'name','xyz');
}
}
}
- [Vuejs]-Is it possible to create a method that refreshes a single vueJS component?
- [Vuejs]-Laravel vue stripe: how to pass client_secret PaymentIntent from clientside to serverside?
Source:stackexchange.com