vue中,使用scss后,样式穿透失效的问题


vue 样式穿透问题

vue项目中样式使用scss时,对于需要穿透的样式,使用 >>> 穿透可能会不生效,解决办法也很简单:
将
<style lang="scss" scoped>
.a >>> .b {
  font-size: 24px;
}
</style>

修改为:

<style lang="scss" scoped>
.a /deep/ .b {
  font-size: 24px;
}
</style>
或者

<style lang="scss" scoped>
.a ::v-deep .b {
  font-size: 24px;
}
</style>


官方地址[https://vue-loader.vuejs.org/zh/guide/scoped-css.html#混用本地和全局样式]


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM