跳到主要内容

Input

A container that hosts web pages. Will automatically cover the entire Mini Program page,Personal type Mini Program is not supported for the time being.

Example

<deprecated-input placeholder="welcome to binance" />

Bug & Tip

  • tip: input Component is a native component, the font is the system font, so cannot be set font-family
  • tip: in input During focusing, avoid using css animation
  • tip: For input Is encapsulated in a custom component, and form Outside the custom component, form You will not be able to get the input Value of. You need to use the custom component s built-in behaviors wx://form-field

Props

NameTypeDescriptionDefault
valuestring | numberThe initial content of the input box
typeTypeinput Type: 'text' or 'number'"text"
passwordbooleanIs it a password type?false
placeholderstringPlaceholder when input box is empty
disabledbooleanIs it disabled?false
maxlengthnumberMaximum input length, set to -1 Does not limit the maximum length140
auto-focusboolean(Soon to be abandoned, please use directly focus ) Auto focus, pull up the keyboardfalse
focusbooleanGetting focusfalse
manualbooleanIf manual is true, you can only change input value by e.control({value: string}) in onChange eventfalse
patternstringRegular expression for input content verification
inputmodestringKeyboard input type, valid values are: none, text, decimal, numeric, tel, search, email, url 

Events

NameDescription
bindinputTriggered when keyboard input,
Arguments
  • event: detail: Object
  • detail.value: string
  • detail.cursor: number
  • detail.keyCode: number — The key code in keyboard
bindinput-captureTrigger when input input event capture phase, see more about DOM3-EVENTS
bindfocusTriggered when input box is focused,
Arguments
  • event: detail: Object — The event object
  • detail.height: number — height for keyboard height
  • detail.value: string — The value of input
bindfocuscaptureTrigger when input focus event capture phase, see more about DOM3-EVENTS
bindblurTriggered when the input box loses focus, event. detail = { value, encryptedValue, encryptError }
bindblurcaptureTrigger when input blur event capture phase, see more about DOM3-EVENTS
bindconfirmTriggered when the Finish on is clicked, event.detail = { value }