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

13 lines
234 B
TypeScript

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