1. 若是没有使用像less, sass等这样的css预处理器, 那么是只能使用 >>>这样的css深度选择器

<style scoped>
  .box >>> el.dialog {
  
  }
</style>

2. 若是使用了css预处理器,则可以使用/deep/, 如果/deep/ 无效,则使用 ::v-deep

<style scoped lang="scss">
  .box /deep/ el.dialog {
  
  }
</style>

<style scoped lang="scss">
  .box ::v-deep el.dialog {
  
  }
</style>

3. 如果使用了css预处理器,使用/deep/ 和::v-deep 都失效,那么需要看看style 上是不是没有加上 scoped。若加上了还是无效,那么就只能把代码写入全局css中了,但是需要注意用一个css类包裹起来,不然会改变很多全局样式。

<style>
.box .el-dialog {

}
</style>

<style lang="scss">
.box .el-dialog {

}
</style>
原文地址:https://blog.csdn.net/qq_40225369/article/details/118733197

相关文章:

  • 2022-01-15
  • 2021-04-28
  • 2021-08-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-17
  • 2023-01-14
  • 2021-10-03
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
  • 2021-10-25
相关资源
相似解决方案