mirror of
https://github.com/youzan/vant.git
synced 2025-10-18 17:51:54 +00:00
[Document] add form components english document (#199)
* [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
This commit is contained in:
88
docs/examples-docs/en-US/password-input.md
Normal file
88
docs/examples-docs/en-US/password-input.md
Normal file
@@ -0,0 +1,88 @@
|
||||
<script>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
## PasswordInput
|
||||
The PasswordInput component is usually used with [NumberKeyboard](#/en-US/component/number-keyboard) Component.
|
||||
|
||||
### Install
|
||||
``` javascript
|
||||
import { PasswordInput, NumberKeyBoard } from 'vant';
|
||||
|
||||
Vue.component(PasswordInput.name, PasswordInput);
|
||||
Vue.component(NumberKeyBoard.name, NumberKeyBoard);
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
#### Basic Usage
|
||||
|
||||
:::demo Basic Usage
|
||||
```html
|
||||
<!-- 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>
|
||||
```
|
||||
|
||||
```javascript
|
||||
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 | - |
|
Reference in New Issue
Block a user