diff --git a/src/store/index.js b/src/store/index.js index 417d6af..4db579a 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -4,13 +4,10 @@ import state from "./state"; import mutations from "./mutations"; import actions from "./actions"; import { changeAppearance } from "@/utils/common"; -import updateApp from "@/utils/updateApp"; import Player from "@/utils/Player"; // vuex 自定义插件 import saveToLocalStorage from "./plugins/localStorage"; -updateApp(); - Vue.use(Vuex); let plugins = [saveToLocalStorage]; diff --git a/src/store/initLocalStorage.js b/src/store/initLocalStorage.js index e543c66..ee16fb9 100644 --- a/src/store/initLocalStorage.js +++ b/src/store/initLocalStorage.js @@ -12,6 +12,7 @@ let localStorage = { showUnavailableSongInGreyStyle: true, automaticallyCacheSongs: false, nyancatStyle: false, + showLyricsTranslation: true, }, data: { user: {}, diff --git a/src/store/state.js b/src/store/state.js index 898bae8..9f7065c 100644 --- a/src/store/state.js +++ b/src/store/state.js @@ -1,5 +1,6 @@ import initLocalStorage from "./initLocalStorage"; import pkg from "../../package.json"; +import updateApp from "@/utils/updateApp"; if (localStorage.getItem("appVersion") === null) { localStorage.setItem("settings", JSON.stringify(initLocalStorage.settings)); @@ -7,6 +8,8 @@ if (localStorage.getItem("appVersion") === null) { localStorage.setItem("appVersion", pkg.version); } +updateApp(); + export default { showLyrics: false, liked: { diff --git a/src/utils/updateApp.js b/src/utils/updateApp.js index cadbef3..ebbeeff 100644 --- a/src/utils/updateApp.js +++ b/src/utils/updateApp.js @@ -3,13 +3,19 @@ import pkg from "../../package.json"; const updateSetting = () => { const parsedSettings = JSON.parse(localStorage.getItem("settings")); + const { + playlistCategories, + showUnavailableSongInGreyStyle, + automaticallyCacheSongs, + nyancatStyle, + showLyricsTranslation, + } = initLocalStorage.settings; const settings = { - playlistCategories: initLocalStorage?.settings?.playlistCategories, - showUnavailableSongInGreyStyle: - initLocalStorage?.settings?.showUnavailableSongInGreyStyle, - automaticallyCacheSongs: - initLocalStorage?.settings?.automaticallyCacheSongs, - nyancatStyle: initLocalStorage?.settings?.nyancatStyle, + playlistCategories, + showUnavailableSongInGreyStyle, + automaticallyCacheSongs, + nyancatStyle, + showLyricsTranslation, ...parsedSettings, }; diff --git a/src/views/lyrics.vue b/src/views/lyrics.vue index 9241e00..9bb55fd 100644 --- a/src/views/lyrics.vue +++ b/src/views/lyrics.vue @@ -134,6 +134,7 @@ " > + v-html="formatLine(line)"
+