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

[@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

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐