diff --git a/src/utils/is.ts b/src/utils/is.ts index cb8f1a0e..eec86a93 100644 --- a/src/utils/is.ts +++ b/src/utils/is.ts @@ -106,3 +106,12 @@ export const isUrl = (path: string): boolean => { export const isDark = (): boolean => { return window.matchMedia('(prefers-color-scheme: dark)').matches } + +// 是否是图片链接 +export const isImgPath = (path: string): boolean => { + return /(https?:\/\/|data:image\/).*?\.(png|jpg|jpeg|gif|svg|webp|ico)/gi.test(path) +} + +export const isEmptyVal = (val: any): boolean => { + return val === '' || val === null || val === undefined +}