优化表单校验
This commit is contained in:
parent
b6ea349217
commit
201fed4ae0
@ -101,13 +101,8 @@
|
|||||||
this.initProvinceAndCity();
|
this.initProvinceAndCity();
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
validate(){
|
async validate(){
|
||||||
return new Promise((resolve, reject)=>{
|
return await this.$refs.districtForm.validate();
|
||||||
this.$refs.districtForm.validate().then(res=>{
|
|
||||||
if(res)resolve(true);
|
|
||||||
else reject(false);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// 初始化
|
// 初始化
|
||||||
async initProvinceAndCity() {
|
async initProvinceAndCity() {
|
||||||
|
@ -138,13 +138,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
validate() {
|
async validate() {
|
||||||
return new Promise((resolve, reject) => {
|
return this.$refs.residentsForm.validate();
|
||||||
this.$refs.residentsForm.validate().then(res => {
|
|
||||||
if (res) resolve(true);
|
|
||||||
else reject(false);
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
// 选择生日
|
// 选择生日
|
||||||
changebirth_time(e) {
|
changebirth_time(e) {
|
||||||
|
@ -150,9 +150,9 @@
|
|||||||
async addArchives() {
|
async addArchives() {
|
||||||
Toast('开发中')
|
Toast('开发中')
|
||||||
let flag = true;
|
let flag = true;
|
||||||
// flag = await this.$refs.districtSelectorRef.validate();
|
flag = this.$refs.districtSelectorRef.validate();
|
||||||
// if(flag) flag = await this.$refs.residentsRef.validate();
|
if(flag) flag = this.$refs.residentsRef.validate();
|
||||||
if(flag) flag = await this.$refs.breedingRef.validate();
|
if(flag) flag = this.$refs.breedingRef.validate();
|
||||||
if(flag) this.$refs.archives.validate().then(async (e) => {
|
if(flag) this.$refs.archives.validate().then(async (e) => {
|
||||||
if (e) {
|
if (e) {
|
||||||
uni.showLoading()
|
uni.showLoading()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user