From 662db2a75b127721f3a9912c375e434f16482ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Thu, 26 Oct 2023 03:18:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=E9=BB=98=E8=AE=A4=E5=9B=BE?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/music.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/music.js b/src/music.js index 73b6e71..3d97902 100644 --- a/src/music.js +++ b/src/music.js @@ -379,10 +379,9 @@ export default class MusicList { }) } } else { + const default_picture = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' this.标题.textContent = item.name - if (item.picture) { - this.封面.style.backgroundImage = `url(${item.picture})` - } + this.封面.style.backgroundImage = `url(${item.picture || default_picture})` // 替换浏览器媒体信息(使系统通知栏显示歌曲信息) if ('mediaSession' in navigator) { navigator.mediaSession.metadata = new MediaMetadata({ @@ -390,7 +389,7 @@ export default class MusicList { artist: '艺术家名', album: '专辑名', artwork: [ - { src: item.picture, sizes: '96x96', type: 'image/jpeg' }, + { src: item.picture || default_picture, sizes: '96x96', type: 'image/jpeg' }, ] }) }