mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
feat: 新增自定义背景图
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { defineAsyncComponent, AsyncComponentLoader } from 'vue'
|
||||
import { AsyncLoading } from '@/components/LoadingComponent'
|
||||
import { AsyncLoading, AsyncSkeletonLoading } from '@/components/LoadingComponent'
|
||||
|
||||
/**
|
||||
* * 异步加载组件
|
||||
@@ -12,3 +12,10 @@ export const loadAsyncComponent = (loader: AsyncComponentLoader<any>) =>
|
||||
loadingComponent: AsyncLoading,
|
||||
delay: 20,
|
||||
})
|
||||
|
||||
export const loadSkeletonAsyncComponent = (loader: AsyncComponentLoader<any>) =>
|
||||
defineAsyncComponent({
|
||||
loader,
|
||||
loadingComponent: AsyncSkeletonLoading,
|
||||
delay: 20,
|
||||
})
|
||||
|
||||
@@ -91,6 +91,7 @@ export const setDomAttribute = <K extends keyof CSSStyleDeclaration, V extends C
|
||||
HTMLElement.style[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* * 判断是否是 mac
|
||||
* @returns boolean
|
||||
@@ -98,6 +99,21 @@ export const setDomAttribute = <K extends keyof CSSStyleDeclaration, V extends C
|
||||
export const isMac = () => {
|
||||
return /macintosh|mac os x/i.test(navigator.userAgent)
|
||||
}
|
||||
|
||||
/**
|
||||
* * file转base64
|
||||
*/
|
||||
export const fileTobase64 = (file:File, callback: Function) => {
|
||||
let reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = function (e: ProgressEvent<FileReader>) {
|
||||
if(e.target) {
|
||||
let base64 = e.target.result;
|
||||
callback(base64)
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* * 挂载监听
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user