diff options
Diffstat (limited to 'viewer/src/components')
-rw-r--r-- | viewer/src/components/LdTitle.vue | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/viewer/src/components/LdTitle.vue b/viewer/src/components/LdTitle.vue index 47e0729..2614c89 100644 --- a/viewer/src/components/LdTitle.vue +++ b/viewer/src/components/LdTitle.vue | |||
@@ -22,7 +22,8 @@ import { Component, Vue, Watch, Prop } from "vue-property-decorator"; | |||
22 | 22 | ||
23 | @Component | 23 | @Component |
24 | export default class LdTitle extends Vue { | 24 | export default class LdTitle extends Vue { |
25 | @Prop({ required: true }) readonly currentItemPath!: Gallery.Item[]; | 25 | @Prop({ required: true }) readonly galleryTitle!: string; |
26 | @Prop() readonly currentItem?: Gallery.Item; | ||
26 | 27 | ||
27 | render() { | 28 | render() { |
28 | return null; | 29 | return null; |
@@ -32,13 +33,14 @@ export default class LdTitle extends Vue { | |||
32 | this.changedCurrentItemPath(); | 33 | this.changedCurrentItemPath(); |
33 | } | 34 | } |
34 | 35 | ||
35 | @Watch("currentItemPath") | 36 | @Watch("currentItem") |
36 | changedCurrentItemPath() { | 37 | changedCurrentItemPath() { |
37 | document.title = this.currentItemPath.map(this.extractTitle).join(" - "); | 38 | document.title = this.generateTitle(); |
38 | } | 39 | } |
39 | 40 | ||
40 | extractTitle(item: Gallery.Item, idx: number): string { | 41 | generateTitle(): string { |
41 | return item.title || (idx === 0 ? "LdGallery" : "???"); | 42 | if (this.currentItem?.title) return `${this.galleryTitle} • ${this.currentItem.title}`; |
43 | return this.galleryTitle; | ||
42 | } | 44 | } |
43 | } | 45 | } |
44 | </script> | 46 | </script> |