Хранение значения preVol перед откл/вкл звука
This commit is contained in:
parent
2f9cf0307a
commit
f6834ff973
|
|
@ -55,7 +55,13 @@
|
|||
/>
|
||||
<q-skeleton v-if="loaderPlay" class="player__tools m--skeleton" />
|
||||
<div v-else class="player__volume">
|
||||
<span ref="volumeIcon" @click="toggleVolume" :class="volumeClass" />
|
||||
<span
|
||||
ref="volumeIcon"
|
||||
@click="toggleVolume"
|
||||
:class="
|
||||
songVolume == 0 ? 'player__volume-off' : 'player__volume-on'
|
||||
"
|
||||
/>
|
||||
<input
|
||||
type="range"
|
||||
min="0"
|
||||
|
|
@ -106,6 +112,8 @@ export default {
|
|||
connection: null,
|
||||
isUserMusic: !this.$store.state.currentPlay.live,
|
||||
songVolume: 0.5,
|
||||
// Локальное значение для хранения громкости перед toggleVolume
|
||||
preToggleVol: null,
|
||||
playerInfo: {
|
||||
progress: 0,
|
||||
currentTime: 0,
|
||||
|
|
@ -129,9 +137,6 @@ export default {
|
|||
loaderPlay() {
|
||||
return this.$store.state.currentPlay.isLoader;
|
||||
},
|
||||
volumeClass() {
|
||||
return this.songVolume == 0 ? 'player__volume-off' : 'player__volume-on';
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
currentPlay: {
|
||||
|
|
@ -381,10 +386,11 @@ export default {
|
|||
},
|
||||
toggleVolume() {
|
||||
if (this.songVolume === 0) {
|
||||
this.songVolume = 1;
|
||||
this.songVolume = this.preToggleVol;
|
||||
console.log(this.songVolume);
|
||||
this.$store.dispatch('handlerPlayer', { volume: this.songVolume });
|
||||
} else {
|
||||
this.preToggleVol = this.songVolume;
|
||||
this.songVolume = 0.0;
|
||||
console.log(this.songVolume);
|
||||
this.$store.dispatch('handlerPlayer', { volume: this.songVolume });
|
||||
|
|
|
|||
Loading…
Reference in New Issue