Showing
2 changed files
with
6 additions
and
14 deletions
@@ -13,13 +13,14 @@ | @@ -13,13 +13,14 @@ | ||
13 | "antd-mobile": "^5.38.1", | 13 | "antd-mobile": "^5.38.1", |
14 | "antd-mobile-icons": "^0.3.0", | 14 | "antd-mobile-icons": "^0.3.0", |
15 | "axios": "^1.7.9", | 15 | "axios": "^1.7.9", |
16 | + "lodash": "^4.17.11", | ||
16 | "react": "^18.3.1", | 17 | "react": "^18.3.1", |
17 | "react-dom": "^18.3.1", | 18 | "react-dom": "^18.3.1", |
18 | - "react-router-dom": "^7.1.1", | ||
19 | - "lodash": "^4.17.11" | 19 | + "react-router-dom": "^7.1.1" |
20 | }, | 20 | }, |
21 | "devDependencies": { | 21 | "devDependencies": { |
22 | "@eslint/js": "^9.17.0", | 22 | "@eslint/js": "^9.17.0", |
23 | + "@types/lodash": "^4.17.7", | ||
23 | "@types/node": "^22.10.5", | 24 | "@types/node": "^22.10.5", |
24 | "@types/react": "^18.3.18", | 25 | "@types/react": "^18.3.18", |
25 | "@types/react-dom": "^18.3.5", | 26 | "@types/react-dom": "^18.3.5", |
@@ -33,7 +34,6 @@ | @@ -33,7 +34,6 @@ | ||
33 | "postcss-px-to-viewport": "^1.1.1", | 34 | "postcss-px-to-viewport": "^1.1.1", |
34 | "typescript": "~5.6.2", | 35 | "typescript": "~5.6.2", |
35 | "typescript-eslint": "^8.18.2", | 36 | "typescript-eslint": "^8.18.2", |
36 | - "vite": "^5.3.4", | ||
37 | - "@types/lodash": "^4.17.7" | 37 | + "vite": "^5.3.4" |
38 | } | 38 | } |
39 | } | 39 | } |
@@ -10,25 +10,17 @@ const pdfPreview = (props: pdfPreviewProps) => { | @@ -10,25 +10,17 @@ const pdfPreview = (props: pdfPreviewProps) => { | ||
10 | 10 | ||
11 | useEffect(()=>{ | 11 | useEffect(()=>{ |
12 | if (props.url) { | 12 | if (props.url) { |
13 | - // const _url = encodeURIComponent(props.url); | ||
14 | - const _url = props.url; | 13 | + const _url = encodeURIComponent(props.url); |
15 | setFilePath(_url); | 14 | setFilePath(_url); |
16 | } | 15 | } |
17 | },[props.url]) | 16 | },[props.url]) |
18 | 17 | ||
19 | - // #viewerContainer margin-bottom: 0; | ||
20 | - | ||
21 | - | ||
22 | return ( | 18 | return ( |
23 | <div className={'pdfPreview'}> | 19 | <div className={'pdfPreview'}> |
24 | - {/* pdf属性 page 跳转到指定页码,navpanes 控制左侧的缩略图预览导航是否默认打开。0-关闭,1-打开*/} | ||
25 | - {/* navpanes=0&scrollbars=0&toolbar=0&statusbar=0 去除缩略图和工具栏 */} | ||
26 | - {/* view=FitH,top 为全屏展示 */} | ||
27 | <iframe | 20 | <iframe |
28 | title="pdf-preview" | 21 | title="pdf-preview" |
29 | style={{ width: '100%', height: '100%' }} | 22 | style={{ width: '100%', height: '100%' }} |
30 | - src={`${filePath}#page=1&navpanes=0&scrollbars=0&toolbar=0&statusbar=0&view=FitH,top`} | ||
31 | - // src={`https://h5jianke.21tb.com/file/generic_mobile/web/viewer.html?file=${filePath}#page=1&navpanes=0&scrollbars=0&toolbar=0&statusbar=0&view=FitH,top`} | 23 | + src={`https://h5jianke.21tb.com/file/generic_mobile/web/viewer.html?file=${filePath}`} |
32 | /> | 24 | /> |
33 | </div> | 25 | </div> |
34 | ); | 26 | ); |