From b0c1f07d84436b282db9ee0665b57fa29a72d8d4 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Fri, 7 Aug 2026 18:36:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=85=8D=E9=9F=B3?= =?UTF-8?q?=E5=BA=93=E4=B8=8A=E4=BC=A0=E6=8C=89=E9=92=AE=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E9=94=99=E8=AF=AF=20(#1266)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 使用 useNavigate 替代 window.location.href 进行 SPA 导航 - 修正路径为 /app/voices(缺少 /app 前缀) - 修复依赖数组 --- apps/web/src/pages/generate/components/Step5VoiceSelect.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/web/src/pages/generate/components/Step5VoiceSelect.tsx b/apps/web/src/pages/generate/components/Step5VoiceSelect.tsx index ca27184b7..9b56af3df 100644 --- a/apps/web/src/pages/generate/components/Step5VoiceSelect.tsx +++ b/apps/web/src/pages/generate/components/Step5VoiceSelect.tsx @@ -3,6 +3,7 @@ * 展示用户已上传的配音素材,支持选中、预览播放 */ import React, { useState, useRef, useCallback } from "react" +import { useNavigate } from "react-router-dom" import { useQuery } from "@tanstack/react-query" import { AudioOutlined, SoundOutlined } from "@ant-design/icons" import { getAssetsByKind } from "@/api/assets" @@ -34,6 +35,7 @@ const Step5VoiceSelect: React.FC = ({ selectedVoice, onSelectedVoiceChange, }) => { + const navigate = useNavigate() const [playingId, setPlayingId] = useState(null) const audioRef = useRef(null) @@ -86,8 +88,8 @@ const Step5VoiceSelect: React.FC = ({ /** 跳转到配音库上传 */ const handleGoToUpload = useCallback(() => { - window.location.href = "/voices" - }, []) + navigate("/app/voices") + }, [navigate]) // 加载中状态 if (isLoading) { -- 2.54.0