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/LdThumbnail.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/LdThumbnail.vue')
-rw-r--r-- | viewer/src/components/LdThumbnail.vue | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/viewer/src/components/LdThumbnail.vue b/viewer/src/components/LdThumbnail.vue index bfcc595..0ddeb6b 100644 --- a/viewer/src/components/LdThumbnail.vue +++ b/viewer/src/components/LdThumbnail.vue | |||
@@ -22,14 +22,14 @@ | |||
22 | <v-lazy-image | 22 | <v-lazy-image |
23 | v-if="item.thumbnail" | 23 | v-if="item.thumbnail" |
24 | :src="pictureSrc(item.thumbnail.resource)" | 24 | :src="pictureSrc(item.thumbnail.resource)" |
25 | :style="pictureStyle()" | 25 | :style="pictureStyle" |
26 | :title="item.title" | 26 | :title="item.title" |
27 | @intersect="loading=true" | 27 | @intersect="loading=true" |
28 | @load="loading=false" | 28 | @load="loading=false" |
29 | /> | 29 | /> |
30 | <div v-else class="thumbnail-other flex-column flex-center"> | 30 | <div v-else class="thumbnail-other flex-column flex-center"> |
31 | <div> | 31 | <div> |
32 | <fa-icon :icon="getIcon()" size="4x" /> | 32 | <fa-icon :icon="icon" size="4x" /> |
33 | </div> | 33 | </div> |
34 | {{item.title}} | 34 | {{item.title}} |
35 | </div> | 35 | </div> |
@@ -50,12 +50,12 @@ export default class LdThumbnail extends Vue { | |||
50 | return this.$galleryStore.resourceRoot + resource; | 50 | return this.$galleryStore.resourceRoot + resource; |
51 | } | 51 | } |
52 | 52 | ||
53 | pictureStyle() { | 53 | get pictureStyle() { |
54 | const resolution = this.item.thumbnail!.resolution; | 54 | const resolution = this.item.thumbnail!.resolution; |
55 | return { width: `${resolution.width}px`, height: `${resolution.height}px` }; | 55 | return { width: `${resolution.width}px`, height: `${resolution.height}px` }; |
56 | } | 56 | } |
57 | 57 | ||
58 | getIcon() { | 58 | get icon() { |
59 | return Navigation.getIcon(this.item); | 59 | return Navigation.getIcon(this.item); |
60 | } | 60 | } |
61 | } | 61 | } |