2018-10-26 11:17:18 -04:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<tabs-music></tabs-music>
|
|
|
|
|
|
|
|
<content-with-heading>
|
2018-12-08 02:48:15 -05:00
|
|
|
<template slot="options">
|
|
|
|
<index-button-list :index="index_list"></index-button-list>
|
|
|
|
</template>
|
2018-10-26 11:17:18 -04:00
|
|
|
<template slot="heading-left">
|
|
|
|
<p class="title is-4">Genres</p>
|
|
|
|
<p class="heading">{{ genres.total }} genres</p>
|
|
|
|
</template>
|
|
|
|
<template slot="content">
|
2018-12-08 02:48:15 -05:00
|
|
|
<list-item-genre v-for="(genre, index) in genres.items" :key="genre.name" :genre="genre" :anchor="anchor(genre, index)"></list-item-genre>
|
2018-10-26 11:17:18 -04:00
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { LoadDataBeforeEnterMixin } from './mixin'
|
|
|
|
import ContentWithHeading from '@/templates/ContentWithHeading'
|
|
|
|
import TabsMusic from '@/components/TabsMusic'
|
2018-12-08 02:48:15 -05:00
|
|
|
import IndexButtonList from '@/components/IndexButtonList'
|
2018-10-26 11:17:18 -04:00
|
|
|
import ListItemGenre from '@/components/ListItemGenre'
|
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
const genresData = {
|
|
|
|
load: function (to) {
|
|
|
|
return webapi.library_genres()
|
|
|
|
},
|
|
|
|
|
|
|
|
set: function (vm, response) {
|
|
|
|
vm.genres = response.data
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PageGenres',
|
|
|
|
mixins: [ LoadDataBeforeEnterMixin(genresData) ],
|
2018-12-08 02:48:15 -05:00
|
|
|
components: { ContentWithHeading, TabsMusic, IndexButtonList, ListItemGenre },
|
2018-10-26 11:17:18 -04:00
|
|
|
|
|
|
|
data () {
|
|
|
|
return {
|
2018-12-08 02:48:15 -05:00
|
|
|
genres: { items: [] }
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
index_list () {
|
|
|
|
return [...new Set(this.genres.items
|
|
|
|
.map(genre => genre.name.charAt(0).toUpperCase()))]
|
2018-10-26 11:17:18 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2018-12-08 02:48:15 -05:00
|
|
|
anchor: function (genre, index) {
|
|
|
|
return genre.name.charAt(0).toUpperCase()
|
|
|
|
}
|
2018-10-26 11:17:18 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|