# Form ### Install ```js import Vue from 'vue'; import { Form } from 'vant'; Vue.use(Form); ``` ## Usage ### Basic Usage ```html
Submit
``` ```js export default { data() { return { username: '', password: '', }; }, methods: { onSubmit(values) { console.log('submit', values); }, onFailed(errorInfo) { console.log('failed', errorInfo); }, }, } ``` ### Field Type - Switch ```html ``` ```js export default { data() { return { switchChecked: false, }; }, }; ``` ### Field Type - Checkbox ```html Checkbox 1 Checkbox 2 ``` ```js export default { data() { return { checkbox: false, checkboxGroup: [], }; }, }; ``` ### Field Type - Radio ```html Radio 1 Radio 2 ``` ```js export default { data() { return { radio: '1', }; }, }; ``` ### Field Type - Stepper ```html ``` ```js export default { data() { return { stepper: 1, }; }, }; ``` ### Field Type - Rate ```html ``` ```js export default { data() { return { rate: 3, }; }, }; ``` ### Field Type - Slider ```html ``` ```js export default { data() { return { slider: 50, }; }, }; ``` ### Field Type - Uploader ```html ``` ```js export default { data() { return { uploader: [{ url: 'https://img.yzcdn.cn/vant/leaf.jpg' }], }; }, }; ``` ### Field Type - Picker ```html ``` ```js export default { data() { return { value: '', columns: ['Delaware', 'Florida', 'Georqia', 'Indiana', 'Maine'], showPicker: false, }; }, methods: { onConfirm(value) { this.value = value; this.showPicker = false; }, onCancel() { this.showPicker = false; }, }, }; ``` ## API ### Props | Attribute | Description | Type | Default | |------|------|------|------| ### Events | Event | Description | Arguments | ### Slots | Name | Description | |------|------|