mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 13:17:46 +00:00
refactor: update context menu style
This commit is contained in:
parent
d828ee79e9
commit
3788f4ae38
3 changed files with 97 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="context-menu">
|
<div class="context-menu" ref="contextMenu">
|
||||||
<div
|
<div
|
||||||
class="menu"
|
class="menu"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
|
|
@ -37,6 +37,7 @@ export default {
|
||||||
|
|
||||||
closeMenu() {
|
closeMenu() {
|
||||||
this.showMenu = false;
|
this.showMenu = false;
|
||||||
|
this.$parent.closeMenu();
|
||||||
},
|
},
|
||||||
|
|
||||||
openMenu(e) {
|
openMenu(e) {
|
||||||
|
|
@ -62,10 +63,11 @@ export default {
|
||||||
.menu {
|
.menu {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
min-width: 136px;
|
min-width: 136px;
|
||||||
|
max-width: 240px;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
background: rgba(255, 255, 255, 0.88);
|
background: rgba(255, 255, 255, 0.88);
|
||||||
box-shadow: 0 6px 12px -4px rgba(0, 0, 0, 0.08);
|
box-shadow: 0 6px 12px -4px rgba(0, 0, 0, 0.08);
|
||||||
border: 1px solid rgba(0, 0, 0, 0.04);
|
border: 1px solid rgba(0, 0, 0, 0.06);
|
||||||
backdrop-filter: blur(12px);
|
backdrop-filter: blur(12px);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
@ -77,15 +79,65 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[data-theme="dark"] {
|
||||||
|
.menu {
|
||||||
|
background: rgba(46, 46, 46, 0.68);
|
||||||
|
backdrop-filter: blur(16px) contrast(120%);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.menu .item {
|
.menu .item {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
padding: 10px 14px;
|
padding: 10px 14px;
|
||||||
border-radius: 7px;
|
border-radius: 7px;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
color: var(--color-text);
|
||||||
&:hover {
|
&:hover {
|
||||||
background: #eaeffd;
|
background: var(--color-primary-bg);
|
||||||
color: #335eea;
|
color: var(--color-primary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
margin: 4px 10px;
|
||||||
|
background: rgba(128, 128, 128, 0.18);
|
||||||
|
height: 1px;
|
||||||
|
box-shadow: none;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-info {
|
||||||
|
padding: 10px 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
color: var(--color-text);
|
||||||
|
cursor: default;
|
||||||
|
img {
|
||||||
|
height: 38px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
.subtitle {
|
||||||
|
font-size: 12px;
|
||||||
|
opacity: 0.68;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
-webkit-line-clamp: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="track-list" :style="listStyles">
|
<div class="track-list" :style="listStyles">
|
||||||
<ContextMenu ref="menu">
|
<ContextMenu ref="menu">
|
||||||
|
<div class="item-info">
|
||||||
|
<img :src="rightClickedTrack.al.picUrl | resizeImage(512)" />
|
||||||
|
<div class="info">
|
||||||
|
<div class="title">{{ rightClickedTrack.name }}</div>
|
||||||
|
<div class="subtitle">{{ rightClickedTrack.ar[0].name }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<hr />
|
||||||
<div class="item" @click="play">Play</div>
|
<div class="item" @click="play">Play</div>
|
||||||
<div class="item" @click="playNext">Play Next</div>
|
<div class="item" @click="playNext">Play Next</div>
|
||||||
<div
|
<div
|
||||||
|
|
@ -63,7 +71,12 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
rightClickedTrack: null,
|
rightClickedTrack: {
|
||||||
|
id: 0,
|
||||||
|
name: "",
|
||||||
|
ar: [{ name: "" }],
|
||||||
|
al: { picUrl: "" },
|
||||||
|
},
|
||||||
listStyles: {},
|
listStyles: {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
@ -90,6 +103,14 @@ export default {
|
||||||
this.rightClickedTrack = track;
|
this.rightClickedTrack = track;
|
||||||
this.$refs.menu.openMenu(e);
|
this.$refs.menu.openMenu(e);
|
||||||
},
|
},
|
||||||
|
closeMenu() {
|
||||||
|
this.rightClickedTrack = {
|
||||||
|
id: 0,
|
||||||
|
name: "",
|
||||||
|
ar: [{ name: "" }],
|
||||||
|
al: { picUrl: "" },
|
||||||
|
};
|
||||||
|
},
|
||||||
playThisList(trackID) {
|
playThisList(trackID) {
|
||||||
if (this.dbclickTrackFunc === "default") {
|
if (this.dbclickTrackFunc === "default") {
|
||||||
this.playThisListDefault(trackID);
|
this.playThisListDefault(trackID);
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
:class="trackClass"
|
:class="trackClass"
|
||||||
:style="trackStyle"
|
:style="trackStyle"
|
||||||
:title="track.reason"
|
:title="track.reason"
|
||||||
@mouseover="focus = true"
|
@mouseover="hover = true"
|
||||||
@mouseleave="focus = false"
|
@mouseleave="hover = false"
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
:src="imgUrl | resizeImage(224)"
|
:src="imgUrl | resizeImage(224)"
|
||||||
|
|
@ -90,7 +90,7 @@ export default {
|
||||||
track: Object,
|
track: Object,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return { focus: false, trackStyle: {} };
|
return { hover: false, trackStyle: {} };
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
imgUrl() {
|
imgUrl() {
|
||||||
|
|
@ -125,11 +125,21 @@ export default {
|
||||||
let trackClass = [this.type];
|
let trackClass = [this.type];
|
||||||
if (!this.track.playable) trackClass.push("disable");
|
if (!this.track.playable) trackClass.push("disable");
|
||||||
if (this.isPlaying) trackClass.push("playing");
|
if (this.isPlaying) trackClass.push("playing");
|
||||||
|
if (this.focus) trackClass.push("focus");
|
||||||
return trackClass;
|
return trackClass;
|
||||||
},
|
},
|
||||||
accountLogin() {
|
accountLogin() {
|
||||||
return isAccountLoggedIn();
|
return isAccountLoggedIn();
|
||||||
},
|
},
|
||||||
|
isMenuOpened() {
|
||||||
|
return this.$parent.rightClickedTrack.id === this.track.id ? true : false;
|
||||||
|
},
|
||||||
|
focus() {
|
||||||
|
return (
|
||||||
|
(this.hover && this.$parent.rightClickedTrack.id === 0) ||
|
||||||
|
this.isMenuOpened
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goToAlbum() {
|
goToAlbum() {
|
||||||
|
|
@ -285,11 +295,13 @@ button {
|
||||||
opacity: 0.88;
|
opacity: 0.88;
|
||||||
color: var(--color-text);
|
color: var(--color-text);
|
||||||
}
|
}
|
||||||
&:hover {
|
|
||||||
transition: all 0.3s;
|
|
||||||
background: var(--color-secondary-bg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.track.focus {
|
||||||
|
transition: all 0.3s;
|
||||||
|
background: var(--color-secondary-bg);
|
||||||
|
}
|
||||||
|
|
||||||
.track.disable {
|
.track.disable {
|
||||||
img {
|
img {
|
||||||
filter: grayscale(1) opacity(0.6);
|
filter: grayscale(1) opacity(0.6);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue