+ :class="player.isPlaying ? 'pause' : 'play'"
+ @click="togglePlay" />
@@ -120,7 +124,7 @@ export default {
}
.volume{
- width: 170px;
+ width: 165px;
display: inline-block;
position: relative;
left: 40px;
diff --git a/src/router.js b/src/router.js
index 53ca4fa..63e0081 100644
--- a/src/router.js
+++ b/src/router.js
@@ -21,9 +21,9 @@ export default new Router({
name: 'TOP',
},
{
- path: '/recent',
+ path: '/new',
component: Main,
- name: 'RECENT',
+ name: 'NEW',
},
{
path: '/favorites',
diff --git a/src/store.js b/src/store.js
index 2a54d86..78b1528 100644
--- a/src/store.js
+++ b/src/store.js
@@ -30,6 +30,14 @@ export default new Vuex.Store({
state.player.volume = 0
}
},
+ togglePlay(state) {
+ console.log('toggle play')
+ if (state.player.isPlaying) {
+ state.player.isPlaying = false
+ } else {
+ state.player.isPlaying = true
+ }
+ },
},
actions: {
isPlaying(context, playerState) {
@@ -42,7 +50,10 @@ export default new Vuex.Store({
context.commit('changeVolume', volume)
},
toggleMute(context) {
- context.toggleMute()
+ context.commit('toggleMute')
+ },
+ togglePlay(context) {
+ context.commit('togglePlay')
},
},
})