行业知识
【Vue3】CSS 新特性
2026-11-07 12:35:43
来源:互联网转载
:slotted
���要插入了 import Son from './components/Son.vue'
插槽: :slotted(.a) { color: cadetblue;} :global
我要插入了 import Son from './components/Son.vue':global(p) { color: aqua;} v-bind
动态css1 动态css2import {ref} from "vue";const style1 = ref('lightblue')const style2 = ref({ color: 'lightgreen'}).c1 { color: v-bind('style1')}.c2 { color: v-bind('style2.color')} module
动态css1 动态css2import {ref} from "vue";.c1 { color: lightblue}.c2 { border: 1px solid black;} 如果 module 没有指定名字,则默认使用:。
此外,他还有自定义hook useCssModule。
:deep
:deep() 和 样式穿透