ant-design-vue/components/_util/hooks/useDestroyed.ts

13 lines
214 B
TypeScript

import { onBeforeUnmount, ref } from 'vue';
const useDestroyed = () => {
const mounted = ref(true);
onBeforeUnmount(() => {
mounted.value = false;
});
return mounted;
};
export default useDestroyed;