1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2026-01-23 08:00:22 +08:00
This commit is contained in:
zclzone
2023-12-07 21:55:23 +08:00
commit cfeb813b62
401 changed files with 11125 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
/**********************************
* @Author: Ronnie Zhang
* @LastEditor: Ronnie Zhang
* @LastEditTime: 2023/12/05 21:22:43
* @Email: zclzone@outlook.com
* Copyright © 2023 Ronnie Zhang(大脸怪) | https://isme.top
**********************************/
export const useForm = (initFormData = {}) => {
const formRef = ref(null)
const formModel = ref({ ...initFormData })
async function validation() {
try {
await formRef.value?.validate()
return true
} catch (error) {
return false
}
}
const rules = {
required: {
required: true,
message: '此为必填项',
trigger: ['blur', 'change'],
},
}
return [formRef, formModel, validation, rules]
}