fix: 修复build后刷新页面空白问题

- 将Vue Router改为Hash模式,解决SPA路由在简单HTTP服务器下的兼容性问题
- 设置Vite base为相对路径,支持任意目录部署
- 确保dist文件夹可直接用于演示和分发

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sladro 2025-09-21 11:07:31 +08:00
parent 4f1666e7d2
commit 8bbbcb5383
2 changed files with 3 additions and 2 deletions

View File

@ -8,6 +8,7 @@ export default defineConfig({
plugins: [
vue(),
],
base: './', // 使用相对路径,支持任意目录部署
resolve: {
alias: {
'@': fileURLToPath(new URL('../src', import.meta.url))

View File

@ -1,8 +1,8 @@
import { createRouter, createWebHistory } from 'vue-router'
import { createRouter, createWebHashHistory } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
history: createWebHashHistory(),
routes: [
{
path: '/login',