feat: add loading

This commit is contained in:
2026-09-06 23:07:57 +07:00
parent 5f52a6c554
commit 2e03b22b82
6 changed files with 82 additions and 21 deletions
+22
View File
@@ -0,0 +1,22 @@
import { ref } from 'vue'
const pendingCount = ref(0)
const loading = ref(false)
export function useLoading() {
function start() {
pendingCount.value++
loading.value = true
}
function stop() {
if (pendingCount.value > 0) {
pendingCount.value--
}
if (pendingCount.value === 0) {
loading.value = false
}
}
return { loading, start, stop }
}