按钮功能合并
This commit is contained in:
parent
6b986de6d6
commit
0fc8dc3f67
@ -97,18 +97,19 @@ export default class MusicList {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
Button({
|
Button({
|
||||||
innerText: '移除',
|
innerText: item.arrayBuffer ? '移除' : '喜欢',
|
||||||
onclick: event => {
|
onclick: event => {
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
if (item.arrayBuffer) {
|
||||||
|
event.target.innerText = '喜欢'
|
||||||
|
this.unlike(item)
|
||||||
this.remove(item)
|
this.remove(item)
|
||||||
}
|
} else {
|
||||||
}),
|
event.target.innerText = '移除'
|
||||||
Button({
|
this.ul.querySelector(`#${item.id}`).classList.add('cache')
|
||||||
innerText: '喜欢',
|
|
||||||
onclick: event => {
|
|
||||||
event.stopPropagation()
|
|
||||||
this.like(item)
|
this.like(item)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
Button({
|
Button({
|
||||||
innerText: '禁止',
|
innerText: '禁止',
|
||||||
@ -130,7 +131,7 @@ export default class MusicList {
|
|||||||
}
|
}
|
||||||
async remove(item) {
|
async remove(item) {
|
||||||
this.ul.querySelector(`#${item.id}`)?.remove()
|
this.ul.querySelector(`#${item.id}`)?.remove()
|
||||||
this.stop() // 停止播放
|
if (this.playing) this.stop() // 停止播放
|
||||||
this.event.onremove(item)
|
this.event.onremove(item)
|
||||||
}
|
}
|
||||||
async load(item) {
|
async load(item) {
|
||||||
@ -149,6 +150,7 @@ export default class MusicList {
|
|||||||
this.audio.pause()
|
this.audio.pause()
|
||||||
this.audio.src = ''
|
this.audio.src = ''
|
||||||
this.event.onstop(this.playing)
|
this.event.onstop(this.playing)
|
||||||
|
this.playing = null
|
||||||
}
|
}
|
||||||
async like(item) {
|
async like(item) {
|
||||||
if (!item.arrayBuffer) {
|
if (!item.arrayBuffer) {
|
||||||
|
Loading…
Reference in New Issue
Block a user