diff options
author | Zero~Informatique | 2020-06-19 22:12:03 +0200 |
---|---|---|
committer | Zero~Informatique | 2020-06-19 22:12:03 +0200 |
commit | 69dc0d20706ed41e5ecdbb77515066d8a7d7703b (patch) | |
tree | 8b69fcb1d4a96290134980e75281563f8b4c271e /viewer/src/components/LdDownload.vue | |
parent | a053076d692be5e3698fe1a2c071d077cb4b6b73 (diff) | |
download | ldgallery-69dc0d20706ed41e5ecdbb77515066d8a7d7703b.tar.gz |
viewer: code update (no functional change)
Types { [x: T]: R } updated to Record<T, R>
Methods in template updated to getters (computed in VueJS), which are reactive and cached
Code formatting
Diffstat (limited to 'viewer/src/components/LdDownload.vue')
-rw-r--r-- | viewer/src/components/LdDownload.vue | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/viewer/src/components/LdDownload.vue b/viewer/src/components/LdDownload.vue index d7dfb7d..7b09dab 100644 --- a/viewer/src/components/LdDownload.vue +++ b/viewer/src/components/LdDownload.vue | |||
@@ -20,10 +20,10 @@ | |||
20 | 20 | ||
21 | <template> | 21 | <template> |
22 | <div class="container-vh-centering"> | 22 | <div class="container-vh-centering"> |
23 | <a :class="$style.content" :download="itemFileName()" :href="itemDownloadUrl()"> | 23 | <a :class="$style.content" :download="itemFileName" :href="itemDownloadUrl"> |
24 | <!-- TODO: show thumbnail instead of this generic file download icon? --> | 24 | <!-- TODO: show thumbnail instead of this generic file download icon? --> |
25 | <fa-icon :class="$style.icon" icon="file-download" size="6x" /> | 25 | <fa-icon :class="$style.icon" icon="file-download" size="6x" /> |
26 | <div>{{ $t("download.download-file-fmt", [itemFileName()]) }}</div> | 26 | <div>{{ $t("download.download-file-fmt", [itemFileName]) }}</div> |
27 | </a> | 27 | </a> |
28 | </div> | 28 | </div> |
29 | </template> | 29 | </template> |
@@ -32,14 +32,15 @@ | |||
32 | import { Component, Prop, Vue } from "vue-property-decorator"; | 32 | import { Component, Prop, Vue } from "vue-property-decorator"; |
33 | import Navigation from "@/services/navigation"; | 33 | import Navigation from "@/services/navigation"; |
34 | 34 | ||
35 | @Component export default class LdDownload extends Vue { | 35 | @Component |
36 | export default class LdDownload extends Vue { | ||
36 | @Prop({ required: true }) readonly item!: Gallery.Other; | 37 | @Prop({ required: true }) readonly item!: Gallery.Other; |
37 | 38 | ||
38 | itemFileName(): string { | 39 | get itemFileName(): string { |
39 | return Navigation.getFileName(this.item); | 40 | return Navigation.getFileName(this.item); |
40 | } | 41 | } |
41 | 42 | ||
42 | itemDownloadUrl(): string { | 43 | get itemDownloadUrl(): string { |
43 | return this.$galleryStore.resourceRoot + this.item.properties.resource; | 44 | return this.$galleryStore.resourceRoot + this.item.properties.resource; |
44 | } | 45 | } |
45 | } | 46 | } |