From 274f683a47523769d91420eb0135d2c763e2e9dc Mon Sep 17 00:00:00 2001 From: haoxr <1490493387@qq.com> Date: Mon, 27 Feb 2023 22:21:04 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=A0=B7=E5=BC=8F=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=BB=93=E6=9E=84=E4=BC=98=E5=8C=96=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E9=87=8D=E7=BD=AE=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 244309f3ab8375f83df2d69b1b474cab23045b22 --- src/styles/dark.scss | 12 +++++- src/styles/global.scss | 30 ------------- src/styles/index.scss | 31 ++++++-------- src/styles/reset.scss | 90 +++++++++++++++++++++++++++++++++++++++ src/styles/variables.scss | 14 ++++++ 5 files changed, 127 insertions(+), 50 deletions(-) delete mode 100644 src/styles/global.scss create mode 100644 src/styles/reset.scss diff --git a/src/styles/dark.scss b/src/styles/dark.scss index 31bdbbbe..33c6bb80 100644 --- a/src/styles/dark.scss +++ b/src/styles/dark.scss @@ -1,4 +1,14 @@ -html.dark { +html.dark{ + --menuBg:var(--el-bg-color-overlay); + --menuText:#fff; + --menuActiveText:var(--el-menu-active-color); + --menuHover:rgba(0,0,0,.2); + + --subMenuBg: var(--el-menu-bg-color); + --subMenuActiveText:var(--el-menu-active-color); + --subMenuHover: rgba(0,0,0,.2); + + .navbar { background-color: var(--el-bg-color); color: var(--el-text-color-regular); diff --git a/src/styles/global.scss b/src/styles/global.scss deleted file mode 100644 index 4fd984af..00000000 --- a/src/styles/global.scss +++ /dev/null @@ -1,30 +0,0 @@ -html, -body, -#app { - height: 100%; - margin: 0; - padding: 0; -} -a{ - text-decoration:none -} - - -svg { - vertical-align: -0.15em; //因icon大小被设置为和字体大小一致,而span等标签的下边缘会和字体的基线对齐,故需设置一个往下的偏移比例,来纠正视觉上的未对齐效果 -} - - -// main-container global css -.app-container { - padding: 20px; -} - -.search { - padding: 18px 0 0 10px; - margin-bottom: 10px; - border-radius: var(--el-card-border-radius); - border: 1px solid var(--el-border-color-light); - box-shadow: var(--el-box-shadow-light); - background-color: var(--el-bg-color-overlay); -} diff --git a/src/styles/index.scss b/src/styles/index.scss index d276710a..a115f469 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1,27 +1,20 @@ @import './sidebar.scss'; -@import './global.scss'; +@import './reset.scss'; @import './dark.scss'; -// 自定义全局CSS变量 -:root{ - --menuBg:#304156; - --menuText:#bfcbd9; - --menuActiveText:#409eff; - --menuHover:#263445; - --subMenuBg: #1f2d3d; - --subMenuActiveText: #f4f4f5; - --subMenuHover: #001528; + +// main-container global css +.app-container { + padding: 20px; } -html.dark{ - --menuBg:var(--el-bg-color-overlay); - --menuText:#fff; - --menuActiveText:var(--el-menu-active-color); - --menuHover:rgba(0,0,0,.2); - - --subMenuBg: var(--el-menu-bg-color); - --subMenuActiveText:var(--el-menu-active-color); - --subMenuHover: rgba(0,0,0,.2); +.search { + padding: 18px 0 0 10px; + margin-bottom: 10px; + border-radius: var(--el-card-border-radius); + border: 1px solid var(--el-border-color-light); + box-shadow: var(--el-box-shadow-light); + background-color: var(--el-bg-color-overlay); } diff --git a/src/styles/reset.scss b/src/styles/reset.scss new file mode 100644 index 00000000..0346736f --- /dev/null +++ b/src/styles/reset.scss @@ -0,0 +1,90 @@ +*, +::before, +::after { + box-sizing: border-box; + border-width: 0; + border-style: solid; + border-color: currentColor; +} + +#app { + width: 100%; + height: 100%; +} + +html { + line-height: 1.5; + -webkit-text-size-adjust: 100%; + -moz-tab-size: 4; + tab-size: 4; + width: 100%; + height: 100%; + box-sizing: border-box; +} + +body { + margin: 0; + line-height: inherit; + width: 100%; + height: 100%; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + text-rendering: optimizelegibility; + font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", + "Microsoft YaHei", "微软雅黑", Arial, sans-serif; +} + + +a { + color: inherit; + text-decoration: inherit; +} + + +img, +svg + { + display: inline-block; +} +svg { + vertical-align: -0.15em; //因icon大小被设置为和字体大小一致,而span等标签的下边缘会和字体的基线对齐,故需设置一个往下的偏移比例,来纠正视觉上的未对齐效果 +} + + + + + +*, +*::before, +*::after { + box-sizing: inherit; +} + +a:focus, +a:active { + outline: none; +} + +a, +a:focus, +a:hover { + cursor: pointer; + color: inherit; + text-decoration: none; +} + +div:focus { + outline: none; +} + +.clearfix { + &::after { + visibility: hidden; + display: block; + font-size: 0; + content: " "; + clear: both; + height: 0; + } +} + diff --git a/src/styles/variables.scss b/src/styles/variables.scss index 84233837..0c6d3868 100644 --- a/src/styles/variables.scss +++ b/src/styles/variables.scss @@ -1,4 +1,18 @@ // 全局SCSS变量 + +:root{ + --menuBg:#304156; + --menuText:#bfcbd9; + --menuActiveText:#409eff; + --menuHover:#263445; + + --subMenuBg: #1f2d3d; + --subMenuActiveText: #f4f4f5; + --subMenuHover: #001528; + +} + + $menuBg: var(--menuBg); $menuText: var(--menuText); $menuActiveText: var(--menuActiveText);