From b68826d59076f73ce05f2042736ef83140b0e2f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Sun, 1 Oct 2023 04:04:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=81=E8=AE=B8=E7=A7=BB=E9=99=A4ID=E7=BA=AF?= =?UTF-8?q?=E6=95=B0=E5=AD=97=E7=9A=84=E9=9F=B3=E4=B9=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/music.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/music.js b/public/music.js index 5dac08e..378a17b 100644 --- a/public/music.js +++ b/public/music.js @@ -121,7 +121,8 @@ export default class MusicList { } } remove(item) { - this.ul.removeChild(this.ul.querySelector(`#${item.id}`)) + const el = this.ul.querySelector(`#${item.id}`) + if (el) this.ul.removeChild() this.stop() // 停止播放 // 执行回调函数 if (this.EventListeners['remove']) {