The function of v-bind
- v-bind is used to bind one or more property values or pass props values to another component
- Develop dynamic binding of label attributes
v-bind binding class
<h2 :class='{'active':isAcive,...}'> </h2>
<h2 class=‘title’ :class='{'active':isAcive,...}'> </h2>
<h2 class=‘title’ :class='classes()'> </h2>
methods:{
classes(){
return {
'active':this.isAcive}
}
}
<h2 class=‘title’ :class='[qwer,yui]'> </h2>
data:{
qwer:'active',
yui:'fs-color'
}
v-bind bind style
:style='{color:currentColor,font-size:fontSize + 'px'}'
:style= ‘[baststyle,overflowles]’
data:{
baststyle:{
background:red},
overflowles:{
overflow:hiddden}
}