fix: 修复 Hash 路由跳转丢失部署基路径

- 修复懒加载分包失败后跳转到站点根路径的问题

- 统一管理端和用户中心新窗口路由解析

- 增加部署基路径与 Hash 路由回归测试
This commit is contained in:
2026-08-31 18:47:54 +08:00
parent 1bd9810518
commit 9ef20119a9
11 changed files with 83 additions and 23 deletions

View File

@@ -0,0 +1,26 @@
import { createRouter, createWebHashHistory } from 'vue-router';
import { describe, expect, it } from 'vitest';
import { resolveChunkReloadHref } from '../guard';
describe('chunk error reload', () => {
it('preserves the deployment base and hash route', () => {
const router = createRouter({
history: createWebHashHistory('/flow/'),
routes: [
{
component: { template: '<div>workflow</div>' },
path: '/ai/workflow',
},
],
});
const href = resolveChunkReloadHref(router, '/ai/workflow?source=sidebar');
expect(href).toBe('#/ai/workflow?source=sidebar');
expect(new URL(href, 'https://easyflowtech.cn/flow/').href).toBe(
'https://easyflowtech.cn/flow/#/ai/workflow?source=sidebar',
);
});
});