mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-08-05 13:44:08 +08:00
perf: is utils
This commit is contained in:
@@ -103,3 +103,12 @@ export const isUrl = (path: string): boolean => {
|
|||||||
export const isDark = (): boolean => {
|
export const isDark = (): boolean => {
|
||||||
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
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
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user