var a=[false,false,false,false];
a[0]=true;
需求是要更改a的第一项为true,但是打印出来后显示是更改成功了,但是视图层不显示该有的效果
查了一下 ,这种方法是不对的,需要用$set来更新视图层
this.$set(数组,索引,值) 也就是this.$set(this.a,0,true)
var a=[false,false,false,false];
a[0]=true;
需求是要更改a的第一项为true,但是打印出来后显示是更改成功了,但是视图层不显示该有的效果
查了一下 ,这种方法是不对的,需要用$set来更新视图层
this.$set(数组,索引,值) 也就是this.$set(this.a,0,true)