场景:input框中默认存在value=0,输入时将0清空,当value=’ '时,恢复value=0
<van-field
v-model="arr[0].value"
name="stockInvest"
type="digit"
maxlength="13"
:formatter="zeroFormatter"
input-align="right"
label-width="50%"
@blur="onBlur(0)" />
methods: {
zeroFormatter (value) {
if (value === '0' || value === '') {
return value
}
return parseInt(value)
},
onBlur (i) {
if (this.arr[i].value === '') {
this.arr[i].value = 0
return this.arr[i].value
}
}
}```