Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

feat(Viewer): 更新照片标题

Timothy Yin2d07f25a344c
diff --git a/app/components/photo/Viewer.vue b/app/components/photo/Viewer.vue
index 59195089..0b0b1603 100644
--- a/app/components/photo/Viewer.vue
+++ b/app/components/photo/Viewer.vue
@@ -26,6 +26,8 @@ const emit = defineEmits<{
indexChange: [index: number]
}>()
+const router = useRouter()
+
// Refs
const containerRef = ref<HTMLDivElement>()
const swiperRef = ref<SwiperType>()
@@ -53,8 +55,18 @@ watch(
} else {
document.body.style.overflow = 'hidden'
}
+
+ if (isOpen && currentPhoto.value) {
+ useHead({
+ title: currentPhoto.value.title
+ })
+ } else {
+ useHead({
+ title: 'Gallery'
+ })
+ }
},
- { immediate: true }
+ { immediate: true },
)
// 同步 Swiper 的索引
diff --git a/app/pages/index.vue b/app/pages/index.vue
index 4ce47576..294bf913 100644
--- a/app/pages/index.vue
+++ b/app/pages/index.vue
@@ -1,6 +1,10 @@
<script lang="ts" setup>
-import { motion } from 'motion-v'
const { data } = useFetch('/api/photos')
+
+useHead({
+ title: 'Gallery',
+ titleTemplate: (title) => `${title} - TimoYin\'s mems`,
+})
</script>
<template>