image.png

代码

<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue.js 样式-class 属性绑定多个样式</title>
    <script src="//static.gzj2001.com/vue/vue.js"></script>
    <style>
    .box{
        background-color: #888;
    }
    .box2{
        border: 1px springgreen solid;
    }
    .box3{
        width: 250px;
        height: 250px;
    }
    </style>
</head>
<body>
    <div id="app">
        <div class="box box2 box3">000</div>
        <div v-bind:class="{box:active,box2:active,box3:active}">111</div>
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                active:true,
                noActive:false
                
            }
        })
    </script>
</body>
</html>

效果

image.png