perf: perf modal and drawer

This commit is contained in:
vben
2020-11-27 23:41:45 +08:00
parent 819127e807
commit 81baf1d5c4
25 changed files with 571 additions and 496 deletions

View File

@@ -7,6 +7,7 @@ import {
onUnmounted,
nextTick,
reactive,
ComponentInternalInstance,
} from 'vue';
export function explicitComputed<T, S>(source: WatchSource<S>, fn: () => T) {
@@ -29,8 +30,10 @@ export function tryOnUnmounted(fn: () => Promise<void> | void) {
getCurrentInstance() && onUnmounted(fn);
}
export function tryTsxEmit(fn: (_instance: any) => Promise<void> | void) {
const instance = getCurrentInstance();
export function tryTsxEmit<T extends any = ComponentInternalInstance>(
fn: (_instance: T) => Promise<void> | void
) {
const instance = getCurrentInstance() as any;
instance && fn.call(null, instance);
}