console
new Vue({
el: '#app',
data: {
color: '#6c9',
colors: ['#6c9','#69c','#569','#aaa','#fa0','#f10'],
isShowBox: true,
isShowBorder: false
}
})
<div id="app">
<div v-show="1 == isShowBox" :style="{background:color}" :class="{border:isShowBorder}"
class="box">
Box
</div>
<select v-model="color">
<option v-for='color in colors' :key='color'>
{{color}}
</option>
</select>
<label>
<input v-model="isShowBorder" type="checkbox" />
是否有边框
</label>
<label>
<input name="toggle" value="1" v-model="isShowBox" type="radio" />
显示
</label>
<label>
<input name="toggle" value="2" v-model="isShowBox" type="radio" />
隐藏
</label>
</div>
.box {
padding: 15px;
transform: all 600ms;
background: #6c9;
}
.border {
border: 5px solid #f10;
}