[web-src] Refactor ListItemAlbum to be a functional component

This should improve performance of long album lists.
This commit is contained in:
chme
2018-12-16 09:17:43 +01:00
parent 6cd714a4f8
commit 382036687a
9 changed files with 68 additions and 46 deletions

View File

@@ -1,8 +1,8 @@
<template>
<div class="media" :id="'index_' + anchor">
<div class="media-content fd-has-action is-clipped" v-on:click="open_album">
<h1 class="title is-6">{{ album.name }}</h1>
<h2 class="subtitle is-7 has-text-grey"><b>{{ album.artist }}</b></h2>
<template functional>
<div class="media" :id="'index_' + props.anchor">
<div class="media-content fd-has-action is-clipped" @click="listeners.click">
<h1 class="title is-6">{{ props.album.name }}</h1>
<h2 class="subtitle is-7 has-text-grey"><b>{{ props.album.artist }}</b></h2>
</div>
<div class="media-right">
<slot name="actions"></slot>
@@ -13,28 +13,7 @@
<script>
export default {
name: 'ListItemAlbum',
components: {},
props: ['album', 'media_kind', 'anchor'],
data () {
return {
show_details_modal: false
}
},
methods: {
open_album: function () {
this.show_details_modal = false
if (this.media_kind === 'podcast') {
this.$router.push({ path: '/podcasts/' + this.album.id })
} else if (this.media_kind === 'audiobook') {
this.$router.push({ path: '/audiobooks/' + this.album.id })
} else {
this.$router.push({ path: '/music/albums/' + this.album.id })
}
}
}
props: ['album', 'media_kind', 'anchor']
}
</script>