From 11e9087a5824c854587738afe05f3cb8fe9eff6d Mon Sep 17 00:00:00 2001
From: sight <1453017105@qq.com>
Date: Thu, 11 Aug 2022 17:47:04 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=93=9D:=20[tag]:=20=E6=9B=B4=E6=96=B0?=
=?UTF-8?q?=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/document/zh-CN/components/tag.md | 131 ++++++++++++------
1 file changed, 86 insertions(+), 45 deletions(-)
diff --git a/package/document-component/src/document/zh-CN/components/tag.md b/package/document-component/src/document/zh-CN/components/tag.md
index 3e14baaa..ccdcecb9 100644
--- a/package/document-component/src/document/zh-CN/components/tag.md
+++ b/package/document-component/src/document/zh-CN/components/tag.md
@@ -13,19 +13,27 @@
::: demo 标签的基本用法。
+
tag
-   
tag
-   
tag
-   
tag
-   
超过设置长度省略文本
+
+
:::
@@ -35,55 +43,56 @@
::: demo 通过 size 属性控制标签尺寸。
+
default
-   
tag lg
-   
tag md
-   
tag sm
-   
tag xs
-
+
+
default
-   
tag lg
-   
tag md
-   
tag sm
-   
tag xs
-
+
+
default
-   
tag lg
-   
tag md
-   
tag sm
-   
tag xs
-   
+
+
:::
@@ -93,22 +102,32 @@
::: demo 通过 closable 属性控制标签是否可关闭
+
Tag
-   
Tag 2
-   
自定义关闭图标
+
+
:::
@@ -118,50 +137,50 @@
::: demo 标签颜色, 非内置颜色只支持默认样式, plain 默认有边框。
- default:
+ default:
+
Tag
-   
-     
+
+
Tag
-   
-
-
light:
+
+ light:
+
Tag
-   
-     
+
+
Tag
-   
-
-
plain:
+
+ plain:
+
Tag
-   
-     
+
+
Tag
-   
-
-
custom:
+
+ custom:
+
Tag
-   
-     
+
+
Tag
-   
-
+
+
:::
@@ -203,31 +235,40 @@ const COLORS = [
::: demo 标签的基本用法。
+
tag
-   
tag
-   
tag
-   
+
+
:::
@@ -324,7 +365,7 @@ export default {
| 属性 | 描述 | 类型 | 默认值 | 可选值 |
| ----------- | -------- | ------ | ------ | ------ |
| size | 标签大小 | string | md | `lg` `md` `sm` `xs`|
-| color | 标签颜色 | string | `green`| `red` `orange` `green` `cyan` `blue` `black` `gray` `string` |
+| color | 标签颜色 | string | `#EEE`| `red` `orange` `green` `cyan` `blue` `black` `gray` `string` |
| bordered | 是否显示边框 | boolean | false | `true` `false`|
| closable | 是否可关闭 | boolean | false | `true` `false`|
| variant | 标签风格 | string | `default` | `default` `light` `plain`|
From 863a627ef2d117b96f9e37c403bf402ba036adb6 Mon Sep 17 00:00:00 2001
From: sight <1453017105@qq.com>
Date: Sat, 27 Aug 2022 15:22:47 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9D(component):=20[tag]=E6=9B=B4?=
=?UTF-8?q?=E6=96=B0=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
tag: 更新文档
space 垂直方向对齐方式修改为 start
---
.../component/src/component/space/index.vue | 7 +-
.../component/src/component/tag/index.less | 2 +-
package/component/src/index.ts | 3 +
.../src/document/zh-CN/components/tag.md | 148 ++++++++----------
4 files changed, 72 insertions(+), 88 deletions(-)
diff --git a/package/component/src/component/space/index.vue b/package/component/src/component/space/index.vue
index 7dca0373..1604b2f9 100644
--- a/package/component/src/component/space/index.vue
+++ b/package/component/src/component/space/index.vue
@@ -35,13 +35,16 @@ export interface LaySpaceProps {
}
const props = withDefaults(defineProps(), {
- align: "center",
direction: "horizontal",
size: "sm",
});
const slots = useSlots();
+const computAlign = computed(
+ () => props.align ?? (props.direction === 'horizontal' ? 'center' : '')
+);
+
const extractChildren = () => {
const result: VNode[] = [];
const children = slots.default && (slots?.default() as VNodeArrayChildren);
@@ -73,7 +76,7 @@ const extractChildren = () => {
const spaceClass = computed(() => [
"layui-space",
{
- [`layui-space-align-${props.align}`]: props.align,
+ [`layui-space-align-${props.align}`]: computAlign.value,
[`layui-space-${props.direction}`]: props.direction,
[`layui-space-wrap`]: props.wrap,
[`layui-space-fill`]: props.fill,
diff --git a/package/component/src/component/tag/index.less b/package/component/src/component/tag/index.less
index a55fccab..01e505ea 100644
--- a/package/component/src/component/tag/index.less
+++ b/package/component/src/component/tag/index.less
@@ -23,7 +23,7 @@
.layui-tag {
display: inline-flex;
- align-items: center;
+ align-items: baseline;
vertical-align: middle;
box-sizing: border-box;
height: @tag-size-md;
diff --git a/package/component/src/index.ts b/package/component/src/index.ts
index e482667b..484d079d 100644
--- a/package/component/src/index.ts
+++ b/package/component/src/index.ts
@@ -89,6 +89,7 @@ import LayPageHeader from "./component/pageHeader/index";
import LayCascader from "./component/cascader/index";
import LayAffix from "./component/affix/index";
import LaySpace from "./component/space/index";
+import LayTag from "./component/tag/index";
import LayConfigProvider from "./provider";
import { InstallOptions } from "./types";
@@ -176,6 +177,7 @@ const components: Record = {
LayCascader,
LayAffix,
LaySpace,
+ LayTag,
};
const install = (app: App, options?: InstallOptions): void => {
@@ -270,6 +272,7 @@ export {
LayCascader,
LayAffix,
LaySpace,
+ LayTag,
install,
};
diff --git a/package/document-component/src/document/zh-CN/components/tag.md b/package/document-component/src/document/zh-CN/components/tag.md
index ccdcecb9..0f6f2a2f 100644
--- a/package/document-component/src/document/zh-CN/components/tag.md
+++ b/package/document-component/src/document/zh-CN/components/tag.md
@@ -13,27 +13,17 @@
::: demo 标签的基本用法。
-
- tag
- tag
- tag
- tag
+
+ 标签
+ 标签
+ 标签
+ 标签
超过设置长度省略文本
-
+
-
:::
@@ -43,42 +33,44 @@
::: demo 通过 size 属性控制标签尺寸。
-
- default
+
+
+ lg:
tag lg
- tag md
- tag sm
- tag xs
-
-
- default
tag lg
- tag md
- tag sm
- tag xs
-
-
-
-
- default
-
-
+
tag lg
-
+
+
+ md:
+ tag md
+ tag md
+
tag md
+
+
+ sm:
+ tag sm
+ tag sm
tag sm
+
+
+ xs:
+ tag xs
+ tag xs
tag xs
-
+
+