koel/resources/assets/js/components/main-wrapper/main-content/artists.vue

78 lines
1.6 KiB
Vue
Raw Normal View History

2015-12-13 04:42:28 +00:00
<template>
2016-06-25 16:05:24 +00:00
<section id="artistsWrapper">
<h1 class="heading">
<span>Artists</span>
2016-10-31 04:28:12 +00:00
<view-mode-switch :mode="viewMode" for="artists"/>
2016-06-25 16:05:24 +00:00
</h1>
<div class="artists main-scroll-wrap" :class="'as-'+viewMode" @scroll="scrolling">
2016-10-31 04:28:12 +00:00
<artist-item v-for="item in displayedItems" :artist="item"/>
<span class="item filler" v-for="n in 6"/>
<to-top-button/>
2016-06-25 16:05:24 +00:00
</div>
</section>
2015-12-13 04:42:28 +00:00
</template>
<script>
2016-11-26 03:25:35 +00:00
import { filterBy, limitBy, event } from '../../../utils'
import { artistStore } from '../../../stores'
2016-06-25 10:15:57 +00:00
2016-11-26 03:25:35 +00:00
import artistItem from '../../shared/artist-item.vue'
import viewModeSwitch from '../../shared/view-mode-switch.vue'
import infiniteScroll from '../../../mixins/infinite-scroll'
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
export default {
mixins: [infiniteScroll],
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
components: { artistItem, viewModeSwitch },
2015-12-13 04:42:28 +00:00
2016-11-26 03:25:35 +00:00
data () {
2016-06-25 16:05:24 +00:00
return {
perPage: 9,
numOfItems: 9,
q: '',
2016-11-26 03:25:35 +00:00
viewMode: null
}
2016-06-25 16:05:24 +00:00
},
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
computed: {
2016-11-26 03:25:35 +00:00
displayedItems () {
2016-06-25 16:05:24 +00:00
return limitBy(
filterBy(artistStore.all, this.q, 'name'),
this.numOfItems
2016-11-26 03:25:35 +00:00
)
}
2016-06-25 16:05:24 +00:00
},
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
methods: {
2016-11-26 03:25:35 +00:00
changeViewMode (mode) {
this.viewMode = mode
}
2016-06-25 16:05:24 +00:00
},
2015-12-30 04:14:47 +00:00
2016-11-26 03:25:35 +00:00
created () {
2016-06-25 16:05:24 +00:00
event.on({
/**
* When the application is ready, load the first batch of items.
*/
'koel:ready': () => this.displayMore(),
2016-01-07 06:15:25 +00:00
2016-11-26 03:25:35 +00:00
'filter:changed': q => {
this.q = q
}
})
}
}
2015-12-13 04:42:28 +00:00
</script>
<style lang="sass">
2016-06-25 16:05:24 +00:00
@import "../../../../sass/partials/_vars.scss";
@import "../../../../sass/partials/_mixins.scss";
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
#artistsWrapper {
.artists {
@include artist-album-wrapper();
}
}
2015-12-13 04:42:28 +00:00
</style>