0
点赞
收藏
分享

微信扫一扫

问下uniapp 的input的值怎么取?

皮皮球场 2022-03-24 阅读 113

在登录框想获得输入的账号密码,这个值怎么才能获得啊,不能用jq不知道怎么取得了

<template>  
       <view class=" has-mgtb-10 ">  
          <input type="text" maxlength="11" v-model="login.phone"   
                    placeholder="请输入用户名" @input="onKeyUserNameInput" class="is-input1 " />  
       </view>  
</template>  

<script>  
export default {  
        data() {  
            return {  
                login: {  
                    phone: "",  
                    password: "",  
                },  
            };  
        },  
        methods: {  
            onKeyUserNameInput: function(event) {  
                this.phone = event.target.value  
            },  
    }  

</script>  

通过定义@input获取input里的值,得到返回给定义的this.phone 就是拿到输入的用户名

举报

相关推荐

0 条评论