types(field): add FieldEnterKeyHint type and update enterkeyhint prop type in Field component (#13692)
Some checks failed
CodeQL / Analyze (javascript) (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled
Issue Close Require / issue-close-require (push) Has been cancelled

This commit is contained in:
edison
2025-11-19 15:30:14 +08:00
committed by GitHub
parent e5d6ba0277
commit 49bb169f6b
5 changed files with 14 additions and 3 deletions

View File

@@ -70,6 +70,7 @@ import type {
FieldValidationStatus,
FieldValidateTrigger,
FieldFormSharedProps,
FieldEnterKeyHint,
} from './types';
const [name, bem] = createNamespace('field');
@@ -94,7 +95,7 @@ export const fieldSharedProps = {
autocapitalize: String,
autocorrect: String,
errorMessage: String,
enterkeyhint: String,
enterkeyhint: String as PropType<FieldEnterKeyHint>,
clearTrigger: makeStringProp<FieldClearTrigger>('focus'),
formatTrigger: makeStringProp<FieldFormatTrigger>('onChange'),
spellcheck: {

View File

@@ -352,7 +352,7 @@ Use `label-align` prop to align the input value, can be set to `center`, `right`
| rules | Form validation rules | _FieldRule[]_ | - |
| autocomplete | HTML native attribute, see [MDN - autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | _string_ | - |
| autocapitalize `v4.6.2` | HTML native attribute, see [MDN - autocapitalize](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize)<br> | _string_ | - |
| enterkeyhint | HTML native attribute, see [MDN - enterkeyhint](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)<br> | _string_ | - |
| enterkeyhint | HTML native attribute, see [MDN - enterkeyhint](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)<br> | _FieldEnterKeyHint_ | - |
| spellcheck `v4.6.2` | HTML native attribute, see [MDN - spellcheck](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck)<br> | _boolean_ | - |
| autocorrect `v4.6.2` | HTML native attribute, Safari only, see [MDN - autocorrect](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#autocorrect)<br> | _string_ | - |
| inputmode `v4.9.9` | HTML native attribute, see [MDN - inputmode](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode) | _string_ | Set automatically according to the `type` prop |

View File

@@ -381,7 +381,7 @@ export default {
| rules | 表单校验规则,详见 [Form 组件](#/zh-CN/form#rule-shu-ju-jie-gou) | _FieldRule[]_ | - |
| autocomplete | HTML 原生属性,用于控制自动完成功能,详见 [MDN - autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | _string_ | - |
| autocapitalize `v4.6.2` | HTML 原生属性,用于控制文本输入时是否自动大写,此 API 仅在部分浏览器支持,详见 [MDN - autocapitalize](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize) | _string_ | - |
| enterkeyhint | HTML 原生属性,用于控制回车键样式,此 API 仅在部分浏览器支持,详见 [MDN - enterkeyhint](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)<br> | _string_ | - |
| enterkeyhint | HTML 原生属性,用于控制回车键样式,此 API 仅在部分浏览器支持,详见 [MDN - enterkeyhint](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/enterkeyhint)<br> | _FieldEnterKeyHint_ | - |
| spellcheck `v4.6.2` | HTML 原生属性,用于检查元素的拼写错误,此 API 仅在部分浏览器支持,详见 [MDN - spellcheck](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/spellcheck)<br> | _boolean_ | - |
| autocorrect `v4.6.2` | HTML 原生属性,仅 Safari 适用,用于自动更正输入的文本,详见 [MDN - autocorrect](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#autocorrect)<br> | _string_ | - |
| inputmode `v4.9.9` | HTML 原生属性,用于指定输入框的输入模式,详见 [MDN - inputmode](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/inputmode) | _string_ | 根据 `type` 属性自动设置 |

View File

@@ -20,6 +20,7 @@ export type {
FieldAutosizeConfig,
FieldValidateTrigger,
FieldValidationStatus,
FieldEnterKeyHint,
} from './types';
declare module 'vue' {

View File

@@ -36,6 +36,15 @@ export type FieldFormatTrigger = 'onBlur' | 'onChange';
export type FieldValidateTrigger = 'onBlur' | 'onChange' | 'onSubmit';
export type FieldEnterKeyHint =
| 'search'
| 'done'
| 'enter'
| 'go'
| 'next'
| 'previous'
| 'send';
export type FieldAutosizeConfig = {
maxHeight?: number;
minHeight?: number;