【Vue】小技巧
路由链接那个被激活就给那个绑定class
About
//如果不想使用路由跳转 但只想使用active-class属性,只需要将四个to属性的值设置不同即可
商品介绍
商品介绍
商品介绍
商品介绍
动态点击三个a 点那个给那个添加class
clickMethod0 (e) {
this.current = 0
this.currentComponent = 'Hot'
},
遇到watch或者moutend中发起请求顺便赋值来不及的操作,可以使用.then解决,异步操作
watch: {
a: {
deep: true,
handler (newval, oldval) {
this.$store.dispatch('shoppingCarAbout/getShopCar').then((result) => {
this.CarLength = this.$store.state.shoppingCarAbout.ShoppingCar.data.length
})
}
}
},