样式
  # 动态切换class
# 样式穿透
需要覆盖三方组件库时,需要用到样式穿透:deep()Vue3写法
参考
// 对class: favorite-project-box, 进行样式穿透,
// 覆盖vant组件中.van-list__finished-text,.van-list__loading两个样式
<style lang="less" scoped>
  :deep(.favorite-project-box) {
    width: 100%;
    box-sizing: border-box;
    padding: 0.15rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    .van-list__finished-text,
    .van-list__loading {
      width: 100% !important;
    }
  }
</style>
 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
编辑  (opens new window)
  上次更新: 2022/06/17