加载页面后,给 form.impact 赋值,提交仍然提示未通过校验。
解决: form.impact = “40” , 改为字符串类型。
html
<u-form labelPosition="left" :model="form" ref="uForm">
<u-form-item :label-style="{'font-size': '28rpx','color': '#b4b4b4'}" label="影响里程(m):" label-width="200" prop="impact" required>
<u-input v-model="form.impact" ref="impactRef" type="number" clearable placeholder='请输入影响里程' />
</u-form-item>
js
impact: [{
required: true,
message: '请输入影响里程',
trigger: ['blur', 'change']
}],