Pridani od/do k eventum, fix datetime pickeru pro vyber pouze data, pridano URL k otevrene fotce

This commit is contained in:
Michal Kváček
2023-09-25 06:25:53 +02:00
parent b64c426179
commit 36b0178b97
9 changed files with 106 additions and 28 deletions
+13 -2
View File
@@ -1,6 +1,7 @@
<script setup>
import PhotoDetail from "components/photos/PhotoDetail.vue";
import { ref, watch} from "vue";
import {onMounted, ref, watch} from "vue";
import {useRoute, useRouter} from "vue-router";
const props = defineProps({
photos: {
@@ -26,13 +27,23 @@ const openPhotoDetail = ref(false);
const photoData = ref(null);
const openDetail = ({photo, idx, allPhotos}) => {
openPhotoDetail.value = true;
photoData.value = {photo, idx, allPhotos}
photoData.value = {photo, idx, allPhotos};
}
watch(() => props.photos, (newVal) => {
if (newVal.length === 0) return;
displayedPhoto.value = props.coverPhotoUrl || newVal[0].url;
}, {immediate: true});
const $route = useRoute();
onMounted(() => {
const photoId = parseInt($route.query.photo);
const idx = props.photos.findIndex(p => p.id === photoId);
if (idx >= 0) {
const photo = props.photos[idx];
openDetail({photo, allPhotos: props.photos, idx});
}
});
</script>
<template>