From 8a8ae557f701d49caef1da3ab89c54587b530130 Mon Sep 17 00:00:00 2001 From: preschooler Date: Wed, 23 Oct 2024 10:52:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20fix:@import=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=20@use=20=E4=BB=A5=E5=BA=94=E5=AF=B9=20sass=20?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=BC=83=E7=94=A8=20@import=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../package/theme/element-variables.scss | 2 +- .../bpmnProcessDesigner/package/theme/index.scss | 4 ++-- .../package/theme/process-designer.scss | 6 +++--- src/styles/global.module.scss | 2 +- src/styles/index.scss | 8 ++++---- vite.config.ts | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/bpmnProcessDesigner/package/theme/element-variables.scss b/src/components/bpmnProcessDesigner/package/theme/element-variables.scss index 49bd326d..0646f8e1 100644 --- a/src/components/bpmnProcessDesigner/package/theme/element-variables.scss +++ b/src/components/bpmnProcessDesigner/package/theme/element-variables.scss @@ -5,7 +5,7 @@ $--color-danger: #ff4d4f; /* 改变 icon 字体路径变量,必需 */ $--font-path: '~element-ui/lib/theme-chalk/fonts'; -@import '~element-ui/packages/theme-chalk/src/index'; +@use '~element-ui/packages/theme-chalk/src/index'; .el-table td, .el-table th { diff --git a/src/components/bpmnProcessDesigner/package/theme/index.scss b/src/components/bpmnProcessDesigner/package/theme/index.scss index 2e60fad4..0c77cfa2 100644 --- a/src/components/bpmnProcessDesigner/package/theme/index.scss +++ b/src/components/bpmnProcessDesigner/package/theme/index.scss @@ -1,2 +1,2 @@ -@import './process-designer.scss'; -@import './process-panel.scss'; +@use './process-designer.scss'; +@use './process-panel.scss'; diff --git a/src/components/bpmnProcessDesigner/package/theme/process-designer.scss b/src/components/bpmnProcessDesigner/package/theme/process-designer.scss index 6af945da..b1ff0af3 100644 --- a/src/components/bpmnProcessDesigner/package/theme/process-designer.scss +++ b/src/components/bpmnProcessDesigner/package/theme/process-designer.scss @@ -1,6 +1,6 @@ -@import 'bpmn-js-token-simulation/assets/css/bpmn-js-token-simulation.css'; -@import 'bpmn-js-token-simulation/assets/css/font-awesome.min.css'; -@import 'bpmn-js-token-simulation/assets/css/normalize.css'; +@use 'bpmn-js-token-simulation/assets/css/bpmn-js-token-simulation.css'; +@use 'bpmn-js-token-simulation/assets/css/font-awesome.min.css'; +@use 'bpmn-js-token-simulation/assets/css/normalize.css'; // 边框被 token-simulation 样式覆盖了 .djs-palette { diff --git a/src/styles/global.module.scss b/src/styles/global.module.scss index 8448a924..af793f03 100644 --- a/src/styles/global.module.scss +++ b/src/styles/global.module.scss @@ -1,4 +1,4 @@ -@import './variables.scss'; +@use './variables.scss' as *; // 导出变量 :export { namespace: $namespace; diff --git a/src/styles/index.scss b/src/styles/index.scss index 766f983e..7607941c 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,7 +1,7 @@ -@import './var.css'; -@import './FormCreate/index.scss'; -@import './theme.scss'; -@import 'element-plus/theme-chalk/dark/css-vars.css'; +@use './var.css'; +@use './FormCreate/index.scss'; +@use './theme.scss'; +@use 'element-plus/theme-chalk/dark/css-vars.css'; .reset-margin [class*='el-icon'] + span { margin-left: 2px !important; diff --git a/vite.config.ts b/vite.config.ts index 3ef21f26..57611ce6 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -43,7 +43,7 @@ export default ({command, mode}: ConfigEnv): UserConfig => { css: { preprocessorOptions: { scss: { - additionalData: '@import "./src/styles/variables.scss";', + additionalData: '@use "@/styles/variables.scss" as *;', javascriptEnabled: true } }