🐞 fix: 修复搜索下 mv和歌曲同时播放问题

This commit is contained in:
alger
2024-12-05 21:35:20 +08:00
parent 5d4c4922fd
commit 08fa160de4
+6 -5
View File
@@ -23,8 +23,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { useStore } from 'vuex';
import { getAlbum, getListDetail } from '@/api/list'; import { getAlbum, getListDetail } from '@/api/list';
import { getMvUrl } from '@/api/mv';
import MvPlayer from '@/components/MvPlayer.vue'; import MvPlayer from '@/components/MvPlayer.vue';
import { IMvItem } from '@/type/mv'; import { IMvItem } from '@/type/mv';
import { getImgUrl } from '@/utils'; import { getImgUrl } from '@/utils';
@@ -39,8 +40,6 @@ const props = defineProps<{
}; };
}>(); }>();
const url = ref('');
const songList = ref<any[]>([]); const songList = ref<any[]>([]);
const showPop = ref(false); const showPop = ref(false);
@@ -53,6 +52,8 @@ const getCurrentMv = () => {
} as unknown as IMvItem; } as unknown as IMvItem;
}; };
const store = useStore();
const handleClick = async () => { const handleClick = async () => {
listInfo.value = null; listInfo.value = null;
if (props.item.type === '专辑') { if (props.item.type === '专辑') {
@@ -72,8 +73,8 @@ const handleClick = async () => {
} }
if (props.item.type === 'mv') { if (props.item.type === 'mv') {
const res = await getMvUrl(props.item.id); store.commit('setIsPlay', false);
url.value = res.data.data.url; store.commit('setPlayMusic', false);
showPop.value = true; showPop.value = true;
} }
}; };