qa-prevention-xgf-app/utils/useFormValidate.js

17 lines
347 B
JavaScript
Raw Normal View History

2024-08-08 11:08:55 +08:00
const useFormValidate = (ref, message = "请补全必填项!") => {
return new Promise((resolve, reject) => {
ref
.validate()
.then(() => {
resolve(true);
})
.catch(() => {
// eslint-disable-next-line prefer-promise-reject-errors
reject(false);
uni.$u.toast(message);
});
});
};
export default useFormValidate;