今天在做项目的时候发现有这么一条警告

[@vue/compiler-sfc] the >>> and /deep/ combinators have been deprecated. Use :deep() instead.

是因为在 vue3 中已经弃用了 /deep/ (深度选择器) 使用: :deep()

错误使用方法:

// 之前是这样的写法
 .el-aside {
        width: 220px;
        height: calc(100vh - 10vh);
        border-right: 1px solid #e6e6e6;
        overflow-x: hidden;
        /deep/.el-scrollbar__wrap {
            overflow: auto !important;
            height: 100%;
        }
    }
// 报警告:[@vue/compiler-sfc] the >>> and /deep/ combinators have been deprecated. Use :deep() instead.

正确使用方法:

这样写,就不会有警告信息了

 .el-aside {
        width: 220px;
        height: calc(100vh - 10vh);
        border-right: 1px solid #e6e6e6;
        overflow-x: hidden;
        //重点 重点 重点-------------------------------
        :deep(.el-scrollbar__wrap) {
            overflow: auto !important;
            height: 100%;
        }
        //重点 重点 重点-------------------------------
    }
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐