fix: visible music-icon placeholder when media has no cover

This commit is contained in:
2026-08-17 12:48:03 +08:00
parent d1d903278e
commit 17d573e589
2 changed files with 11 additions and 2 deletions
+10 -1
View File
@@ -249,7 +249,16 @@ body {
}
.media-card .cover-ph {
background: linear-gradient(135deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, .05));
background: linear-gradient(135deg, var(--accent), rgba(255, 157, 0, .6));
display: flex;
align-items: center;
justify-content: center;
color: #fff;
}
.media-card .cover-ph svg {
width: 40%;
height: 40%;
}
.media-card.wide .cover {
+1 -1
View File
@@ -180,7 +180,7 @@ function renderMediaCard(info) {
el.className = 'card media-card';
const coverHtml = info.cover
? `<img class="cover" src="${info.cover}" alt="">`
: '<div class="cover cover-ph"></div>';
: '<div class="cover cover-ph"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18V6l12-2v12"/><circle cx="6" cy="18" r="3"/><circle cx="18" cy="16" r="3"/></svg></div>';
const playIcon = info.playing ? ICON_PAUSE : ICON_PLAY;
// title/artist 来自任意应用元数据,转义后插入,防 XSS
// title/artist come from arbitrary app metadata; escape before insert (XSS)