Skip to content

Commit

Permalink
fix: 修复全局变量无法识别
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangshigui committed Sep 4, 2024
1 parent e65e5e2 commit a4159a3
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
24 changes: 22 additions & 2 deletions src/assets/css/var.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
/*
* @Author: liuhua
* @Date: 2023-06-02 16:47:08
* @LastEditors: liuhua
* @LastEditTime: 2023-06-12 09:27:05
* @LastEditors: zhangshigui
* @LastEditTime: 2024-09-04 22:00:05
* @Description: 定义less变量
*/

// 基色
@color-balck-4: rgba(0, 0, 0, 0.04);
@color-black-8: rgba(0, 0, 0, 0.08);
@color-black-16: rgba(0, 0, 0, 0.16);
@color-black-24: rgba(0, 0, 0, 0.24);
@color-black-48: rgba(0, 0, 0, 0.48);
@color-black-64: rgba(0, 0, 0, 0.64);
// 提示色
@color-danger: #D92B40;
@color-info: #165DD9;
@color-warn: #FF7119;
@color-success: #06993E;

// 文字大小
@font-size-mini: 12px;
@font-size-small: 14px;
@font-size-base: 16px;
@font-size-large: 18px;

4 changes: 2 additions & 2 deletions src/views/process/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
bottom: 24px;
right: 24px;
.x6-widget-minimap {
border: 1px solid rgba(0, 0, 0, 0.08);
border: 1px solid @color-black-8;
border-radius: 4px;
.x6-graph {
width: 100% !important;
Expand All @@ -22,7 +22,7 @@
height: 60px !important;
border-radius: 2px;
border: none;
box-shadow: rgba(0, 0, 0, 0.08) 0 0 0 100vh;
box-shadow: @color-black-8 0 0 0 100vh;
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export default defineConfig(({ command, mode }) => {
/**
* 加载入口文件
* ❌ 必须在main.tsx中引入一个less文件,这里的引入才会生效
* ✅ 所以直接在main.tsx中加载入口文件吧。
* ✅ 这里引入能够保证全局变量等的使用
*/
// preprocessorOptions: {
// less: {
// charset: false,
// additionalData: `@import '@/assets/css/index.less';`
// }
// }
preprocessorOptions: {
less: {
charset: false,
additionalData: `@import '@/assets/css/index.less';`
}
}
},
build: {
outDir: 'dist', // 输出目录
Expand Down

0 comments on commit a4159a3

Please sign in to comment.