41 lines
No EOL
1.3 KiB
Text
41 lines
No EOL
1.3 KiB
Text
<script type="text/x-template" id="mediaitem-artwork">
|
|
<template v-if="type == 'artists'">
|
|
<div class="mediaitem-artwork rounded">
|
|
<img :src="app.getMediaItemArtwork(url, size)"
|
|
class="mediaitem-artwork--img">
|
|
</div>
|
|
</template>
|
|
<template v-else>
|
|
<div class="mediaitem-artwork"
|
|
v-observe-visibility="{callback: visibilityChanged}">
|
|
<img :src="app.getMediaItemArtwork(url, size)" v-if="isVisible"
|
|
class="mediaitem-artwork--img">
|
|
<div v-if="video && isVisible" class="animatedartwork-view-box">
|
|
<animatedartwork-view :video="video"></animatedartwork-view>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</script>
|
|
|
|
<script>
|
|
Vue.component('mediaitem-artwork', {
|
|
template: '#mediaitem-artwork',
|
|
props: ['size', 'url', 'type', 'video'],
|
|
data: function () {
|
|
return {
|
|
isVisible: false
|
|
}
|
|
},
|
|
methods: {
|
|
getArtworkStyle() {
|
|
return {
|
|
width: this.size + 'px',
|
|
height: this.size + 'px'
|
|
};
|
|
},
|
|
visibilityChanged: function (isVisible, entry) {
|
|
this.isVisible = isVisible
|
|
}
|
|
}
|
|
});
|
|
</script> |