Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
326 views
in Technique[技术] by (71.8m points)

vue如何切换样式?

比如
有三个按钮

button1.current button2.current button3.current

默认高亮button1,点击之后切换

在data写了个数组 [true, false, false]

click的method里传个index,@click="a(index)" button是循环出来的

用传入index来进行数组切换,this.array[index] = true

重新赋值后,dom没更新...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

this.array[index] = true是无法被检查到,具体看数组更新检测


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...