1. 程式人生 > >樣式綁定

樣式綁定

idt border over app1 v-on () data seo .class

實例

<div id="app1" v-bind:class="{class1: isOK, class2: class2IsOK}" v-on:mouseover="app1MouseOver" v-on:mouseleave="app1MouseLeave"></div>
.class1{
    width: 200px;
    height: 200px;
    background: grey;
}

.class2{
    border-radius: 100px;
}
var app1 = new Vue({
    el: 
"#app1", data: { isOK: true, class2IsOK: false }, methods: { app1MouseOver: function(){ this.class2IsOK = true; }, app1MouseLeave: function(){ this.class2IsOK = false; } } });

樣式綁定