首页 > 建站教程 > 前端框架 >  [@vue/compiler-sfc] ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.正文

[@vue/compiler-sfc] ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.

vue3打包提示下面错误:

[@vue/compiler-sfc] ::v-deep usage as a combinator has been deprecated. Use :deep(<inner-selector>) instead.


如下图:

vue3打包


原因是vue3使用sass预处理器使用::v-deep深度选择器而导致的:

<style scoped> ::v-deep .demo{background:yellow;}</style>


此种写法已经被抛弃,改成:deep即可:

<style scoped> :deep(.demo){background:yellow;}</style>