作者:Mr-Leo-Chan | 来源:互联网 | 2023-05-19 17:18
<div :class&#61;"{ active: isActive, sort: isSort }">字体颜色</div>
data() {return {isActive: true,isSort: false,}
<style>
.active {color: red;
}
</style>
理解&#xff1a;
isActive为true,active类有效&#xff0c;isSort为false,sort类无效。
注&#xff1a;最终效果是&#xff1a;
<div :class&#61;"active">字体颜色</div>
最终效果&#xff1a;