vue中style scope深度访问新方式(::v-deep)

221 阅读1分钟

1、>>>

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

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

2、/deep/

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

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

3、::v-deep

切记必须是双冒号

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

转自:vue中style scope深度访问新方式(::v-deep) - SegmentFault 思否