mirror of
https://github.com/imsyy/SPlayer.git
synced 2025-11-26 03:44:57 +08:00
fix: 切换歌曲时多次弹窗
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
|
||||
- [ ] 发表评论
|
||||
- [ ] `i18n` 支持
|
||||
- [ ] 重构(写成屎山了) 🤣
|
||||
|
||||
## 😍 Screenshots
|
||||
|
||||
|
||||
@@ -93,9 +93,12 @@ const playListShow = ref(false);
|
||||
// 改变播放索引
|
||||
const changeIndex = (index) => {
|
||||
try {
|
||||
music.persistData.playSongIndex = index;
|
||||
if (music.persistData.playSongIndex !== index) {
|
||||
setSeek($player, 0);
|
||||
music.persistData.playSongIndex = index;
|
||||
music.isLoadingSong = true;
|
||||
music.setPlayState(true);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("切换失败:" + err);
|
||||
$message.error("切换失败,请刷新后重试");
|
||||
|
||||
@@ -387,7 +387,8 @@ const songChange = debounce(500, (val) => {
|
||||
window.document.title =
|
||||
sessionStorage.getItem("siteTitle") ?? import.meta.env.VITE_SITE_TITLE;
|
||||
}
|
||||
// 清除播放地址
|
||||
// 清除当前状态
|
||||
setSeek($player, 0);
|
||||
soundUnload();
|
||||
// 加载数据
|
||||
getPlaySongData(val);
|
||||
|
||||
@@ -422,6 +422,7 @@ const useMusicDataStore = defineStore("musicData", {
|
||||
) {
|
||||
console.log("播放歌曲与上一次不一致");
|
||||
// soundUnload();
|
||||
this.isLoadingSong = true;
|
||||
setSeek($player, 0);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -433,7 +434,7 @@ const useMusicDataStore = defineStore("musicData", {
|
||||
this.persistData.playlists.push(value);
|
||||
this.persistData.playSongIndex = this.persistData.playlists.length - 1;
|
||||
}
|
||||
play ? (this.playState = true) : null;
|
||||
play ? this.setPlayState(true) : null;
|
||||
},
|
||||
// 在当前播放歌曲后添加
|
||||
addSongToNext(value) {
|
||||
|
||||
Reference in New Issue
Block a user