vue-style总结
其实vue官网已经讲的很详细了:https://cn.vuejs.org/v2/guide/class-and-style.html#ad
我自己记录一下style是如何用的:
1.直接写死
//背景色和字体
<label style="background-color:red;font-size:50px">{{ label }}</label>
2.值由多个变量控制
<label :style="'background-color:'+backgroundColor+';font-size:'+bodyStyle+'px'">{{ label }}</label>
data () {
return {
bodyStyle: 20,
backgroundColor:'red'
};
},
3.值是个对象
<label :style="styleClass">{{ label }}</label> data () { return { styleClass:{ 'background-color':'red', 'font-size':'50px' } }; },
浙公网安备 33010602011771号