對象形式的處理方法:
:style="{ width: vueWidth+ 'px'?, height: vueHeight+ 'px' }"
:style="{width:(vueWidth===vueHeight?'180px':vueWidth)}"
需要注意的地方:
1.除了變量以外的其他屬性值都需要使用引號括起來,例如margin: '10px',而不是margin: 10px
2.凡是有-的屬性名都要變成駝峰式,比如border-radius要變成borderRadius
:style="{ width: vueWidth+ 'px'?, height: vueHeight+ 'px' }"
:style="{width:(vueWidth===vueHeight?'180px':vueWidth)}"
1.除了變量以外的其他屬性值都需要使用引號括起來,例如margin: '10px',而不是margin: 10px
2.凡是有-的屬性名都要變成駝峰式,比如border-radius要變成borderRadius