yangyin
2024-11-05 f15c8fa05e3e4eae8ef093ba6ba827ad74e38fec
src/utils/types.ts
@@ -1,4 +1,5 @@
import { isNil } from 'lodash-unified';
import { ref } from 'vue';
export const isUndefined = (val: any): val is undefined => val === undefined;
export const isBoolean = (val: any): val is boolean => typeof val === 'boolean';
@@ -9,3 +10,10 @@
};
export const isFilledArray = (val: any) => Array.isArray(val) && val.length > 0;
/**
 *
 * @param _comp 组件构造函数
 * @returns 组件 ref
 * @example const formRef = useCompRef(ElForm);
 */
export const useCompRef = <T extends abstract new (...args: any) => any>(_comp: T) => ref<InstanceType<T>>();