Numeric Input
WdInputNumber
Applicable Scenarios
For numeric content input.
Example
Interactive Preview
Component Decoration
Component Size
Component Alignment
Component Input State
Component Style API Example
#wd-page-root .wd-form-item .wd-input-number-input-number {
border-color: cyan;
color: cyan;
background-color: black;
border-width: 2px;
border-radius: 6px;
}
#wd-page-root .wd-form-item .wd-input-number-btn {
border-color: cyan;
color: cyan;
background-color: black;
border-width: 2px;
border-radius: 6px;
}`
Properties
External properties received by the component
Property Name | Property Identifier | Type | Description |
|---|
| Display Headlines | labelVisible | boolean | Default value: true |
| Title alignment | labelAlign | string | In the scenario, the form by default follows the title alignment configuration of the form container. |
| Line break in heading | labelWrap | boolean | If the title content is too long when closed, show one line with overflow omitted; when enabled, show with line breaks. In form scenarios, it follows the form container's title line break configuration by default. |
| Title position | layout | string | Set title display position in form component. In the scenario, it follows the title position configuration of the form container by default. |
| Title width | labelWidth | string | In the scenario, the form follows the title width configuration of the form container by default. |
| Heading Note | labelTips | string | Configure tooltip content for the heading |
| Data format | format | string | Provide two data formats: numeric value and percentage. Default value: "number" |
| number of decimal places | decimals | number | Number of decimal places retained, only allow 0 and positive integer, default not limited |
| Display thousand separator | thousandShow | boolean | When enabled, separate every three digits of an integer with a comma. |
| Adjust step size | step | number | Control the value to add/decrease with each click of the adjust button Example: 1 |
| Display clear button | clearable | boolean | Enabled, quick clear button is provided by Default value: true Example: false |
| Prefix text | before | string | The input box in the form displays the prefix text. |
| suffix text | after | string | Display suffix text in the form input box |
| Prefix icon type | prefixType | string | Select icon type Example: "" |
| Prefix icon | prefixIcon | string | Show icon before the form input box Example: "success" |
| Prefix icon | prefixSrc | string | Set custom icon address |
| suffix icon type | suffixType | string | Select icon type Example: "" |
| suffix icon | suffixIcon | string | Show icon in the form input box Example: "success" |
| suffix icon | suffixSrc | string | Set custom icon address |
| Prompt. | extra | string | The prompt content is displayed below the input box after configuration. |
| automatically obtain focus | focus | boolean | After enabled, the cursor automatically positions to the input box when page loading completes. |
| Display underscore on mobile terminal | borderedH5 | boolean | After closing, the mobile terminal does not show the bottom underline Default value: true |
| Display input border on PC | borderedPc | boolean | After closing, do not display input border on PC Default value: true |
| Minimum value | min | number | Limit the minimum value of the entered number. Default not limited. |
| Maximum value | max | number | Limit the maximum value of the entered number. Default not limited. |
| Status. | status | string | Example: "edit" |
| Required | required | boolean | |
| Required validation note | requiredMsg | string | Example: "该项为必填项" |
| Required identifier | requiredFlag | boolean | Enabled, the component will display a required asterisk tag if mandatory. Default value: true |
| Bound field | name | string | The Key value of a form field is used to match the field identifier of the data model when submitting data. It must be unique within the form. Example: "" |
| input value | inputValue | number | The initialization value is converted based on size limit, number of decimal places, and data format. |
| Placeholder text | placeholder | string | Example: "请输入" |
| Numeric value adjustment method | stepOption | string | Provide two style modes: bilateral adjustment (both) and right adjustment (right), for adjusting numeric value by step size. Default value: "right" |
| PC component dimension | size | string | Size configuration is only applicable to PC and takes effect by default in form container scenarios. |
| Title content. | label | string | Example: "标题" |
Events
Events exposed by the component. You can listen to component events to trigger external actions
Event Name | Event Code | Event Output Parameters event.detail | Applicable Scenarios | Description |
|---|
| value change | change | object
| Compatible with all platforms | When the user modifies the value, the component triggers upon losing focus, and the final value is obtained after calculation. |
| user input | input | object
| Compatible with all platforms | Trigger on user input value, the calculated value is obtained |
| focus | focus | object
| Compatible with all platforms | - |
| Out of focus | blur | object
| Compatible with all platforms | - |
| Purge content | clear | object
| Compatible with all platforms | - |
Property API
Through the Property API, you can access the internal state and property values of components. You can access internal values using$w.componentId.propertyName, such as $w.input1.value. For details, please refer to Property API
Read-only Property Name | Property Identifier | Type | Description |
|---|
| Bound field | name | string | The Key value of a form field is used to match the field identifier of the data model when submitting data. It must be unique within the form. |
| Title content. | label | string | |
| Data format | format | string | Provide two data formats: numeric value and percentage. |
| Prefix text | before | string | The input box in the form displays the prefix text. In the form submission scenario, the prefix text is submitted as part of the form content to the data model. |
| suffix text | after | string | The input box in the form displays suffix text. In the scenario of form submission, the suffix text is submitted as form content to the data model together. |
| Adjust step size | step | number | Control the value to add/decrease with each click of the adjust button |
| Required | required | boolean | |
| Minimum value | min | number | Limit the minimum value of the entered number. Default not limited. |
| Maximum value | max | number | Limit the maximum value of the entered number. Default not limited. |
| input value | value | number | |
| Indicates whether to display | visible | boolean | Whether to display the component |
| Whether to disable | disabled | boolean | Component Disabled |
| Specify whether it is read-only or not. | readOnly | boolean | Whether the component is read-only |
Method API
Through the Method API, you can programmatically trigger internal methods of components, such as submitting forms, displaying popups, etc. You can call component methods using $w.componentId.methodName, such as $w.form1.submit()
Method Name | Method Identifier | Parameters | Method Description |
|---|
| set value | setValue | number值 | Set the component value with $w.id1.setValue(123) |
| Show/Hide Settings | setVisible | boolean显示 | Set the component to hidden via $w.id1.setVisible(false) |
| Set Disabled | setDisabled | boolean禁用 | Set the component to disabled with $w.id1.setDisabled(true) |
| Clear value | clearValue | Clear the component value with $w.id1.clearValue() | |
| Set as read-only | setReadOnly | boolean只读 | Set the component to read-only via $w.id1.setReadOnly(true) |
| Trigger validation | handleValidate | Validate the component value via $w.id1.handleValidate() | |
| Clear verification | clearValidate | Clear component validation via $w.id1.clearValidate() |
Style API
Through the Style API, you can override the styles of internal elements in components to achieve customization. For example, in the low-code editor, you can write styles for all button components using #wd-page-root .wd-btn, and control individual component styles with :scope. For detailed instructions, please refer toStyle API
Name | Class Name | Description and Examples |
|---|
| root element | .wd-input-number-root | Outermost component element |
| H5 root element | .wd-h5-input-number-root | Settable root element style for the H5 side |
| PC-side root element | .wd-pc-input-number-root | Settable root element style for the PC side |
| Mini program root element | .wd-mp-input-number-root | Settable root element style for mini program |
| Component title style | .wd-input-number-root .wd-form-item-wrap__label | Component title element |
| form control root node style | .wd-input-number-root .wd-form-item-wrap__control | Set form control root element style |
| Input box style - editing status | .wd-input-number-root .wd-form-input-wrap | Component border, margin style, background color, font size, font color |
| Editing status - Input box style (gain focus) | .wd-input-number-root .wd-form-input-wrap.is-focused | Editing status - Input box style (gain focus) |
| Editing status - Placeholder text style | .wd-input-number-root input::placeholder, .wd-input-number-root .weui-input__placeholder | Set placeholder text style |
| Editing status - Verification information | .wd-input-number-root .wd-g-text-error | Set component verification information style |
| prompt text | .wd-input-number-root .wd-form-item__help-text | Set the text style of the component prompt |
| Disabled state - Input box style | .wd-input-number-root .wd-form-input-wrap.is-disabled | Component disabled style |
| read-only status - form value style | .wd-input-number-root .wd-form-item__readonly-value | Set component read-only status |
| Prefix text style | .wd-input-number-root .wd-form-input-group__addon-left | Set component prefix text style |
| Suffix text style | .wd-input-number-root .wd-form-input-group__addon-right | Set component suffix text style |
| Number input with minus button on the left | .wd-input-number-btn__before | Number input with minus button on the left |
| Number input with button on the right | .wd-input-number-btn__after | Number input with button on the right |
| Number input with number on the right and button | .wd-input-number__increase | Number input with number on the right and button |
| Decrease button for the number on the right | .wd-input-number__decrease | Decrease button for the number on the right |