Click to switch back and forth between classes and switching styles

Realization effect: Initially class1 clicks to class2, clicks again to change back to class2, and switches to display
html according to the style corresponding to different classes

<div v-bind:class="{
     
     'class1':isYes,'class2':!isYes}"
   @click="isYes=!isYes">1</div>

js data

isYes: true,

css custom

.class1{
    
    

}
.class2{
    
    

}

Je suppose que tu aimes

Origine blog.csdn.net/m0_46538057/article/details/111639488
conseillé
Classement