不懂vue如何实现点击按钮切换背景颜色的效果?其实想解决这个问题也不难,下面让小编带着大家一起学习怎么去解决,希望大家阅读完这篇文章后大所收获。
用vue简单的实现点击按钮切换背景颜色,具体代码如下所示:
15天30天// 在methods方法里面 data () { time: 3, increase: 5, }, methods: { changeBg (index) { if (index === 3 || index === 4) { this.time = index } else if (index === 5 || index === 6) { this.increase = index } else { this.sort = index } } } // css样式增量总量