表单输入绑定

使用v-model(双向数据绑定)自动收集数据
text/textarea
checkbox
radio
select

HTML:
用户名:
密码:
性别:
爱好:
城市:
介绍:

script:
    new Vue({
        el: '#demo',
        data: {
            username: '',
            pwd: '',
            gender: '女',
            hobby: ['foot'],
            allCitys: [{id: 1, name: 'BJ'}, {id: 2, name: 'SH'}, {id: 3, name: 'GD'}],
            cityId: '1',
            desc: ''
        },
        methods:{
            handleSubmit(){
                console.log(this.username, this.pwd);
            }
        }
    })

你可能感兴趣的:(表单输入绑定)