更新项目标题为“PDF 模块”,修改版本号至 0.0.3,调整路由基础路径,优化 Home 组件代码格式

This commit is contained in:
2026-02-04 19:44:39 +08:00
parent 87d48e6fc3
commit f858d1aa5b
5 changed files with 12 additions and 9 deletions

View File

@@ -5,8 +5,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="https://kevisual.xiongxiao.me/root/center/panda.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<link rel="stylesheet" href="/src/index.css" />
<title>PDF 模块</title>
<style>
html,
body {

View File

@@ -1,7 +1,7 @@
{
"name": "@kevisual/pdf",
"private": true,
"version": "0.0.1",
"version": "0.0.3",
"type": "module",
"basename": "/root/pdf",
"scripts": {
@@ -9,7 +9,7 @@
"build": "vite build",
"preview": "vite preview",
"ui": "pnpm dlx shadcn@latest add ",
"pub": "envision deploy ./dist -k pdf -v 0.0.1 -y y -u"
"pub": "envision deploy ./dist -k pdf -v 0.0.4 -y y -u"
},
"files": [
"dist"

View File

@@ -2,10 +2,12 @@ import ReactDOM from 'react-dom/client'
import { RouterProvider, createRouter } from '@tanstack/react-router'
import { routeTree } from './routeTree.gen'
import './index.css'
import { basename } from './modules/basename'
// Set up a Router instance
const router = createRouter({
routeTree,
basepath: basename,
defaultPreload: 'intent',
scrollRestoration: true,
})

View File

@@ -1,2 +1,2 @@
// @ts-ignore
export const basename = DEV_SERVER ? '/' : BASE_NAME;
export const basename = BASE_NAME;

View File

@@ -7,6 +7,8 @@ import pdfjsWorker from 'pdfjs-dist/build/pdf.worker.min.mjs?url'
// 设置 PDF.js worker
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfjsWorker
// pdfjsLib.GlobalWorkerOptions.workerSrc = "//cdn.jsdelivr.net/npm/pdfjs-dist@5.4.624/build/pdf.min.mjs"
// pdfjsLib.GlobalWorkerOptions.workerSrc = "//unpkg.com/pdfjs-dist@5.4.624/build/pdf.min.mjs"
export const Home = () => {
const [pdfFile, setPdfFile] = useState<File | null>(null)