From 548552d798a3e2485bbd3afad99f551469838e2a Mon Sep 17 00:00:00 2001 From: 07akioni <07akioni2@gmail.com> Date: Sun, 19 Sep 2021 00:47:15 +0800 Subject: [PATCH] refactor(description): clean code --- src/descriptions/demos/enUS/index.demo-entry.md | 8 +++----- src/descriptions/demos/zhCN/index.demo-entry.md | 8 +++----- src/descriptions/src/Descriptions.tsx | 10 ++-------- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/descriptions/demos/enUS/index.demo-entry.md b/src/descriptions/demos/enUS/index.demo-entry.md index d956676f9..607825311 100644 --- a/src/descriptions/demos/enUS/index.demo-entry.md +++ b/src/descriptions/demos/enUS/index.demo-entry.md @@ -15,7 +15,7 @@ bordered size ``` -## Props +## API ### Descriptions Props @@ -30,7 +30,7 @@ size | size | `'small' \| 'medium' \| 'large'` | `'medium'` | Size of the description. | | title | `string` | `undefined` | Title of the description. | -### Description Item Props +### DescriptionItem Props | Name | Type | Default | Description | | --- | --- | --- | --- | @@ -39,8 +39,6 @@ size | label-style | `Object \| string` | `undefined` | Style of the item label. | | span | `number` | `1` | Column span of the item. | -## Slots - ### Descriptions Slots | Name | Parameters | Description | @@ -48,7 +46,7 @@ size | default | `()` | Content. | | header | `()` | Header content. | -### Description Item Slots +### DescriptionItem Slots | Name | Parameters | Description | | ------- | ---------- | ------------- | diff --git a/src/descriptions/demos/zhCN/index.demo-entry.md b/src/descriptions/demos/zhCN/index.demo-entry.md index 120ac011d..4d3d3c134 100644 --- a/src/descriptions/demos/zhCN/index.demo-entry.md +++ b/src/descriptions/demos/zhCN/index.demo-entry.md @@ -15,7 +15,7 @@ bordered size ``` -## Props +## API ### Descriptions Props @@ -30,7 +30,7 @@ size | size | `'small' \| 'medium' \| 'large'` | `'medium'` | 尺寸 | | title | `string` | `undefined` | 标题 | -### Description Item Props +### DescriptionItem Props | 名称 | 类型 | 默认值 | 说明 | | ------------- | ------------------ | ----------- | --------------- | @@ -39,8 +39,6 @@ size | label-style | `Object \| string` | `undefined` | label 的样式 | | span | `number` | `1` | 所占的单元格数 | -## Slots - ### Descriptions Slots | 名称 | 参数 | 说明 | @@ -48,7 +46,7 @@ size | default | `()` | 描述的内容 | | header | `()` | header 内容 | -### Description Item Slots +### DescriptionItem Slots | 名称 | 参数 | 说明 | | ------- | ---- | ------------------- | diff --git a/src/descriptions/src/Descriptions.tsx b/src/descriptions/src/Descriptions.tsx index d02d63126..d74e47fb3 100644 --- a/src/descriptions/src/Descriptions.tsx +++ b/src/descriptions/src/Descriptions.tsx @@ -29,10 +29,7 @@ const descriptionProps = { type: Number, default: 3 }, - columns: { - type: Number, - default: undefined - }, + columns: Number, labelPlacement: { type: String as PropType<'left' | 'top'>, default: 'top' @@ -45,10 +42,7 @@ const descriptionProps = { type: String as PropType<'small' | 'medium' | 'large'>, default: 'medium' }, - bordered: { - type: Boolean, - default: false - }, + bordered: Boolean, labelStyle: [Object, String] as PropType, contentStyle: [Object, String] as PropType } as const