数据绑定
2021-07-15 本文已影响0人
zZ_d205
<van-field data-name="name" value="{{ detail.name }}" clearable label="姓名" placeholder="请输入姓名(必填)" bind:change="formInputChange" />
// 表单改变
formInputChange(e) {
let key = e.currentTarget.dataset.name
let {detail} = this.data
let data = detail
data[key] = e.detail
this.setData({
detail: data
})
},