Commit a8ff6604 authored by thatanimeweirdo's avatar thatanimeweirdo

Merge branch 'lazyload' into 'vue-rewrite'

Lazyload

See merge request !38
parents 0306b090 50a8efdb
{ {
"name": "spinshare-client", "name": "spinshare-client",
"version": "2.0.0", "version": "2.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
...@@ -13321,6 +13321,11 @@ ...@@ -13321,6 +13321,11 @@
} }
} }
}, },
"vue-observe-visibility": {
"version": "0.4.6",
"resolved": "https://registry.npmjs.org/vue-observe-visibility/-/vue-observe-visibility-0.4.6.tgz",
"integrity": "sha512-xo0CEVdkjSjhJoDdLSvoZoQrw/H2BlzB5jrCBKGZNXN2zdZgMuZ9BKrxXDjNP2AxlcCoKc8OahI3F3r3JGLv2Q=="
},
"vue-router": { "vue-router": {
"version": "3.1.6", "version": "3.1.6",
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.1.6.tgz", "resolved": "https://registry.npmjs.org/vue-router/-/vue-router-3.1.6.tgz",
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-axios": "^2.1.5", "vue-axios": "^2.1.5",
"vue-i18n": "^8.17.4", "vue-i18n": "^8.17.4",
"vue-observe-visibility": "^0.4.6",
"vue-router": "^3.1.6", "vue-router": "^3.1.6",
"vuex": "^3.1.3" "vuex": "^3.1.3"
}, },
......
<template> <template>
<div :class="'song-item-local ' + (isSpinShare ? '' : 'song-item-onlylocal')" v-on:contextmenu="showContextMenu($event)" v-on:click="openOnSpinShare()"> <div :class="'song-item-local ' + (isSpinShare ? '' : 'song-item-onlylocal')" v-on:contextmenu="showContextMenu($event)" v-on:click="openOnSpinShare()">
<div class="song-cover" :style="'background-image: url(' + cover + '), url(' + require('@/assets/img/defaultAlbumArt.jpg') + ');'"> <div class="song-cover" v-bind:style="'background-image: '+ backgroundImage +' , url(' + require('@/assets/img/defaultAlbumArt.jpg') + ');'" v-observe-visibility="visibilityChanged">
<div class="song-charter-info"> <div class="song-charter-info">
<div class="song-charter"><i class="mdi mdi-account-circle"></i><span>{{ detail.charter ? detail.charter : "Unknown" }}</span></div> <div class="song-charter"><i class="mdi mdi-account-circle"></i><span>{{ detail.charter ? detail.charter : "Unknown" }}</span></div>
</div> </div>
...@@ -28,7 +28,13 @@ ...@@ -28,7 +28,13 @@
], ],
data: function() { data: function() {
return { return {
isContextMenuActive: false isContextMenuActive: false,
backgroundImage: "none;"
}
},
computed: {
imageUrl() {
return this.$data.backgroundImage
} }
}, },
mounted: function() { mounted: function() {
...@@ -59,6 +65,15 @@ ...@@ -59,6 +65,15 @@
}, },
openInExplorer: function() { openInExplorer: function() {
shell.showItemInFolder(path.normalize(this.file)); shell.showItemInFolder(path.normalize(this.file));
},
visibilityChanged (isVisible, entry) {
if (isVisible) {
this.$data.backgroundImage = "url(" + this.$props.cover + ")"
}
//url(" + require('@/assets/img/defaultAlbumArt.jpg') + ");
else {
this.$data.backgroundImage = "none;"
}
} }
} }
} }
......
...@@ -5,9 +5,13 @@ import store from './store'; ...@@ -5,9 +5,13 @@ import store from './store';
import i18n from './i18n'; import i18n from './i18n';
import moment from 'moment' import moment from 'moment'
import { ipcRenderer } from 'electron'; import { ipcRenderer } from 'electron';
import VueObserveVisibility from 'vue-observe-visibility'
Vue.use(VueObserveVisibility);
Vue.config.productionTip = false; Vue.config.productionTip = false;
Vue.filter('formatDate', function(value) { Vue.filter('formatDate', function(value) {
if (value && !String(value).includes("-0001")) { if (value && !String(value).includes("-0001")) {
return moment(String(value)).format(i18n.t('locale.dateFormat')) return moment(String(value)).format(i18n.t('locale.dateFormat'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment