优化下载功能的添加、删除、暂停任务时的流畅度

This commit is contained in:
lyswhut
2021-10-31 21:50:57 +08:00
parent f0f92952d6
commit e382f0dba0
6 changed files with 358 additions and 199 deletions
+8 -3
View File
@@ -148,7 +148,7 @@ export default {
},
downloadList: {
handler(n) {
this.saveDownloadList(n)
this.saveDownloadList(window.downloadListFull)
},
deep: true,
},
@@ -373,12 +373,17 @@ export default {
},
initDownloadList(downloadList) {
if (downloadList) {
downloadList.forEach(item => {
downloadList = downloadList.filter(item => item && item.key && item.musicInfo)
for (const item of downloadList) {
if (item.name == null) {
item.name = `${item.musicInfo.name} - ${item.musicInfo.singer}`
item.songmid = item.musicInfo.songmid
}
if (item.status == this.downloadStatus.RUN || item.status == this.downloadStatus.WAITING) {
item.status = this.downloadStatus.PAUSE
item.statusText = '暂停下载'
}
})
}
this.updateDownloadList(downloadList)
}
},