perf: optimize lazy loading components

This commit is contained in:
vben
2020-11-01 22:47:40 +08:00
parent 35d2bfc562
commit 87fcd0d21e
13 changed files with 180 additions and 166 deletions

View File

@@ -1,10 +1,10 @@
import type { TimeoutFnResult, Fn } from './types';
import { isFunction } from '/@/utils/is';
import { watch } from 'vue';
import { Ref, watch } from 'vue';
import { useTimeoutRef } from '/@/hooks/core/useTimeoutRef';
type TimeoutFnResult = [Fn<void>, Fn<void>, Ref<boolean>];
export function useTimeout(handle: Fn<any>, wait: number): TimeoutFnResult {
if (!isFunction(handle)) {
throw new Error('handle is not Function!');