Vue中父组件修改子组件样式方法(深度选择器)

以Element-ui为例。那就是在父组件写css时,样式选择器中加上 /deep/或者 >>> 这两个标记,即可渗透到子组件的样式中。

vue-loader 11.2.0 才开始支持,官方文档 https://vue-loader.vuejs.org/guide/scoped-css.html#deep-selectors

加上/deep/或者>>>

.back_index /deep/.el-menu-item{

color:#a7b1c2!important;

}

子组件的样式就被父组件的样式给修改了。

转载自: <https://blog.csdn.net/u011423258/article/details/80649183>

猜你喜欢

转载自blog.csdn.net/weixin_43788602/article/details/88074401