# input
Start from base library version 1.0.0. Please remaining backward compatible.
Input box. This component is[Native component]((Note the limitations when using the native-component)
attribute | type | Default value | Required | Introductions | Minimum version |
---|---|---|---|---|---|
value | string | yes | The initial content of the input box | 1.0.0 | |
type | string | text | no | input Type | 1.0.0 |
password | boolean | false | no | Is it a password type? | 1.0.0 |
placeholder | string | yes | Placeholder when input box is empty | 1.0.0 | |
placeholder-style | string | yes | Designation placeholder Style | 1.0.0 | |
placeholder-class | string | input-placeholder | no | Designation placeholder Style class | 1.0.0 |
disabled | boolean | false | no | Is it disabled? | 1.0.0 |
maxlength | number | 140 | no | Maximum input length, set to -1 Does not limit the maximum length | 1.0.0 |
cursor-spacing | number | 0 | no | Specifies the distance between the cursor and the keyboard input The distance from the bottom and cursor-spacing The minimum distance specified as the distance between the cursor and the keyboard | 1.0.0 |
auto-focus | boolean | false | no | (Soon to be abandoned, please use directly focus ) Auto focus, pull up the keyboard | 1.0.0 |
focus | boolean | false | no | Getting focus | 1.0.0 |
confirm-type | string | done | no | Sets the text of the on in the lower right corner of the keyboard, which takes effect only when type = 'text' | 1.1.0 |
always-embed | boolean | false | no | force input In the same tier state, default focus time input It cuts to the non-state. (Only in iOS Entry into force below) | 2.10.4 |
confirm-hold | boolean | false | no | Click on the on in the lower right corner of the keyboard to keep the keyboard is not folded | 1.1.0 |
cursor | number | yes | Specifies the cursor position when focusing | 1.5.0 | |
selection-start | number | -1 | no | Cursor starting position, valid for auto-aggregation, with selection-end | 1.9.0 |
selection-end | number | -1 | no | End of cursor position, valid for auto-aggregation, with selection-start | 1.9.0 |
adjust-position | boolean | true | no | Does the page automatically push up when the keyboard bounces up | 1.9.90 |
hold-keyboard | boolean | false | no | Does not close the keyboard when you click on the page | 2.8.2 |
safe-password-cert-path | string | no | Secure keyboard encryption public key path, only support intra-package path | 2.18.0 | |
safe-password-length | number | no | Safe keyboard input password length | 2.18.0 | |
safe-password-time-stamp | number | no | Secure Keyboard Encryption Time Stamp | 2.18.0 | |
safe-password-nonce | string | no | Security keyboard encryption salt value | 2.18.0 | |
safe-password-salt | string | no | The security keyboard calculates the hash salt value, if custom-hash is specified Is invalid | 2.18.0 | |
safe-password-custom-hash | string | no | The security keyboard evaluates hash algorithmic expressions, such as md5(sha1('foo' + sha256(sm3(password + 'bar')))) | 2.18.0 | |
bindinput | eventhandle | yes | Triggered when keyboard input, event.detail = {value, cursor, keyCode},keyCode Is the key value, 2.1.0 The handler function can directly return A string that replaces the contents of the input box. | 1.0.0 | |
bindfocus | eventhandle | yes | Triggered when input box is focused, event.detail = { value, height },height For keyboard height, in the base library 1.9.90 Rise support | 1.0.0 | |
bindblur | eventhandle | yes | Triggered when the input box loses focus, event. detail = { value, encryptedValue, encryptError } | 1.0.0 | |
bindconfirm | eventhandle | yes | Triggered when the Finish on is clicked, event.detail = { value } | 1.0.0 | |
bindkeyboardheightchange | eventhandle | yes | This event is triggered when the keyboard height changes. = {height: height, duration: duration} | 2.7.0 |
type Legal value
value | Introductions | Minimum version |
---|---|---|
text | Text input keyboard | |
number | Digital input keyboard | |
idcard | ID input keyboard | |
digit | Numeric keypad with decimal point | |
safe-password | Password Safe Input Keyboard guide | 2.18.0 |
confirm-type Legal value
value | Introductions | Minimum version |
---|---|---|
send | The bottom right on is "send." | |
search | The bottom right on is "Search." | |
next | The bottom right on is "Next." | |
go | The on in the lower right corner is "Go." | |
done | The bottom right on is "Done" |
# Bug & Tip
tip
: The final performance of the confirm-type depends on the implementation of the mobile input method itself. Some of the Android input methods and third-party input methods may not or may not be fully supportedtip
: input Component is a native component, the font is the system font, so cannot be set font-familytip
: in input During focusing, avoid using css animationtip
: Forinput
Is encapsulated in a custom component, andform
Outside the custom component,form
You will not be able to get theinput
Value of. You need to use the custom component s built-in behaviorswx://form-field
tip
: If the keyboard height changes, the keyboardheightchange event may be triggered multiple times. Developers should ignore the same height valuebug
: WeChat version6.3.30
, focus Invalid property settingsbug
: WeChat version6.3.30
, placeholder Ghosting problem in focus