vue指令:vue中使用样式
A:引用class使用样式 1:数组: 将class放到数组中,表示使用了数组中的class。对于普通的class = " " 。没有多大的优势。
2:在数组中使用三元表达式:
![](https://img2020.cnblogs.com/blog/977993/202003/977993-20200330215124558-480047427.jpg)
3:数组中嵌套对象:
将三元表达式写成了对象。
![](https://img2020.cnblogs.com/blog/977993/202003/977993-20200330215128330-17534033.jpg)
4:直接使用对象:
不使用数组,直接用对象。
![](https://img2020.cnblogs.com/blog/977993/202003/977993-20200330215146961-327672562.jpg)
B:使用内联样式: 1:直接给style 一个对象
2:将样式对象定义在data中,style引用该对象
![](https://img2020.cnblogs.com/blog/977993/202003/977993-20200330215225642-1463265828.jpg)
3:给style指定一个对象数组,同时应用两个类。
![](https://img2020.cnblogs.com/blog/977993/202003/977993-20200330215228373-2102308179.jpg)