标签:model 改变 source htm 的区别 数据绑定 data 组成 enter
<span v-bind:class="cssObj">{{title}}</span>
new Vue({
el: ‘#app‘,
data: {
cssObj:{
red:true,
font:true
}
}
})
数组形式
:class=[] 是由 数组中的每一项对应的值决定
<span v-bind:class="styleObj">{{title}}</span>
el: ‘#app‘,
data: {
styleObj:[‘red‘,‘font‘]
}
})
<input type="text" v-model="title">
<span v-bind:class="styleObj">{{title}}</span>
new Vue({
el: ‘#app‘,
data: {
title: "Hello World!!"
}
})
不用model的双向数据绑定
<input type="text" :value="title" @input="e=>title=e.target.value">
<span v-bind:class="styleObj">{{title}}</span>
标签:model 改变 source htm 的区别 数据绑定 data 组成 enter
原文地址:https://www.cnblogs.com/goff-mi/p/9392147.html