合并按钮

This commit is contained in:
2023-10-01 03:42:12 +08:00
parent cbbf007da1
commit f0544c3148
1 changed files with 17 additions and 9 deletions

View File

@ -89,14 +89,15 @@ export default class MusicList {
innerText: '播放', innerText: '播放',
onclick: event => { onclick: event => {
event.stopPropagation() event.stopPropagation()
this.play(item) if (event.target.dataset.play === 'play') {
} event.target.dataset.play = 'stop'
}), event.target.innerText = '播放'
Button({ this.stop()
innerText: '停止', } else {
onclick: event => { event.target.dataset.play = 'play'
event.stopPropagation() event.target.innerText = '停止'
this.stop(item.id) this.play(item)
}
} }
}), }),
Button({ Button({
@ -117,7 +118,14 @@ export default class MusicList {
innerText: '禁止', innerText: '禁止',
onclick: event => { onclick: event => {
event.stopPropagation() event.stopPropagation()
// BAN if (event.target.dataset.ban === 'ban') {
event.target.dataset.ban = 'unban'
event.target.innerText = '禁止'
} else {
event.target.dataset.ban = 'ban'
event.target.innerText = '解禁'
this.stop()
}
} }
}) })
] ]