From b83aeda687b0f7bd8e38d56767a4e58d7ec7bae8 Mon Sep 17 00:00:00 2001 From: qier222 <68148142+qier222@users.noreply.github.com> Date: Sat, 17 Oct 2020 23:09:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=B7=E6=96=B0=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=90=8E=E9=9F=B3=E9=87=8F=E5=A4=8D=E5=8E=9F=E4=B8=BA?= =?UTF-8?q?100%=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Player.vue | 5 +++-- src/store/index.js | 3 ++- src/store/initState.js | 3 --- src/store/mutations.js | 4 ++-- src/store/state.js | 3 --- 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/components/Player.vue b/src/components/Player.vue index c28eaa9..6065fdd 100644 --- a/src/components/Player.vue +++ b/src/components/Player.vue @@ -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() { diff --git a/src/store/index.js b/src/store/index.js index 7de0a21..836ebcb 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -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; diff --git a/src/store/initState.js b/src/store/initState.js index 785731a..bdec04f 100644 --- a/src/store/initState.js +++ b/src/store/initState.js @@ -1,7 +1,4 @@ -import { Howler } from "howler"; - const initState = { - Howler: Howler, howler: null, liked: { songs: [], diff --git a/src/store/mutations.js b/src/store/mutations.js index 1965dc0..7953f81 100644 --- a/src/store/mutations.js +++ b/src/store/mutations.js @@ -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, diff --git a/src/store/state.js b/src/store/state.js index 2a3e1cd..d2d5dfd 100644 --- a/src/store/state.js +++ b/src/store/state.js @@ -1,7 +1,4 @@ -import { Howler } from "howler"; - export default { - Howler: Howler, howler: null, liked: { songs: [],