研发图纸文件管理系统-前端项目
iczer
2020-06-30 8034f474d625271d3f72d95772b84da70d2ddedc
fix: the problem that changing the theme color does not work because of cache reasons :star2:
修复: 缓存原因导致主题色更换不生效的问题;
2个文件已修改
6 ■■■■■ 已修改文件
src/utils/themeUtil.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/themeUtil.js
@@ -18,7 +18,9 @@
  changeThemeColor (newColor) {
    let lastColor = this.lastColor || this.primaryColor
    let options = {
      cssUrl: '/css/theme-colors.css',
      changeUrl (cssUrl) {
        return `/${cssUrl}` // while router is not `hash` mode, it needs absolute path
      },
      oldColors: this.getThemeColors(lastColor),
      newColors: this.getThemeColors(newColor)
    }
vue.config.js
@@ -14,7 +14,7 @@
    config.entry.app = ["babel-polyfill", "whatwg-fetch", "./src/main.js"];
    config.plugins.push(
      new ThemeColorReplacer({
        fileName: 'css/theme-colors.css',
        fileName: 'css/theme-colors-[contenthash:8].css',
        matchColors: getThemeColors(themeColor),
        changeSelector
      })