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/LdAudioViewer.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/LdAudioViewer.vue')
-rw-r--r-- | viewer/src/components/LdAudioViewer.vue | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/viewer/src/components/LdAudioViewer.vue b/viewer/src/components/LdAudioViewer.vue index d115a34..739d36a 100644 --- a/viewer/src/components/LdAudioViewer.vue +++ b/viewer/src/components/LdAudioViewer.vue | |||
@@ -21,10 +21,11 @@ | |||
21 | <template> | 21 | <template> |
22 | <div class="flex-column container-vh-centering"> | 22 | <div class="flex-column container-vh-centering"> |
23 | <ld-thumbnail :item="audioItem" /> | 23 | <ld-thumbnail :item="audioItem" /> |
24 | <audio :class="$style.player" :src="itemResourceUrl()" preload="auto" controls> | 24 | <audio :class="$style.player" :src="itemResourceUrl" preload="auto" controls> |
25 | <a :download="itemFileName()" :href="itemResourceUrl()"> | 25 | <a |
26 | {{ $t("download.download-file-fmt", [itemFileName()]) }} | 26 | :download="itemFileName" |
27 | </a> | 27 | :href="itemResourceUrl" |
28 | >{{ $t("download.download-file-fmt", [itemFileName]) }}</a> | ||
28 | </audio> | 29 | </audio> |
29 | </div> | 30 | </div> |
30 | </template> | 31 | </template> |
@@ -33,14 +34,15 @@ | |||
33 | import { Component, Prop, Vue } from "vue-property-decorator"; | 34 | import { Component, Prop, Vue } from "vue-property-decorator"; |
34 | import Navigation from "@/services/navigation"; | 35 | import Navigation from "@/services/navigation"; |
35 | 36 | ||
36 | @Component export default class LdAudioViewer extends Vue { | 37 | @Component |
38 | export default class LdAudioViewer extends Vue { | ||
37 | @Prop({ required: true }) readonly audioItem!: Gallery.Audio; | 39 | @Prop({ required: true }) readonly audioItem!: Gallery.Audio; |
38 | 40 | ||
39 | itemResourceUrl(): string { | 41 | get itemResourceUrl(): string { |
40 | return this.$galleryStore.resourceRoot + this.audioItem.properties.resource; | 42 | return this.$galleryStore.resourceRoot + this.audioItem.properties.resource; |
41 | } | 43 | } |
42 | 44 | ||
43 | itemFileName(): string { | 45 | get itemFileName(): string { |
44 | return Navigation.getFileName(this.audioItem); | 46 | return Navigation.getFileName(this.audioItem); |
45 | } | 47 | } |
46 | } | 48 | } |