Vue 3.0使用 sass 预处理器使用 ::v-deep 深度选择器抛出如下警告

由于 Vue 3.0 单文件规范中深度选择器 ::v-deep、/deep/、>>> 写法已经被废弃

// 报错前的用法

.container {
  ::v-deep .box {
    left: 270px;
  }
  ::v-deep .main {
    padding-left: 250px;
  }
}
.container {
  :deep(.box) {
    left: 270px;
  }
  :deep(.main) {
    padding-left: 250px;
  }
}

如果需要对多个盒子穿透设置相同得样式则如下:

:deep(.el-table th),
:deep(.el-table td) {
  background: none;
  color: #000;
  font-weight: 300;
  border-right: solid 1px #dbdbdb;
}

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐