console
new Vue({
el: '#app',
data: {
message: 'Hello Word!'
},
methods:{
change:function(){
this.message='Hello Vue!'
}
}
})
new Vue({
el:'#app2',
data:{
color:'#fff',
divHeight:"100",
divWidth:'100',
contenteditable:true
},
methods:{
changeColor:function(){
this.color="#ccc",
this.divHeight="100",
this.divWidth="100"
}
}
})
<div id='app'>
<p>{{message}}</p>
<button v-on:click='change'>改变</button>
</div>
<div id="app2">
<div v-bind:style=" {'background-color': color, 'height': divHeight + 'px','width':divWidth+'px','contenteditable':contenteditable}"></div>
<button v-on:click="changeColor">变化</button>
</div>