From 25ac61ae07e1d9e0d08d9943a1bf89b0bacbb48d Mon Sep 17 00:00:00 2001 From: ikmkj <1@qq,com> Date: Tue, 29 Jul 2025 20:02:26 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=90=9C=E7=B4=A2=E5=8A=9F=E8=83=BD):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=92=8C=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 searchedKeyword 变量,用于存储实际搜索的关键词 - 修改搜索逻辑,将 keyword 复制到 searchedKeyword - 更新搜索结果和热门列表的显示条件 -歌单和歌手页面的搜索功能都进行了相应优化 --- music-qianduan/src/views/Playlist.vue | 8 +++++--- music-qianduan/src/views/Singer.vue | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/music-qianduan/src/views/Playlist.vue b/music-qianduan/src/views/Playlist.vue index 848acf0..a272de9 100644 --- a/music-qianduan/src/views/Playlist.vue +++ b/music-qianduan/src/views/Playlist.vue @@ -44,6 +44,7 @@ const loading = ref(false) // 搜索关键词 const keyword = ref('') +const searchedKeyword = ref('') // 热门歌单 const hotPlaylists = ref([]) @@ -82,7 +83,7 @@ const fetchPlaylists = async () => { const res = await getPlaylistList( currentPage.value, pageSize.value, - keyword.value, + searchedKeyword.value, activeType.value ) @@ -123,6 +124,7 @@ const fetchHotPlaylists = async () => { // 处理搜索 const handleSearch = () => { currentPage.value = 1 + searchedKeyword.value = keyword.value fetchPlaylists() } @@ -243,7 +245,7 @@ onMounted(() => { -