remove lading page

This commit is contained in:
Qing
2022-10-08 13:30:35 +08:00
parent 724b8c232d
commit 4980675730
5 changed files with 44 additions and 23 deletions

View File

@@ -74,11 +74,14 @@ export function loadImage(image: HTMLImageElement, src: string) {
})
}
export function useImage(file: File): [HTMLImageElement, boolean] {
export function useImage(file?: File): [HTMLImageElement, boolean] {
const [image] = useState(new Image())
const [isLoaded, setIsLoaded] = useState(false)
useEffect(() => {
if (file === undefined) {
return
}
image.onload = () => {
setIsLoaded(true)
}