From 875c2671816fec22982f85cd9360936ff5a29498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Sat, 14 May 2022 22:40:48 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20sass=20?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E6=A0=B7=E5=BC=8F=E7=B1=BB=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=8E=A5=E5=8F=A3=E4=B8=8B=E8=BD=BD=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/styles/common/style.scss | 77 ++++++++----------- src/styles/common/var.scss | 25 ++++++ .../components/ChartAnimation/index.vue | 4 +- .../components/ChartDataAjax/index.vue | 24 +++--- .../ChartDataMatchingAndShow/index.vue | 28 +++++-- 5 files changed, 94 insertions(+), 64 deletions(-) diff --git a/src/styles/common/style.scss b/src/styles/common/style.scss index 8bd325e6..9fde7bf4 100644 --- a/src/styles/common/style.scss +++ b/src/styles/common/style.scss @@ -80,54 +80,41 @@ word-break: break-all; } -// todo 使用 scss 循环写一套完整的 -// margin -.go-mt-0 { - margin-top: 0 !important; -} +// class:m-1 => margin:1em +// class:mt-1 => margin-top:1em +// m-0|mt-0|mx-0|my-0|p-0|pt-0|... -.go-mb-0 { - margin-bottom: 0 !important; -} -.go-ml-0 { - margin-left: 0 !important; -} +@each $typekey, $type in $spacing-types { + //.m-1 + @each $sizekey, $size in $spacing-sizes { + .go-#{$typekey}-#{$sizekey} { + #{$type}: $size * $spacing-base-size; + } + } -.go-mr-0 { - margin-right: 0 !important; -} + //.mx-1 + @each $sizekey, $size in $spacing-sizes { + .go-#{$typekey}x-#{$sizekey} { + #{$type}-left: $size * $spacing-base-size; + #{$type}-right: $size * $spacing-base-size; + } -.go-my-0 { - @extend .go-mt-0; - @extend .go-mb-0; -} + .go-#{$typekey}y-#{$sizekey} { + #{$type}-top: $size * $spacing-base-size; + #{$type}-bottom: $size * $spacing-base-size; + } + } -.go-mx-0 { - @extend .go-ml-0; - @extend .go-mr-0; -} + //.mt-1 + @each $directionkey, $direction in $spacing-directions { + @each $sizekey, $size in $spacing-sizes { + .go-#{$typekey}#{$directionkey}-#{$sizekey} { + #{$type}-#{$direction}: $size * $spacing-base-size; + } + } + } -.go-pt-0 { - padding-top: 0 !important; -} - -.go-pb-0 { - padding-bottom: 0 !important; -} -.go-pl-0 { - padding-left: 0 !important; -} - -.go-pr-0 { - padding-right: 0 !important; -} - -.go-py-0 { - @extend .go-pt-0; - @extend .go-pb-0; -} - -.go-px-0 { - @extend .go-pl-0; - @extend .go-pr-0; + .go-#{$typekey} { + #{$type}: 0 !important; + } } \ No newline at end of file diff --git a/src/styles/common/var.scss b/src/styles/common/var.scss index c393e4b9..ee4ded0c 100644 --- a/src/styles/common/var.scss +++ b/src/styles/common/var.scss @@ -10,6 +10,31 @@ $--color-text-2: #86909c; $--color-text-3: #c9cdd4; $--color-text-4: #f2f3f5; +//.mt-1 => margin top +//spacing +$spacing-base-size: 1em; + +$spacing-types: ( + m: margin, + p: padding, +); + +$spacing-directions: ( + t: top, + r: right, + b: bottom, + l: left, +); + +$spacing-sizes: ( + 0: 0, + 1: 0.25, + 2: 0.5, + 3: 1, + 4: 1.5, + 5: 2.5, +); + // 变亮值 $--light-shalow: 2%; diff --git a/src/views/chart/ContentConfigurations/components/ChartAnimation/index.vue b/src/views/chart/ContentConfigurations/components/ChartAnimation/index.vue index fb196801..86151033 100644 --- a/src/views/chart/ContentConfigurations/components/ChartAnimation/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartAnimation/index.vue @@ -73,8 +73,8 @@ const addAnimation = (item: { label: string; value: string }) => { width: 100%; } .animation-item { - height: 50px; - line-height: 50px; + height: 40px; + line-height: 40px; text-align: center; cursor: pointer; border-radius: 5px; diff --git a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue index 60454dfd..72e3c0cd 100644 --- a/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartData/components/ChartDataAjax/index.vue @@ -20,16 +20,10 @@ -