class动态绑定(三元运算)
:class="[judge?‘class1’:‘class2’]"
更多方法可参考慕课手记
style动态设置
:style="{left:contentmenuX+‘px’}"
多个动态绑定只要用‘,’隔开就行
:style="{left:contentmenuX+‘px’,top:contentmenuY+‘px’}"
注意:
style带 - 的如background-color在动态设置style时,- 后的内容首字母大写
:style="{backgroundColor:’#6ba2d6’}"
:style="{backgroundColor:’#6ba2d6’,fontSize:font+‘px’}"