如果父组件style设置了scoped,除了全局样式与子组件内部修改样式以外不受外部样式的影响,但要是父组件想修改子组件某个地方的样式但又不想为了这么一点变动去添加个全局样式该怎么做呢?
这种情况可以使用带穿透功能的css选择器 >>>,如:
<style scoped> .nav >>> .component{ color: #f1f1f1; } >>> .component{ color: #fff; } </style>
与其作用相同的还有深度作用选择器/deep/
<style scoped> .nav /deep/ .component{ color: #f1f1f1; } /deep/ .component{ color: #fff; } </style>