比如
有三个按钮
button1.current button2.current button3.current
默认高亮button1,点击之后切换
在data写了个数组 [true, false, false]
click的method里传个index,@click="a(index)" button是循环出来的
用传入index来进行数组切换,this.array[index] = true
重新赋值后,dom没更新...
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
this.array[index] = true是无法被检查到,具体看数组更新检测
直接上代码看效果吧。
https://jsfiddle.net/zhoou/d6...
效果:
