在登录框想获得输入的账号密码,这个值怎么才能获得啊,不能用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 就是拿到输入的用户名