运维管理平台前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
480 B

5 months ago
import { type AnyFunction } from '@vben/types';
import { nextTick, onActivated, onMounted } from 'vue';
/**
* OnMounted OnActivated
* @param hook
*/
function onMountedOrActivated(hook: AnyFunction) {
let mounted: boolean;
onMounted(() => {
hook();
nextTick(() => {
mounted = true;
});
});
onActivated(() => {
if (mounted) {
hook();
}
});
}
export { onMountedOrActivated };