3 Commits

Author SHA1 Message Date
5d06560a08 更新README 2026-09-02 19:55:41 +08:00
36a37bb6e3 修复了一些Bug 2026-09-02 19:53:27 +08:00
155818bbc7 修复了一些Bug 2026-09-02 19:52:25 +08:00
6 changed files with 276 additions and 11 deletions

View File

@@ -15,3 +15,51 @@ npm run dev
```shell
npm run build
```
### 对于Nginx服务器需要添加以下配置
找到你站点 Nginx 配置文件(通常在 `/etc/nginx/conf.d/xxx.conf``/etc/nginx/sites-available/xxx`),在 `location /` 块中添加 `try_files`
```nginx
server {
listen 80;
server_name your-domain.com;
root /你的部署目录/dist; # 指向你构建产物的目录
index index.html;
location / {
try_files $uri $uri/ /index.html; # 关键配置
}
# 静态资源缓存(可选,提升性能)
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}
```
**核心就是这一行:**
```nginx
try_files $uri $uri/ /index.html;
```
它的含义是:
1. 先尝试查找请求的文件(`$uri`
2. 再尝试查找请求的目录(`$uri/`
3. 都找不到就返回 `index.html`,让 Vue Router 接管路由
## 生效步骤
修改完配置后,执行:
```bash
# 检查配置语法是否正确
nginx -t
# 重新加载配置(无需重启)
nginx -s reload
```
配置生效后,直接访问 `/help` 就不会再 404 了。

176
package-lock.json generated
View File

@@ -16,6 +16,8 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^6.0.8",
"unplugin-auto-import": "^21.1.0",
"unplugin-vue-components": "^32.1.0",
"vite": "^8.2.2"
}
},
@@ -888,6 +890,13 @@
"integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",
"license": "MIT"
},
"node_modules/@types/estree": {
"version": "1.0.9",
"resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.9.tgz",
"integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/jsesc": {
"version": "2.5.1",
"resolved": "https://registry.npmmirror.com/@types/jsesc/-/jsesc-2.5.1.tgz",
@@ -1519,6 +1528,19 @@
"node": ">=6"
}
},
"node_modules/escape-string-regexp": {
"version": "5.0.0",
"resolved": "https://registry.npmmirror.com/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz",
"integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/estree-walker": {
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/estree-walker/-/estree-walker-2.0.2.tgz",
@@ -2325,6 +2347,26 @@
"node": ">=0.10.0"
}
},
"node_modules/strip-literal": {
"version": "4.0.0",
"resolved": "https://registry.npmmirror.com/strip-literal/-/strip-literal-4.0.0.tgz",
"integrity": "sha512-PaqAvfUZKBwc/SLmNZtHmzK+v19Z4O4eS3cKPeGvbIv/U3pnyEq4Tuw3/4v/FwfM8VQaEawsyCcOQ0P+kpwWWw==",
"dev": true,
"license": "MIT",
"dependencies": {
"js-tokens": "^10.0.0"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/strip-literal/node_modules/js-tokens": {
"version": "10.0.0",
"resolved": "https://registry.npmmirror.com/js-tokens/-/js-tokens-10.0.0.tgz",
"integrity": "sha512-lM/UBzQmfJRo9ABXbPWemivdCW8V2G8FHaHdypQaIy523snUjog0W71ayWXTjiR+ixeMyVHN2XcpnTd/liPg/Q==",
"dev": true,
"license": "MIT"
},
"node_modules/tinyglobby": {
"version": "0.2.17",
"resolved": "https://registry.npmmirror.com/tinyglobby/-/tinyglobby-0.2.17.tgz",
@@ -2356,6 +2398,64 @@
"integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==",
"license": "MIT"
},
"node_modules/unimport": {
"version": "6.4.0",
"resolved": "https://registry.npmmirror.com/unimport/-/unimport-6.4.0.tgz",
"integrity": "sha512-JJOOuNMFq8b4ZPBKwQUxEcba4MplskDzYI1Lvrf8rJfWphZTWvPNXWa493qsPngHUmub89w6C7j+SeLWTE/UIQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"acorn": "^8.18.0",
"escape-string-regexp": "^5.0.0",
"estree-walker": "^3.0.3",
"local-pkg": "^1.2.1",
"magic-string": "^1.1.0",
"mlly": "^1.8.2",
"pathe": "^2.0.3",
"picomatch": "^4.0.5",
"pkg-types": "^2.3.1",
"scule": "^1.3.0",
"strip-literal": "^4.0.0",
"tinyglobby": "^0.2.17",
"unplugin": "^3.3.0",
"unplugin-utils": "^0.3.2"
},
"engines": {
"node": ">=18.12.0"
},
"peerDependencies": {
"oxc-parser": "*",
"rolldown": "^1.0.0"
},
"peerDependenciesMeta": {
"oxc-parser": {
"optional": true
},
"rolldown": {
"optional": true
}
}
},
"node_modules/unimport/node_modules/estree-walker": {
"version": "3.0.3",
"resolved": "https://registry.npmmirror.com/estree-walker/-/estree-walker-3.0.3.tgz",
"integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/estree": "^1.0.0"
}
},
"node_modules/unimport/node_modules/magic-string": {
"version": "1.2.3",
"resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-1.2.3.tgz",
"integrity": "sha512-Bpb0W2TbLKOZ7vJnOUnVRGq3WL2p+ISV29M6hYPL1AFCpyKZpdr5ytiXoTSSxRVhg8YW7f65+6gbG8WG6PCa/g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.5"
}
},
"node_modules/unplugin": {
"version": "3.3.0",
"resolved": "https://registry.npmmirror.com/unplugin/-/unplugin-3.3.0.tgz",
@@ -2410,6 +2510,49 @@
}
}
},
"node_modules/unplugin-auto-import": {
"version": "21.1.0",
"resolved": "https://registry.npmmirror.com/unplugin-auto-import/-/unplugin-auto-import-21.1.0.tgz",
"integrity": "sha512-EzrSqWIBulEqCuP7idADXH+tVKYrbwKlR5+r/lOWik0o+Ksny1kitmtryHGNSv7puzzORlcIwT/x2JStiszlHA==",
"dev": true,
"license": "MIT",
"dependencies": {
"local-pkg": "^1.2.1",
"magic-string": "^1.1.0",
"picomatch": "^4.0.5",
"unimport": "^6.4.0",
"unplugin": "^3.3.0",
"unplugin-utils": "^0.3.2"
},
"engines": {
"node": ">=20.19.0"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@nuxt/kit": "^4.0.0",
"@vueuse/core": "*"
},
"peerDependenciesMeta": {
"@nuxt/kit": {
"optional": true
},
"@vueuse/core": {
"optional": true
}
}
},
"node_modules/unplugin-auto-import/node_modules/magic-string": {
"version": "1.2.3",
"resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-1.2.3.tgz",
"integrity": "sha512-Bpb0W2TbLKOZ7vJnOUnVRGq3WL2p+ISV29M6hYPL1AFCpyKZpdr5ytiXoTSSxRVhg8YW7f65+6gbG8WG6PCa/g==",
"dev": true,
"license": "MIT",
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.5"
}
},
"node_modules/unplugin-utils": {
"version": "0.3.2",
"resolved": "https://registry.npmmirror.com/unplugin-utils/-/unplugin-utils-0.3.2.tgz",
@@ -2426,6 +2569,39 @@
"url": "https://github.com/sponsors/sxzz"
}
},
"node_modules/unplugin-vue-components": {
"version": "32.1.0",
"resolved": "https://registry.npmmirror.com/unplugin-vue-components/-/unplugin-vue-components-32.1.0.tgz",
"integrity": "sha512-YiUkSxuRjab18XFOrX5VsIxXzccrfmHVGsGeJgSgklb829DQmCy9E4vvDUE4tuvZZdxyFJZX0Oc4TPnnxiiMyg==",
"dev": true,
"license": "MIT",
"dependencies": {
"chokidar": "^5.0.0",
"local-pkg": "^1.2.0",
"magic-string": "^0.30.21",
"mlly": "^1.8.2",
"obug": "^2.1.1",
"picomatch": "^4.0.4",
"tinyglobby": "^0.2.16",
"unplugin": "^3.0.0",
"unplugin-utils": "^0.3.1"
},
"engines": {
"node": ">=20.19.0"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@nuxt/kit": "^3.2.2 || ^4.0.0",
"vue": "^3.0.0"
},
"peerDependenciesMeta": {
"@nuxt/kit": {
"optional": true
}
}
},
"node_modules/update-browserslist-db": {
"version": "1.3.1",
"resolved": "https://registry.npmmirror.com/update-browserslist-db/-/update-browserslist-db-1.3.1.tgz",

View File

@@ -17,6 +17,8 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^6.0.8",
"unplugin-auto-import": "^21.1.0",
"unplugin-vue-components": "^32.1.0",
"vite": "^8.2.2"
}
}

View File

@@ -8,7 +8,7 @@ const routes = [
},
{
name: '帮助',
path: '/help',
path: '/help/',
component: () => import('../views/help/help.vue')
}
]

View File

@@ -1,18 +1,16 @@
import { fileURLToPath, URL } from 'node:url'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
import vueDevTools from 'vite-plugin-vue-devtools'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
vueDevTools(),
],
plugins: [
vue(),
vueDevTools(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
})
})

41
vite.config.js.back Normal file
View File

@@ -0,0 +1,41 @@
import { fileURLToPath, URL } from 'node:url'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite'
import vueDevTools from 'vite-plugin-vue-devtools'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// https://vite.dev/config/
export default defineConfig({
plugins: [
vue(),
vueDevTools(),
AutoImport({
resolvers: [ElementPlusResolver()],
}),
Components({
resolvers: [ElementPlusResolver()],
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
},
},
build: {
rolldownOptions: {
output: {
manualChunks(id) {
if (id.includes('node_modules/element-plus')) {
return 'element-plus'
}
if (id.includes('node_modules/vue') || id.includes('node_modules/vue-router') || id.includes('node_modules/@vue')) {
return 'vue-vendor'
}
},
},
},
},
})