feat: 新增自定义背景图

This commit is contained in:
MTrun
2022-02-06 21:35:38 +08:00
parent 688ce50c58
commit 8fb8b9328d
18 changed files with 297 additions and 51 deletions
+8 -1
View File
@@ -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,
})
+16
View File
@@ -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)
}
};
};
/**
* * 挂载监听
*/