feat 搭建架构骨架

This commit is contained in:
Ironsp
2026-09-24 09:09:47 +08:00
parent dd9f6b77a4
commit 7a2efa3fea
180 changed files with 18967 additions and 9 deletions

View File

@@ -0,0 +1,21 @@
import { ref, type Ref } from 'vue'
/** 请求 loading 状态管理 */
export function useLoading(initial = false): {
loading: Ref<boolean>
withLoading: <T>(fn: () => Promise<T>) => Promise<T>
} {
const loading = ref(initial)
async function withLoading<T>(fn: () => Promise<T>): Promise<T> {
loading.value = true
try {
return await fn()
}
finally {
loading.value = false
}
}
return { loading, withLoading }
}