Use computed for playlist/favorite url

This commit is contained in:
An Phan 2016-10-31 14:38:59 +07:00
parent 4e1ff0fc7a
commit 23049112d1
No known key found for this signature in database
GPG key ID: 05536BB4BCDC02A2

View file

@ -1,6 +1,6 @@
<template> <template>
<li @dblclick.prevent="edit" :class="['playlist', type, editing ? 'editing' : '']"> <li @dblclick.prevent="edit" :class="['playlist', type, editing ? 'editing' : '']">
<a :href="isFavorites ? '/#!/favorites' : `/#!/playlist/${playlist.id}`" <a :href="playlistUrl"
@dragleave="removeDroppableState" @dragleave="removeDroppableState"
@dragover.prevent="allowDrop" @dragover.prevent="allowDrop"
@drop.stop.prevent="handleDrop" @drop.stop.prevent="handleDrop"
@ -44,6 +44,10 @@ export default {
isFavorites() { isFavorites() {
return this.type === 'favorites'; return this.type === 'favorites';
}, },
playlistUrl() {
return this.isFavorites ? '/#!/favorites' : `/#!/playlist/${this.playlist.id}`;
},
}, },
methods: { methods: {