From 49e2d25d6d1b9e0996c70a5452535482357bb8b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?0o=E5=BC=A0=E4=B8=8D=E6=AD=AAo0?= Date: Mon, 18 Jul 2022 15:41:02 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=80(component):=20input=20select=20cas?= =?UTF-8?q?cader=20datepicker=E5=8A=A0=E5=85=A5size=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/component/cascader/index.vue | 5 ++- .../src/component/datePicker/index.vue | 5 +++ .../component/src/component/input/index.less | 30 +++++++++++++ .../component/src/component/input/index.vue | 4 +- .../component/src/component/select/index.less | 45 ++++++++++++++++++- .../component/src/component/select/index.vue | 3 ++ .../src/document/zh-CN/components/cascader.md | 1 + .../document/zh-CN/components/datePicker.md | 2 +- .../src/document/zh-CN/components/input.md | 20 +++++++++ .../src/document/zh-CN/components/select.md | 1 + 10 files changed, 111 insertions(+), 5 deletions(-) diff --git a/package/component/src/component/cascader/index.vue b/package/component/src/component/cascader/index.vue index c4c4f42f..507baf0a 100644 --- a/package/component/src/component/cascader/index.vue +++ b/package/component/src/component/cascader/index.vue @@ -14,6 +14,7 @@ v-if="!slots.default" :allow-clear="allowClear" @clear="onClear" + :size="size" > @@ -74,6 +75,7 @@ export interface LayCascaderProps { onlyLastLevel?: boolean; replaceFields?: { label: string; value: string; children: string }; allowClear?: boolean; + size?: "lg" | "md" | "sm" | "xs"; } const props = withDefaults(defineProps(), { options: null, @@ -82,6 +84,7 @@ const props = withDefaults(defineProps(), { placeholder: "", onlyLastLevel: false, allowClear: false, + size:'md', replaceFields: () => { return { label: "label", @@ -250,7 +253,7 @@ const selectBar = (item: any, selectIndex: number, parentIndex: number) => { } }; -const displayValue = ref(null); +const displayValue = ref(''); const slots = useSlots(); const dropdownRef = ref(); const dropDownDisabled = ref(false); diff --git a/package/component/src/component/datePicker/index.vue b/package/component/src/component/datePicker/index.vue index 314a0b29..f2c80854 100644 --- a/package/component/src/component/datePicker/index.vue +++ b/package/component/src/component/datePicker/index.vue @@ -15,6 +15,7 @@ v-if="!range" @change="onChange" :allow-clear="!disabled && allowClear" + :size="size" @clear=" dateValue = ''; onChange(); @@ -29,6 +30,7 @@ :disabled="disabled" @change="onChange" class="start-input" + :size="size" > {{ rangeSeparator }} @@ -40,6 +42,7 @@ :disabled="disabled" @change="onChange" class="end-input" + :size="size" @clear=" dateValue = []; onChange(); @@ -130,6 +133,7 @@ export interface LayDatePickerProps { rangeSeparator?: string; readonly?: boolean; allowClear?: boolean; + size?: "lg" | "md" | "sm" | "xs"; } const props = withDefaults(defineProps(), { @@ -141,6 +145,7 @@ const props = withDefaults(defineProps(), { rangeSeparator: "至", readonly: false, allowClear: true, + size:'md', }); const dropdownRef = ref(null); diff --git a/package/component/src/component/input/index.less b/package/component/src/component/input/index.less index 1bfe4d1d..7a205211 100644 --- a/package/component/src/component/input/index.less +++ b/package/component/src/component/input/index.less @@ -3,6 +3,21 @@ --input-border-color: var(--global-neutral-color-3); } +@lg: 44px; +@md: 38px; +@sm: 32px; +@xs: 26px; + +.set-size(@size) { + & { + height: @size; + .layui-input { + height: @size; + line-height: @size; + } + } +} + .layui-input { width: 100%; @@ -82,3 +97,18 @@ .layui-input input::-webkit-input-placeholder { line-height: 1.3; } + +.layui-input{ + &[size="lg"] { + .set-size(@lg); + } + &[size="md"] { + .set-size(@md); + } + &[size="sm"] { + .set-size(@sm); + } + &[size="xs"] { + .set-size(@xs); + } +} \ No newline at end of file diff --git a/package/component/src/component/input/index.vue b/package/component/src/component/input/index.vue index 8133d562..61b269df 100644 --- a/package/component/src/component/input/index.vue +++ b/package/component/src/component/input/index.vue @@ -23,6 +23,7 @@ export interface LayInputProps { disabled?: boolean; readonly?: boolean; password?: boolean; + size?: "lg" | "md" | "sm" | "xs"; } const props = withDefaults(defineProps(), { @@ -32,6 +33,7 @@ const props = withDefaults(defineProps(), { autofocus: false, password: false, modelValue: "", + size:'md', }); interface InputEmits { @@ -115,7 +117,7 @@ const showPassword = () => { + + + +::: + ::: title Input 属性 ::: @@ -261,6 +280,7 @@ export default { | prefix-icon | 前置图标 | -- | | suffix-icon | 后置图标 | -- | | password | 开启密码显示隐藏 | `true` `false`| +| size | 尺寸 | `lg` `md` `sm` `xs`,默认`md`| ::: diff --git a/package/document-component/src/document/zh-CN/components/select.md b/package/document-component/src/document/zh-CN/components/select.md index 4d9806bb..c8c5e546 100644 --- a/package/document-component/src/document/zh-CN/components/select.md +++ b/package/document-component/src/document/zh-CN/components/select.md @@ -310,6 +310,7 @@ export default { | showEmpty | 是否增加空提示选项 | `boolean` | `true` `false` | `true` | | multiple | 是否为多选 | `boolean` | `true` `false` | `false` | | create | 是否允许创建 | `boolean` | `true` `false` | `false` | +| size | 尺寸 | `string` | `lg` `md` `sm` `xs`| `md` | :::