修复无法加载的PDF异常

This commit is contained in:
tangly1024.com
2024-05-14 11:38:15 +08:00
parent 47e834629d
commit 61a719d10c
3 changed files with 26 additions and 9 deletions

14
components/Pdf.js Normal file
View File

@@ -0,0 +1,14 @@
/**
* 渲染pdf
* 直接用googledocs预览pdf
* @param {*} file
* @returns
*/
export function Pdf({ file }) {
const src =
'https://docs.google.com/viewer?embedded=true&url=' +
encodeURIComponent(file)
return (
<embed src={src} type='application/pdf' width='100%' height='100%'></embed>
)
}