Refresh previews on data change
parent
2662225f0f
commit
89f044f125
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -41,6 +41,18 @@ export default {
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
this.refreshPreviews();
|
||||
},
|
||||
watch: {
|
||||
data: {
|
||||
handler() {
|
||||
this.refreshPreviews();
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/** Refresh previews */
|
||||
refreshPreviews() {
|
||||
if (!this.data.previewFileInfos) {
|
||||
const folderPath = this.data.path.split('/').slice(3).join('/');
|
||||
dav.getFolderPreviewFileIds(folderPath, 4).then(fileInfos => {
|
||||
|
@ -52,13 +64,13 @@ export default {
|
|||
this.previewFileInfos = fileInfos;
|
||||
}).catch(() => {
|
||||
this.data.previewFileInfos = [];
|
||||
this.previewFileInfos = [];
|
||||
});
|
||||
} else {
|
||||
this.previewFileInfos = this.data.previewFileInfos;
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
/** Open album folder */
|
||||
openFolder(id) {
|
||||
this.$router.push({ name: 'albums', params: { id } });
|
||||
|
|
Loading…
Reference in New Issue