mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-02 19:28:14 +08:00
docs(components): [input-number] (#11063)
* Update form docs with new syntax.
This commit is contained in:
parent
9de0a15b9a
commit
06126ea571
@ -79,38 +79,41 @@ input-number/controlled
|
||||
|
||||
:::
|
||||
|
||||
## Attributes
|
||||
## API
|
||||
|
||||
| Name | Description | Type | Accepted Values | Default |
|
||||
| ----------------------------- | ------------------------------------------------ | ---------------------- | ----------------------- | ----------- |
|
||||
| model-value / v-model | binding value | number / undefined | — | — |
|
||||
| min | the minimum allowed value | number | — | `-Infinity` |
|
||||
| max | the maximum allowed value | number | — | `Infinity` |
|
||||
| step | incremental step | number | — | 1 |
|
||||
| step-strictly | whether input value can only be multiple of step | boolean | — | false |
|
||||
| precision | precision of input value | number | — | — |
|
||||
| size | size of the component | string | large / default / small | default |
|
||||
| readonly | same as `readonly` in native input | boolean | — | false |
|
||||
| disabled | whether the component is disabled | boolean | — | false |
|
||||
| controls | whether to enable the control buttons | boolean | — | true |
|
||||
| controls-position | position of the control buttons | string | right | - |
|
||||
| name | same as `name` in native input | string | — | — |
|
||||
| label | label text | string | — | — |
|
||||
| placeholder | placeholder in input | string | - | - |
|
||||
| value-on-clear **(\> 2.2.0)** | value should be set when input box is cleared | string / number / null | min / max | - |
|
||||
| validate-event | whether to trigger form validation | boolean | - | true |
|
||||
### Attributes
|
||||
|
||||
## Events
|
||||
| Name | Description | Type | Default |
|
||||
| -------------------------------------------- | ------------------------------------------------ | --------------------------------------------- | --------- |
|
||||
| model-value / v-model | binding value | ^[number] | — |
|
||||
| min | the minimum allowed value | ^[number] | -Infinity |
|
||||
| max | the maximum allowed value | ^[number] | Infinity |
|
||||
| step | incremental step | ^[number] | 1 |
|
||||
| step-strictly | whether input value can only be multiple of step | ^[boolean] | false |
|
||||
| precision | precision of input value | ^[number] | — |
|
||||
| size | size of the component | ^[enum]`'large' \| 'default' \| 'small'` | default |
|
||||
| readonly | same as `readonly` in native input | ^[boolean] | false |
|
||||
| disabled | whether the component is disabled | ^[boolean] | false |
|
||||
| controls | whether to enable the control buttons | ^[boolean] | true |
|
||||
| controls-position | position of the control buttons | ^[enum]`'' \| 'right'` | — |
|
||||
| name | same as `name` in native input | ^[string] | — |
|
||||
| label | same as `label` in native input | ^[string] | — |
|
||||
| placeholder | same as `placeholder` in native input | ^[string] | — |
|
||||
| id | same as `id` in native input | ^[string] | — |
|
||||
| value-on-clear<VersionTag version="2.2.0" /> | value should be set when input box is cleared | ^[number] / ^[null] / ^[enum]`'min' \| 'max'` | — |
|
||||
| validate-event | whether to trigger form validation | ^[boolean] | true |
|
||||
|
||||
| Name | Description | Parameters |
|
||||
| ------ | ------------------------------- | ------------------------------------------------------ |
|
||||
| change | triggers when the value changes | (currentValue: number \| NaN, oldValue: number \| NaN) |
|
||||
| blur | triggers when Input blurs | (event: FocusEvent) |
|
||||
| focus | triggers when Input focuses | (event: FocusEvent) |
|
||||
### Events
|
||||
|
||||
## Methods
|
||||
| Name | Description | Type |
|
||||
| ------ | ------------------------------- | --------------------------------------------------------------------------------------- |
|
||||
| change | triggers when the value changes | ^[Function]`(currentValue: number \| undefined, oldValue: number \| undefined) => void` |
|
||||
| blur | triggers when Input blurs | ^[Function]`(event: FocusEvent) => void` |
|
||||
| focus | triggers when Input focuses | ^[Function]`(event: FocusEvent) => void` |
|
||||
|
||||
| Method | Description | Parameters |
|
||||
| ------ | -------------------------------- | ---------- |
|
||||
| focus | get focus the input component | - |
|
||||
| blur | remove focus the input component | — |
|
||||
### Exposes
|
||||
|
||||
| Name | Description | Type |
|
||||
| ----- | -------------------------------- | ----------------------- |
|
||||
| focus | get focus the input component | ^[Function]`() => void` |
|
||||
| blur | remove focus the input component | ^[Function]`() => void` |
|
||||
|
@ -10,50 +10,101 @@ import type { ExtractPropTypes } from 'vue'
|
||||
import type InputNumber from './input-number.vue'
|
||||
|
||||
export const inputNumberProps = buildProps({
|
||||
/**
|
||||
* @description same as `id` in native input
|
||||
*/
|
||||
id: {
|
||||
type: String,
|
||||
default: undefined,
|
||||
},
|
||||
/**
|
||||
* @description incremental step
|
||||
*/
|
||||
step: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
/**
|
||||
* @description whether input value can only be multiple of step
|
||||
*/
|
||||
stepStrictly: Boolean,
|
||||
/**
|
||||
* @description the maximum allowed value
|
||||
*/
|
||||
max: {
|
||||
type: Number,
|
||||
default: Number.POSITIVE_INFINITY,
|
||||
},
|
||||
/**
|
||||
* @description the minimum allowed value
|
||||
*/
|
||||
min: {
|
||||
type: Number,
|
||||
default: Number.NEGATIVE_INFINITY,
|
||||
},
|
||||
/**
|
||||
* @description binding value
|
||||
*/
|
||||
modelValue: Number,
|
||||
/**
|
||||
* @description same as `readonly` in native input
|
||||
*/
|
||||
readonly: Boolean,
|
||||
/**
|
||||
* @description whether the component is disabled
|
||||
*/
|
||||
disabled: Boolean,
|
||||
/**
|
||||
* @description size of the component
|
||||
*/
|
||||
size: useSizeProp,
|
||||
/**
|
||||
* @description whether to enable the control buttons
|
||||
*/
|
||||
controls: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
/**
|
||||
* @description position of the control buttons
|
||||
*/
|
||||
controlsPosition: {
|
||||
type: String,
|
||||
default: '',
|
||||
values: ['', 'right'],
|
||||
},
|
||||
/**
|
||||
* @description value should be set when input box is cleared
|
||||
*/
|
||||
valueOnClear: {
|
||||
type: [String, Number, null],
|
||||
validator: (val: 'min' | 'max' | number | null) =>
|
||||
val === null || isNumber(val) || ['min', 'max'].includes(val),
|
||||
default: null,
|
||||
},
|
||||
/**
|
||||
* @description same as `name` in native input
|
||||
*/
|
||||
name: String,
|
||||
/**
|
||||
* @description same as `label` in native input
|
||||
*/
|
||||
label: String,
|
||||
/**
|
||||
* @description same as `placeholder` in native input
|
||||
*/
|
||||
placeholder: String,
|
||||
/**
|
||||
* @description precision of input value
|
||||
*/
|
||||
precision: {
|
||||
type: Number,
|
||||
validator: (val: number) =>
|
||||
val >= 0 && val === Number.parseInt(`${val}`, 10),
|
||||
},
|
||||
/**
|
||||
* @description whether to trigger form validation
|
||||
*/
|
||||
validateEvent: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
|
Loading…
Reference in New Issue
Block a user