diff --git a/package/component/src/component/space/index.vue b/package/component/src/component/space/index.vue index 7dca0373..22c19472 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 3e14baaa..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,15 +13,13 @@ ::: demo 标签的基本用法。 + ::: @@ -93,22 +94,32 @@ ::: demo 通过 closable 属性控制标签是否可关闭 + ::: @@ -118,50 +129,36 @@ ::: demo 标签颜色, 非内置颜色只支持默认样式, plain 默认有边框。 + ::: ::: title 图标插槽 ::: -::: demo 标签的基本用法。 +::: demo 通过插槽自定义图标。 + ::: @@ -324,7 +343,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`|