chenshuai2144 / umi-plugin-antd-theme

🎨 Best theme plugin
https://preview.pro.ant.design/
MIT License
85 stars 29 forks source link

umi-plugin-antd-theme 如果变量引入的是图片资源,在 network disabled cache 的条件下会重复加载 #15

Open LittleGragon opened 4 years ago

LittleGragon commented 4 years ago

屏幕录制2020-03-0812 19 09

重现步骤:

  1. 声明图片资源变量 并:global 方式使用变量
  2. chrome network 设为disabled
  3. resize 窗口
  4. network 可观察到资源反复加载,导致引用图片资源的样式闪动
    // src/global.less
    @import '~antd/es/style/themes/default.less';
    html,
    body,
    #root {
    height: 100%;
    --bg: url('@/assets/bg.jpg');
    }
// src/pages/Welcome.less
@import '~antd/lib/style/themes/default.less';
.pre {
  margin: 12px 0;
  padding: 12px 20px;
  background: @input-bg;
  box-shadow: @card-shadow;
}
:global {
  .ant-layout {
    background: var(--bg);
  }
}