Skip to content

Commit

Permalink
fix: 切换歌曲时高亮异常
Browse files Browse the repository at this point in the history
  • Loading branch information
zonemeen committed Mar 12, 2024
1 parent e3f17bc commit ae28724
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions template/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@
player: null,
controller: null,
activeId: '',
isInitial: true,
}
},
beforeDestroy() {
this.player.destroy()
},
created() {
let isInitial = true
this.controller = new AbortController()
this.player = new APlayer({
container: document.getElementById('aplayer'),
Expand All @@ -125,8 +125,8 @@
audio: [],
})
this.player.on('listswitch', ({ index }) => {
if (isInitial) {
isInitial = false
if (this.isInitial) {
this.isInitial = false
return
}
this.activeId = this.player.list.audios[index].id
Expand Down Expand Up @@ -173,6 +173,7 @@
this.controller = new AbortController()
}
this.activeId = ''
this.isInitial = true
this.downloadLoadingList = []
this.params.pageNum = current ?? 1
this.pagination.current = current ?? 1
Expand Down

0 comments on commit ae28724

Please sign in to comment.