修复刷新页面后音量复原为100%的bug

This commit is contained in:
qier222 2020-10-17 23:09:42 +08:00
parent e11ad6bf46
commit b83aeda687
5 changed files with 7 additions and 11 deletions

View File

@ -117,6 +117,7 @@ import { isLoggedIn } from "@/utils/auth";
import { userLikedSongsIDs } from "@/api/user";
import { likeATrack } from "@/api/track";
import "@/assets/css/slider.css";
import { Howler } from "howler";
import ButtonIcon from "@/components/ButtonIcon.vue";
import VueSlider from "vue-slider-component";
@ -145,7 +146,7 @@ export default {
}
},
computed: {
...mapState(["player", "howler", "Howler", "settings", "liked"]),
...mapState(["player", "howler", "settings", "liked"]),
currentTrack() {
return this.player.currentTrack;
},
@ -155,7 +156,7 @@ export default {
},
set(value) {
this.updatePlayerState({ key: "volume", value });
this.Howler.volume(value);
Howler.volume(value);
},
},
playing() {

View File

@ -4,7 +4,7 @@ import state from "./state";
import mutations from "./mutations";
import actions from "./actions";
import initState from "./initState";
import { Howl } from "howler";
import { Howl, Howler } from "howler";
if (localStorage.getItem("appVersion") === null) {
localStorage.setItem("player", JSON.stringify(initState.player));
@ -36,5 +36,6 @@ store.state.howler = new Howl({
html5: true,
format: ["mp3"],
});
Howler.volume(store.state.player.volume);
export default store;

View File

@ -1,7 +1,4 @@
import { Howler } from "howler";
const initState = {
Howler: Howler,
howler: null,
liked: {
songs: [],

View File

@ -1,4 +1,4 @@
import { Howl } from "howler";
import { Howl, Howler } from "howler";
import state from "./state";
import { shuffleAList } from "@/utils/common";
@ -10,7 +10,7 @@ export default {
state.player.currentTrack = track;
},
replaceMP3(state, mp3) {
state.Howler.unload();
Howler.unload();
state.howler = new Howl({
src: [mp3],
autoplay: true,

View File

@ -1,7 +1,4 @@
import { Howler } from "howler";
export default {
Howler: Howler,
howler: null,
liked: {
songs: [],