vue父组件中修改子组件样式

1. 使用全局样式

<style>
/* 全局样式 */
</style>

<style scoped>
/* 本地样式 */
</style>

2. 使用深度作用选择器,必须有vue-loader(11.2.0以上)支持

/*a是子组件的顶层class*/

<style scoped>
.a >>> .b {
  /* ... */
}
或
.a /deep/ .b {
  /* ... */
}
</style>

猜你喜欢

转载自www.cnblogs.com/mengff/p/8991146.html