<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>
标签:vue,样式,绑定,------,test,isAAA,active,Class
From: https://www.cnblogs.com/lin513/p/17816290.html