diff --git a/src/views/secondHandCar/carSource.vue b/src/views/secondHandCar/carSource.vue index 5ecff08b..8048270e 100644 --- a/src/views/secondHandCar/carSource.vue +++ b/src/views/secondHandCar/carSource.vue @@ -272,10 +272,11 @@ export default { }, methods:{ validatePrice(value) { - if (/^0+$/.test(value)){ - value = '0'; + if (value?.startsWith(0) && value?.length > 1) { + this.$nextTick(() => { + this.form.minPrice = 0 + }) } - this.form.minPrice = value; }, clearStorageFormInfo(){ localStorage.setItem("carSourceFormInfo",'') diff --git a/src/views/secondHandCar/wantBuy.vue b/src/views/secondHandCar/wantBuy.vue index 502745c5..22495413 100644 --- a/src/views/secondHandCar/wantBuy.vue +++ b/src/views/secondHandCar/wantBuy.vue @@ -173,16 +173,18 @@ export default { }, methods:{ validatePrice(value) { - if (/^0+$/.test(value)){ - value = '0'; + if (value?.startsWith(0) && value?.length > 1) { + this.$nextTick(() => { + this.form.minPrice = 0 + }) } - this.form.minPrice = value; }, validatePrice1(value) { - if (/^0+$/.test(value)){ - value = '0'; + if (value?.startsWith(0) && value?.length > 1) { + this.$nextTick(() => { + this.form.maxPrice = 0 + }) } - this.form.maxPrice = value; }, clearStorageFormInfo(){ localStorage.setItem("wantBuyFormInfo",'')