1.如图
vue中CSS使用:after伪类实现点击改变样式
vue中CSS使用:after伪类实现点击改变样式
2.实现

data中actived一开始为false

vue中CSS使用:after伪类实现点击改变样式
方法中
gbys () {
this.ddh = JSON.parse(window.localStorage.getItem(‘ddh’))
console.log(this.yhid)
console.log(this.fxid)
this.actived = !this.actived
console.log(this.actived)
},
vue中CSS使用:after伪类实现点击改变样式
style中
.actived{
position: relative;
border: 1px solid red !important;
}
.actived:after{
content: ‘’;
background: url(’…/…/assets/img/duigou.png’) no-repeat bottom right;
position: absolute;
width: 45px;
height: 45px;
bottom: 0;
right: 0;
}

vue中CSS使用:after伪类实现点击改变样式

相关文章: