feat: Add "Volume Control" to Lyrics Page (#1672)

* feat: Add "Volume Control" to Lyrics Page

* fix: fix mute button
master
marcus 2 years ago committed by GitHub
parent a31d552788
commit 7b911c1658
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -76,6 +76,29 @@
</span> </span>
</div> </div>
</div> </div>
<div class="top-right">
<div class="volume-control">
<button-icon :title="$t('player.mute')" @click.native="mute">
<svg-icon v-show="volume > 0.5" icon-class="volume" />
<svg-icon v-show="volume === 0" icon-class="volume-mute" />
<svg-icon
v-show="volume <= 0.5 && volume !== 0"
icon-class="volume-half"
/>
</button-icon>
<div class="volume-bar">
<vue-slider
v-model="volume"
:min="0"
:max="1"
:interval="0.01"
:drag-on-click="true"
:duration="0"
tooltip="none"
:dot-size="12"
></vue-slider>
</div>
</div>
<div class="buttons"> <div class="buttons">
<button-icon <button-icon
:title="$t('player.like')" :title="$t('player.like')"
@ -98,6 +121,7 @@
/></button-icon> --> /></button-icon> -->
</div> </div>
</div> </div>
</div>
<div class="progress-bar"> <div class="progress-bar">
<span>{{ formatTrackTime(player.progress) || '0:00' }}</span> <span>{{ formatTrackTime(player.progress) || '0:00' }}</span>
<div class="slider"> <div class="slider">
@ -260,6 +284,14 @@ export default {
currentTrack() { currentTrack() {
return this.player.currentTrack; return this.player.currentTrack;
}, },
volume: {
get() {
return this.player.volume;
},
set(value) {
this.player.volume = value;
},
},
imageUrl() { imageUrl() {
return this.player.currentTrack?.al?.picUrl + '?param=1024y1024'; return this.player.currentTrack?.al?.picUrl + '?param=1024y1024';
}, },
@ -474,6 +506,9 @@ export default {
getListPath() { getListPath() {
return getListSourcePath(); return getListSourcePath();
}, },
mute() {
this.player.mute();
},
}, },
}; };
</script> </script>
@ -591,6 +626,19 @@ export default {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.top-right {
display: flex;
justify-content: space-between;
.volume-control {
margin: 0 10px;
display: flex;
align-items: center;
.volume-bar {
width: 84px;
}
}
.buttons { .buttons {
display: flex; display: flex;
align-items: center; align-items: center;
@ -605,6 +653,7 @@ export default {
} }
} }
} }
}
.progress-bar { .progress-bar {
margin-top: 22px; margin-top: 22px;

Loading…
Cancel
Save