refactor: 彻底删除 useForm 组合函数

This commit is contained in:
2024-11-23 22:57:44 +08:00
parent 7fa42975cf
commit 7fe3ffe9da
6 changed files with 8 additions and 26 deletions

View File

@@ -3,7 +3,6 @@ export * from './modules/usePagination'
export * from './modules/useRequest'
export * from './modules/useChart'
export * from './modules/useTable'
export * from './modules/useForm'
export * from './modules/useDevice'
export * from './modules/useBreakpoint'
export * from './modules/useDownload'

View File

@@ -1,17 +0,0 @@
import { reactive } from 'vue'
import { cloneDeep } from 'lodash-es'
export function useForm<F extends object>(initValue: F) {
const getInitValue = () => cloneDeep(initValue)
const form = reactive(getInitValue())
const resetForm = () => {
for (const key in form) {
delete form[key]
}
Object.assign(form, getInitValue())
}
return { form, resetForm }
}