From 10e231168ac469a823e668919bf0db0363553158 Mon Sep 17 00:00:00 2001
From: kooriookami <38392315+kooriookami@users.noreply.github.com>
Date: Thu, 30 Dec 2021 17:46:33 +0800
Subject: [PATCH] style: update descriptions style (#5025)
* style: update descriptions style
* style: update
* style: update demo
* style: update
* style: update
* style: update
* style: update
* style: update
* feat: update
---
docs/examples/descriptions/sizes.vue | 83 +++++++++++---
docs/examples/descriptions/vertical-list.vue | 42 ++++++--
.../descriptions/src/descriptions-cell.ts | 16 ++-
.../components/descriptions/src/index.vue | 20 ++--
packages/theme-chalk/src/common/var.scss | 4 +-
.../theme-chalk/src/descriptions-item.scss | 58 +++++++++-
packages/theme-chalk/src/descriptions.scss | 102 +++++++++++++-----
7 files changed, 256 insertions(+), 69 deletions(-)
diff --git a/docs/examples/descriptions/sizes.vue b/docs/examples/descriptions/sizes.vue
index b6d1946ec4..c035f690c2 100644
--- a/docs/examples/descriptions/sizes.vue
+++ b/docs/examples/descriptions/sizes.vue
@@ -13,40 +13,60 @@
border
>
- Operation
+ Operation
-
- Username
+
+
+
+
+ Username
+
kooriookami
-
- Telephone
+
+
+
+
+ Telephone
+
18100000000
-
- Place
+
+
+
+
+ Place
+
Suzhou
-
- Remarks
+
+
+
+
+ Remarks
+
School
-
- Address
+
+
+
+
+ Address
+
No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province
@@ -57,9 +77,10 @@
title="Without border"
:column="3"
:size="size"
+ :style="blockMargin"
>
- Operation
+ Operation
kooriookami
18100000000
@@ -68,14 +89,13 @@
School
No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu
- Province
+ >No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province
+
+
+
diff --git a/docs/examples/descriptions/vertical-list.vue b/docs/examples/descriptions/vertical-list.vue
index 0eb572302e..5d716c1c47 100644
--- a/docs/examples/descriptions/vertical-list.vue
+++ b/docs/examples/descriptions/vertical-list.vue
@@ -1,8 +1,15 @@
+
+ Large
+ Default
+ Small
+
+
kooriookami
@@ -12,16 +19,16 @@
School
No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu
- Province
+ >No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province
+
kooriookami
18100000000
@@ -30,8 +37,29 @@
School
No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu
- Province
+ >No.1188, Wuzhong Avenue, Wuzhong District, Suzhou, Jiangsu Province
+
+
+
+
+
diff --git a/packages/components/descriptions/src/descriptions-cell.ts b/packages/components/descriptions/src/descriptions-cell.ts
index 8c9aeca92f..db131f49bf 100644
--- a/packages/components/descriptions/src/descriptions-cell.ts
+++ b/packages/components/descriptions/src/descriptions-cell.ts
@@ -34,6 +34,8 @@ export default defineComponent({
this.cell as VNode
) as IDescriptionsItemInject
+ const { border, direction } = this.descriptions
+ const isVertical = direction === 'vertical'
const label = this.cell?.children?.label?.() || item.label
const content = this.cell?.children?.default?.()
const span = item.span
@@ -55,11 +57,14 @@ export default defineComponent({
class: [
'el-descriptions__cell',
'el-descriptions__label',
- { 'is-bordered-label': this.descriptions.border },
+ {
+ 'is-bordered-label': border,
+ 'is-vertical-label': isVertical,
+ },
labelAlign,
labelClassName,
],
- colSpan: this.descriptions.direction === 'vertical' ? span : 1,
+ colSpan: isVertical ? span : 1,
},
label
)
@@ -71,11 +76,14 @@ export default defineComponent({
class: [
'el-descriptions__cell',
'el-descriptions__content',
+ {
+ 'is-bordered-content': border,
+ 'is-vertical-content': isVertical,
+ },
align,
className,
],
- colSpan:
- this.descriptions.direction === 'vertical' ? span : span * 2 - 1,
+ colSpan: isVertical ? span : span * 2 - 1,
},
content
)
diff --git a/packages/components/descriptions/src/index.vue b/packages/components/descriptions/src/index.vue
index c6045dab38..ba538c9632 100644
--- a/packages/components/descriptions/src/index.vue
+++ b/packages/components/descriptions/src/index.vue
@@ -1,5 +1,5 @@
-