From f3749479416fe381ce570555388e974501dd4951 Mon Sep 17 00:00:00 2001 From: liweijie0812 <674416404@qq.com> Date: Wed, 4 Sep 2024 17:11:17 +0800 Subject: [PATCH] fix(input): fix status default value (#4530) --- src/input/input.en-US.md | 2 +- src/input/input.md | 4 ++-- src/input/props.ts | 6 +++--- src/input/type.ts | 5 +++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/input/input.en-US.md b/src/input/input.en-US.md index 3f716aee52..cf80a1d646 100644 --- a/src/input/input.en-US.md +++ b/src/input/input.en-US.md @@ -27,7 +27,7 @@ showClearIconOnEmpty | Boolean | false | show clear icon on empty input value | showLimitNumber | Boolean | false | show limit number text on the right | N size | String | medium | make input to be different size。options: small/medium/large。Typescript:`SizeEnum`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N spellCheck | Boolean | false | attribute of input element, [see here](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/spellcheck) | N -status | String | undefined | options: default/success/warning/error | N +status | String | default | options: default/success/warning/error | N suffix | String / Slot / Function | - | suffix content before suffixIcon。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N suffixIcon | Slot / Function | - | suffix icon of input。Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N tips | String / Slot / Function | - | tips on the bottom of input, different `status` can make tips to be different color。Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N diff --git a/src/input/input.md b/src/input/input.md index 08676b0956..c4a9da688e 100644 --- a/src/input/input.md +++ b/src/input/input.md @@ -11,7 +11,7 @@ allowInputOverMax | Boolean | false | 超出 `maxlength` 或 `maxcharacter` 之 autoWidth | Boolean | false | 宽度随内容自适应 | N autocomplete | String | undefined | 是否开启自动填充功能,HTML5 原生属性,[点击查看详情](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | N autofocus | Boolean | false | 自动聚焦 | N -borderless | Boolean | false | 无边框模式 | N +borderless | Boolean | false | 是否开启无边框模式 | N clearable | Boolean | false | 是否可清空 | N disabled | Boolean | undefined | 是否禁用输入框 | N format | Function | - | 指定输入框展示值的格式。注意 `type=number` 时请勿使用,此功能建议更为使用 `InputNumber` 组件。TS 类型:`InputFormatType` `type InputFormatType = (value: string) => string`。[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/input/type.ts) | N @@ -27,7 +27,7 @@ showClearIconOnEmpty | Boolean | false | 输入框内容为空时,悬浮状态 showLimitNumber | Boolean | false | 是否在输入框右侧显示字数统计 | N size | String | medium | 输入框尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N spellCheck | Boolean | false | 是否开启拼写检查,HTML5 原生属性,[点击查看详情](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/spellcheck) | N -status | String | undefined | 输入框状态。默认情况会由组件内部根据实际情况呈现,如果文本过长引起的状态变化。可选项:default/success/warning/error | N +status | String | default | 输入框状态。可选项:default/success/warning/error | N suffix | String / Slot / Function | - | 后置图标前的后置内容。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N suffixIcon | Slot / Function | - | 组件后置图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N tips | String / Slot / Function | - | 输入框下方提示文本,会根据不同的 `status` 呈现不同的样式。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N diff --git a/src/input/props.ts b/src/input/props.ts index 0f5a3c64a5..3e4afcf3ac 100644 --- a/src/input/props.ts +++ b/src/input/props.ts @@ -28,7 +28,7 @@ export default { }, /** 自动聚焦 */ autofocus: Boolean, - /** 无边框模式 */ + /** 是否开启无边框模式 */ borderless: Boolean, /** 是否可清空 */ clearable: Boolean, @@ -91,10 +91,10 @@ export default { }, /** 是否开启拼写检查,HTML5 原生属性,[点击查看详情](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/spellcheck) */ spellCheck: Boolean, - /** 输入框状态。默认情况会由组件内部根据实际情况呈现,如果文本过长引起的状态变化 */ + /** 输入框状态 */ status: { type: String as PropType, - default: undefined as TdInputProps['status'], + default: 'default' as TdInputProps['status'], validator(val: TdInputProps['status']): boolean { if (!val) return true; return ['default', 'success', 'warning', 'error'].includes(val); diff --git a/src/input/type.ts b/src/input/type.ts index 8f1b41c192..ddb758d4bd 100644 --- a/src/input/type.ts +++ b/src/input/type.ts @@ -32,7 +32,7 @@ export interface TdInputProps { */ autofocus?: boolean; /** - * 无边框模式 + * 是否开启无边框模式 * @default false */ borderless?: boolean; @@ -103,7 +103,8 @@ export interface TdInputProps { */ spellCheck?: boolean; /** - * 输入框状态。默认情况会由组件内部根据实际情况呈现,如果文本过长引起的状态变化 + * 输入框状态 + * @default default */ status?: 'default' | 'success' | 'warning' | 'error'; /**