不多BB了 直接上代码了 通俗移动易懂总结了5种常用改变样式 的形式
<style> .actived2{ color:red; } </style> </head> <body> <div class="app"> <div :style="actived">aaa</div> <div :style="[actived]">aaa</div> <div :style="{color:'red'}">aaa</div> <div :class="['actived2']">aaa</div> <div :class="{actived2:isActived}">aaa</div> </div> </body> <script> const app = new Vue({ el:'.app', data:{ actived:{ color:"red" }, isActived:true } }) </script>