Contents

vue动态绑定类名

Contents
<template>
    <p :class="{ 'isActive': flag }">文本一</p>
    <p :class="['activeA', 'activeB']">文本二</p>
    <p :class="['activeA', 'activeB', { activeC: flag }]">文本三</p>
</template>

<script setup>
import { ref } from 'vue'
const flag=ref(true);
</script>