mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
* [Document] add english document of Checkbox * [Document] add english document of Field * [Document] add english document of NumberKeyboard * [bugfix] NumberKeyboard should not dispaly title when title is empty * [Document] add english document of PasswordInput * [Document] add english document of Radio * [document] add english document of Switch * [bugfix] remove redundent styles in english document * [Document] fix details * fix Switch test cases
1.7 KiB
1.7 KiB
PasswordInput
The PasswordInput component is usually used with NumberKeyboard Component.
Install
import { PasswordInput, NumberKeyBoard } from 'vant';
Vue.component(PasswordInput.name, PasswordInput);
Vue.component(NumberKeyBoard.name, NumberKeyBoard);
Usage
Basic Usage
:::demo Basic Usage
<!-- PasswordInput -->
<van-password-input
:value="value"
info="Some tips"
@focus="showKeyboard = true"
></van-password-input>
<!-- NumberKeyboard -->
<van-number-keyboard
:show="showKeyboard"
@input="onInput"
@delete="onDelete"
@blur="showKeyboard = false"
></van-number-keyboard>
export default {
data() {
return {
value: '',
showKeyboard: true
}
},
methods: {
onInput(key) {
this.value = (this.value + key).slice(0, 6);
},
onDelete() {
this.value = this.value.slice(0, this.value.length - 1);
}
}
}
:::
API
Attribute | Description | Type | Default | Accepted Values |
---|---|---|---|---|
value | Password value | String |
'' |
- |
length | Maxlength of password | Number |
6 |
- |
info | Bottom info | String |
- | - |
errorInfo | Bottom error info | String |
- | - |
Event
Event | Description | Attribute |
---|---|---|
focus | Triggered when input get focused | - |