refactor: move all states+actions inside player.vue to Player.js

This commit is contained in:
qier222 2021-04-25 16:53:53 +08:00
parent 5355caa4e4
commit fab0227ed3
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
6 changed files with 187 additions and 205 deletions

View file

@ -46,7 +46,7 @@ export default {
};
},
computed: {
...mapState(["showLyrics"]),
...mapState(["showLyrics", "showLibraryDefault", "player"]),
isAccountLoggedIn() {
return isAccountLoggedIn();
},
@ -62,18 +62,14 @@ export default {
);
},
enablePlayer() {
return (
this.$store.state.player.enabled &&
this.$route.name !== "lastfmCallback"
);
return this.player.enabled && this.$route.name !== "lastfmCallback";
},
showNavbar() {
return this.$route.name !== "lastfmCallback";
},
},
created() {
this.$store.state.settings.showLibraryDefault &&
this.$router.push("/library");
this.showLibraryDefault && this.$router.push("/library");
if (this.isElectron) {
ipcRenderer(this);
}
@ -85,7 +81,7 @@ export default {
if (e.target.tagName === "INPUT") return false;
if (this.$route.name === "mv") return false;
e.preventDefault();
this.$refs.player.play();
this.player.play();
}
},
},