feat: using vuex to make login status reactively (#51)

This commit is contained in:
Hawtim Zhang 2020-10-24 18:55:10 +08:00 committed by GitHub
parent 5ce9c3689a
commit 780b429fa9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 110 additions and 71 deletions

View file

@ -60,7 +60,7 @@
<div></div>
</div>
<div class="actions" v-if="!isTracklist">
<button v-if="isLoggedIn" @click="likeThisSong">
<button v-if="accountLogin" @click="likeThisSong">
<svg-icon
icon-class="heart"
:style="{
@ -78,7 +78,7 @@
</template>
<script>
import { isLoggedIn } from "@/utils/auth";
import { mapState } from "vuex";
import ArtistsInLine from "@/components/ArtistsInLine.vue";
import ExplicitSymbol from "@/components/ExplicitSymbol.vue";
@ -93,6 +93,7 @@ export default {
return { focus: false, trackStyle: {} };
},
computed: {
...mapState(["accountLogin"]),
imgUrl() {
if (this.track.al !== undefined) return this.track.al.picUrl;
if (this.track.album !== undefined) return this.track.album.picUrl;
@ -127,9 +128,6 @@ export default {
if (this.isPlaying) trackClass.push("playing");
return trackClass;
},
isLoggedIn() {
return isLoggedIn();
},
},
methods: {
goToAlbum() {