- 凡是有-的style屬性名都要變成駝峯式,比如font-size要變成
fontSize
- 除了綁定值,其他的屬性名的值要用引號括起來,比如
backgroundColor:'#00a2ff'
而不是 backgroundColor:#00a2ff
對象
-
html :style="{ color: activeColor, fontSize: fontSize + 'px' }"
-
html :style="{display:(activeName=='first'?'flex':'none')}"
數組
html :style="[baseStyles, overridingStyles]"
html :style="[{display:(activeName=='first'?'flex':'none')},{fontSize:'20px'}]"
三目運算符
html :style="{color:(index==0?conFontColor:'#ddd')}"
html :style="[{color:(index==0?conFontColor:'#ddd')},{fontSize:'22px'}]"
多重值
此時,瀏覽器會根據運行支持情況進行選擇
html :style="{ display: ['-webkit-box', '-ms-flexbox', 'flex'] }"