Properly activate a playlist after creation

This commit is contained in:
An Phan 2016-04-01 15:10:02 +08:00
parent 1344d23465
commit ec6cd1bb08
3 changed files with 13 additions and 3 deletions

View file

@ -155,6 +155,7 @@
if (view === 'favorites') {
this.active = this.isFavorites;
} else if (view === 'playlist') {
console.log(playlist.id, this.playlist.id);
this.active = this.playlist === playlist;
} else {
this.active = false;

View file

@ -29,6 +29,8 @@
</template>
<script>
import { last } from 'lodash';
import playlistStore from '../../../stores/playlist';
import favoriteStore from '../../../stores/favorite';
@ -55,7 +57,12 @@
store() {
this.creating = false;
playlistStore.store(this.newName, [], () => this.newName = '');
playlistStore.store(this.newName, [], () => {
this.newName = '';
this.$nextTick(() => {
this.$root.loadPlaylist(last(this.playlistState.playlists));
});
});
},
},
};

View file

@ -69,8 +69,10 @@
playlistStore.store(this.newPlaylistName, this.songs, () => {
this.newPlaylistName = '';
// Activate the new playlist right away
this.$root.loadPlaylist(last(this.playlistState.playlists));
this.$nextTick(() => {
// Activate the new playlist right away
this.$root.loadPlaylist(last(this.playlistState.playlists));
});
});
this.close();