From 3adbeb183ccff46a2b2d0d2122e0d5e838de14b9 Mon Sep 17 00:00:00 2001 From: cat_shark <1716967236@qq.com> Date: Sat, 4 Jul 2026 09:43:07 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9ATransition=20=E7=99=BD=E5=B1=8F?= =?UTF-8?q?=E2=80=94=E2=80=94=E7=BB=84=E4=BB=B6=E5=A4=9A=E6=A0=B9=E8=8A=82?= =?UTF-8?q?=E7=82=B9=20+=20Vite=20=E6=A8=A1=E5=9D=97=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=8B=A6=E6=88=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Welcome.vue:回忆卡片 el-dialog 和根 section 共存导致多根节点, 无法动画。包裹一层
- Study.vue:同上(权重配置对话框) - MindMapViewer.vue:事件名 selectNode→selectNewNode(类型错误) - e2e/study.spec.ts + navigation.spec.ts:地址栏 Vite 在模块 URL 后追加 ?t=... 时间戳,.endsWith('.ts') 匹配失效,改用 url.includes('/src/') --- e2e/navigation.spec.ts | 2 +- e2e/study.spec.ts | 9 ++++++--- package.json | 2 +- src/components/MindMapViewer.vue | 4 ++-- src/components/Study.vue | 2 ++ src/components/Welcome.vue | 2 ++ 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/e2e/navigation.spec.ts b/e2e/navigation.spec.ts index c178df5..371d26d 100644 --- a/e2e/navigation.spec.ts +++ b/e2e/navigation.spec.ts @@ -37,7 +37,7 @@ test.describe('Header navigation', () => { test('back button shows on sub-pages and navigates to /welcome', async ({ page }) => { await page.route('**/api/tasks**', (route) => { - if (route.request().url().endsWith('.ts')) return route.continue(); + if (route.request().url().includes('/src/')) return route.continue(); route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(mockTasks) }); }); await page.route('**/api/review/feed**', (route) => diff --git a/e2e/study.spec.ts b/e2e/study.spec.ts index cce4fa5..a2a1bd9 100644 --- a/e2e/study.spec.ts +++ b/e2e/study.spec.ts @@ -38,7 +38,8 @@ test.describe('Study page', () => { await page.route('**/api/tasks**', (route) => { const url = route.request().url(); // 排除 Vite 模块加载请求(.ts 文件),只拦截真正的 API 请求 - if (url.endsWith('.ts')) return route.continue(); + // Vite 模块请求都走 /src/ 路径,跳过它们只拦截真正的 API 请求 + if (url.includes('/src/')) return route.continue(); if (url.includes('/tasks') && !url.includes('/tasks/')) { return route.fulfill({ status: 200, @@ -87,7 +88,8 @@ test.describe('Study page', () => { test('delete task removes it from the list', async ({ page }) => { await page.route('**/api/tasks/1', (route) => { const url = route.request().url(); - if (url.endsWith('.ts')) return route.continue(); + // Vite 模块请求都走 /src/ 路径,跳过它们只拦截真正的 API 请求 + if (url.includes('/src/')) return route.continue(); route.fulfill({ status: 200, contentType: 'application/json', @@ -102,7 +104,8 @@ test.describe('Study page', () => { test('shows empty state when no tasks', async ({ page }) => { await page.route('**/api/tasks**', (route) => { const url = route.request().url(); - if (url.endsWith('.ts')) return route.continue(); + // Vite 模块请求都走 /src/ 路径,跳过它们只拦截真正的 API 请求 + if (url.includes('/src/')) return route.continue(); route.fulfill({ status: 200, contentType: 'application/json', diff --git a/package.json b/package.json index 9c67b6e..8055a39 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "type-check": "vue-tsc --build --force", "test": "vitest run", "test:watch": "vitest", - "test:e2e": "playwright test", + "test:e2e": "npx playwright test", "test:e2e:ui": "playwright test --ui" }, "dependencies": { diff --git a/src/components/MindMapViewer.vue b/src/components/MindMapViewer.vue index 2e04c54..3b8c56d 100644 --- a/src/components/MindMapViewer.vue +++ b/src/components/MindMapViewer.vue @@ -119,9 +119,9 @@ const render = () => { }); } - instance.bus.addListener("selectNode", (node: any) => { + instance.bus.addListener("selectNewNode", (node: any) => { if (node?.sourceType && node?.sourceId != null) { - emit("node-click", { sourceType: node.sourceType, sourceId: node.sourceId }); + emit("node-click", { sourceType: String(node.sourceType), sourceId: Number(node.sourceId) }); } }); }; diff --git a/src/components/Study.vue b/src/components/Study.vue index 78be29a..a90e947 100644 --- a/src/components/Study.vue +++ b/src/components/Study.vue @@ -255,6 +255,7 @@ onMounted(() => { +