wms-antdvue/.svn/pristine/a1/a1ddb277715400a461980ebb0dc6498ecf525c51.svn-base
2024-11-07 16:33:03 +08:00

22 lines
517 B
Plaintext

import { ref, ComputedRef, unref, computed, watch } from 'vue';
import type { BasicTableProps } from '../types/table';
export function useLoading(props: ComputedRef<BasicTableProps>) {
const loadingRef = ref(unref(props).loading);
watch(
() => unref(props).loading,
(loading) => {
loadingRef.value = loading;
},
);
const getLoading = computed(() => unref(loadingRef));
function setLoading(loading: boolean) {
loadingRef.value = loading;
}
return { getLoading, setLoading };
}