CSS use in vue: after pseudo-class to achieve click to change style

1. FIG
Insert picture description here
Insert picture description here
2. implemented
in

actived in the data is false at the beginning

Insert picture description here
方法中
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)
},
Insert picture description here
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;
}

Insert picture description here

Guess you like

Origin blog.csdn.net/WQzeus/article/details/109909664