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

78 lines
2.1 KiB
Vue
Raw Normal View History

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