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