Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(input): fix status default value #3307

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/input/input.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/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/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/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/blob/develop/src/common.ts) | N
Expand Down
2 changes: 1 addition & 1 deletion src/input/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/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/blob/develop/src/common.ts) | N
suffixIcon | Slot / Function | - | 组件后置图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
tips | String / Slot / Function | - | 输入框下方提示文本,会根据不同的 `status` 呈现不同的样式。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
Expand Down
5 changes: 3 additions & 2 deletions src/input/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TdInputProps['status']>,
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);
Expand Down Expand Up @@ -124,6 +124,7 @@ export default {
/** 输入框的值 */
value: {
type: [String, Number] as PropType<TdInputProps['value']>,
default: undefined,
},
/** 输入框的值,非受控属性 */
defaultValue: {
Expand Down
3 changes: 2 additions & 1 deletion src/input/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ export interface TdInputProps<T = InputValue> {
*/
spellCheck?: boolean;
/**
* 输入框状态。默认情况会由组件内部根据实际情况呈现,如果文本过长引起的状态变化
* 输入框状态
* @default default
*/
status?: 'default' | 'success' | 'warning' | 'error';
/**
Expand Down
Loading