JeecgBoot 3.6.1版本发布——ONLINE专题版本
parent
06a13a9acd
commit
2ee3d66d7e
|
@ -1,10 +1,14 @@
|
|||
import { nextTick, onMounted, onActivated } from 'vue';
|
||||
|
||||
export function onMountedOrActivated(hook: Fn) {
|
||||
type HookArgs = {
|
||||
type: 'mounted' | 'activated';
|
||||
}
|
||||
|
||||
export function onMountedOrActivated(hook: Fn<HookArgs, any>) {
|
||||
let mounted: boolean;
|
||||
|
||||
onMounted(() => {
|
||||
hook();
|
||||
hook({type: 'mounted'});
|
||||
nextTick(() => {
|
||||
mounted = true;
|
||||
});
|
||||
|
@ -12,7 +16,7 @@ export function onMountedOrActivated(hook: Fn) {
|
|||
|
||||
onActivated(() => {
|
||||
if (mounted) {
|
||||
hook();
|
||||
hook({type: 'activated'});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue