van-field框的使用 和通过事件获取值
<van-cell-group> <van-field value="{{username}}" label="姓名" placeholder="请输入您的姓名" bind:blur="getname" class='nextnext' /> </van-cell-group> <van-button type="primary" size="large" color="linear-gradient(to right, #4bb0ff, #6149f6)" bindtap="getalldata" > 提交 </van-button> ------------------------------------- ##js## data: { username:"", }, // 获取姓名 getname(event) { console.log("失去焦点获取的值",event.detail.value);//获取值 // 设置值 this.setData({ username: event.detail.value }) }, getalldata(){ console.log("点击按钮获取的值",this.data.username) },
来源:https://www.cnblogs.com/IwishIcould/p/12014006.html