feat(layout): added setting. Used to fix the left mixed mode menu

This commit is contained in:
vben
2021-01-03 10:42:19 +08:00
parent 5091a875ab
commit 97180e83f5
16 changed files with 192 additions and 53 deletions

View File

@@ -3,20 +3,23 @@ import { tryOnUnmounted } from '/@/utils/helper/vueHelper';
import { isFunction } from '/@/utils/is';
export function useTimeoutFn(handle: Fn<any>, wait: number) {
export function useTimeoutFn(handle: Fn<any>, wait: number, native = false) {
if (!isFunction(handle)) {
throw new Error('handle is not Function!');
}
const { readyRef, stop, start } = useTimeoutRef(wait);
watch(
readyRef,
(maturity) => {
maturity && handle();
},
{ immediate: false }
);
if (native) {
handle();
} else {
watch(
readyRef,
(maturity) => {
maturity && handle();
},
{ immediate: false }
);
}
return { readyRef, stop, start };
}