vue-test ------class绑定

<template>
  <p :class="{'active':isActive}">Class样式绑定</p>
  <p :class="Objec">Class样式绑定</p>
  <p :class="[arrActive,arrHasErr]">Class样式绑定3</p>
  <p :class="isActive ? 'active':' '">Class样式绑定4</p>


</template>

<script>
export default {
  name: "ClassDemo",
  data(){
    return{
      isActive: false,
      Objec:{
        'active':true,
        'isAAA':true
      },
      arrActive:"active",
      arrHasErr:"isAAA"
    }
  }
}
</script>

<style scoped>
.active{
  color: red;

}
.isAAA{
  font-size: 30px;
}
</style>
posted @ 2023-11-07 22:51  会秃头的小白  阅读(4)  评论(0编辑  收藏  举报