diff --git a/components/districtSelector/districtSelector.vue b/components/districtSelector/districtSelector.vue index a82b73c..8e37ab1 100644 --- a/components/districtSelector/districtSelector.vue +++ b/components/districtSelector/districtSelector.vue @@ -101,13 +101,8 @@ this.initProvinceAndCity(); }, methods:{ - validate(){ - return new Promise((resolve, reject)=>{ - this.$refs.districtForm.validate().then(res=>{ - if(res)resolve(true); - else reject(false); - }) - }) + async validate(){ + return await this.$refs.districtForm.validate(); }, // 初始化 async initProvinceAndCity() { diff --git a/components/newArchives/residents.vue b/components/newArchives/residents.vue index 4a60b0d..878a749 100644 --- a/components/newArchives/residents.vue +++ b/components/newArchives/residents.vue @@ -138,13 +138,8 @@ } }, methods: { - validate() { - return new Promise((resolve, reject) => { - this.$refs.residentsForm.validate().then(res => { - if (res) resolve(true); - else reject(false); - }) - }) + async validate() { + return this.$refs.residentsForm.validate(); }, // 选择生日 changebirth_time(e) { diff --git a/subpkg/newArchives/newArchives.vue b/subpkg/newArchives/newArchives.vue index e7c8b96..1e5bfdc 100644 --- a/subpkg/newArchives/newArchives.vue +++ b/subpkg/newArchives/newArchives.vue @@ -150,9 +150,9 @@ async addArchives() { Toast('开发中') let flag = true; - // flag = await this.$refs.districtSelectorRef.validate(); - // if(flag) flag = await this.$refs.residentsRef.validate(); - if(flag) flag = await this.$refs.breedingRef.validate(); + flag = this.$refs.districtSelectorRef.validate(); + if(flag) flag = this.$refs.residentsRef.validate(); + if(flag) flag = this.$refs.breedingRef.validate(); if(flag) this.$refs.archives.validate().then(async (e) => { if (e) { uni.showLoading()