<template>
<span class="static" v-bind:class="{ 'class-a' : isA, 'class-b': !isA}" @click="toggle">
<template>
<script>
export default {
data: function(){
return {
isA: false
};
},
methods: {
toggle: function(){
this.isA = !this.isA;
}
}
};
<script>
vue点击切换class
最新推荐文章于 2024-04-11 15:20:18 发布