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

master
qier222 4 years ago
parent e11ad6bf46
commit b83aeda687

@ -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() {

@ -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;

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

@ -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,

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

Loading…
Cancel
Save