1.注意這里輸入框的類型為number
<u-form-item required class="form-item" prop="rentPrice" :border-bottom="false" label="租金單價">
<u-input type="number" placeholder="請輸入租金金額" v-model="form.rentPrice">
<span class="unit" slot="unit">元/m2</span>
</u-input>
</u-form-item>
2.給rules添加transform轉(zhuǎn)為字符可解決報錯纬乍,猜測應(yīng)該是類型不匹配造成的驗證不通過
rentPrice: [{
required: true,
transform(value) {
return String(value);
},
message: '請輸入租金單價',
trigger: 'blur'
}]