fix: 文件预览
This commit is contained in:
1 parent
ecd2fba629
commit
11db25e355
2 files changed
+8
-7
No files matched your search
@@ -45,6 +45,12 @@ export default function FilePreviewModal({
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (filePath) {
|
||||||
|
run()
|
||||||
|
}
|
||||||
|
}, [filePath])
|
||||||
|
|
||||||
let contentElement = null
|
let contentElement = null
|
||||||
if (!supportedPreviewExts.includes(ext)) {
|
if (!supportedPreviewExts.includes(ext)) {
|
||||||
contentElement = <div>暂不支持预览此文件类型</div>
|
contentElement = <div>暂不支持预览此文件类型</div>
|
||||||
@@ -68,12 +74,6 @@ export default function FilePreviewModal({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (filePath) {
|
|
||||||
run()
|
|
||||||
}
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal isOpen={isOpen} onClose={onClose} scrollBehavior="inside" size="3xl">
|
<Modal isOpen={isOpen} onClose={onClose} scrollBehavior="inside" size="3xl">
|
||||||
<ModalContent>
|
<ModalContent>
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export default function ImageNameButton({
|
|||||||
run()
|
run()
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
variant="light"
|
variant="light"
|
||||||
@@ -69,7 +70,7 @@ export default function ImageNameButton({
|
|||||||
) : loading || !data ? (
|
) : loading || !data ? (
|
||||||
<Spinner size="sm" />
|
<Spinner size="sm" />
|
||||||
) : (
|
) : (
|
||||||
<Image src={data} alt={name} className="w-8 h-8" radius="sm" />
|
<Image src={data} alt={name} className="w-8 h-8 flex-shrink-0" radius="sm" />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in new issue
Block a user