JSFiddle - React, Tailwind, and code Playground
by hunterliu
HTML
<div id="app">
<div class="static" v-bind:class="[activeClass, errorClass]">div</div>
</div>
CSS
.static {
width: 100px;
height: 100px;
}
.active {
border: 1px solid #000;
}
.text-danger {
color: red;
}
JavaScript
var vm = new Vue({
el: '#app',
data: {
activeClass: 'active',
errorClass: 'text-danger'
}
});
//移除註解
//vm.$data.activeClass = '';
//vm.$data.errorClass = '';