首页 > 其他分享 >深度选择器的使用

深度选择器的使用

时间:2022-12-08 12:14:49浏览次数:27  
标签:... vue 方式 深度 deep 使用 选择器

1、>>>

如果vue的style使用的是css,那么则

<style lang="css" scoped>
.a >>> .b { 
 /* ... */ 
}
</style>

但是像scss等预处理器却无法解析>>>,所以我们使用下面的方式.

2、/deep/

<style lang="scss" scoped>
.a{
 /deep/ .b { 
  /* ... */ 
 }
} 
</style>

但是有些开发者反应,在vue-cli3编译时,deep的方式会报错或者警告。
此时我们可以使用第三种方式

3、::v-deep

切记必须是双冒号

<style lang="scss" scoped>
.a{
 ::v-deep .b { 
  /* ... */ 
 }
} 
</style>

vue3正确的写法

::v-deep(.el-icon){
    height: inherit;
}

标签:...,vue,方式,深度,deep,使用,选择器
From: https://www.cnblogs.com/guozhiqiang/p/16965718.html

相关文章