fix jitter caused by gallery navigation reloading
This commit is contained in:
parent
d316fcd592
commit
c6f8032918
1 changed files with 5 additions and 3 deletions
|
@ -28,13 +28,14 @@ const router = useRouter()
|
||||||
let config: GalleryList = null!
|
let config: GalleryList = null!
|
||||||
|
|
||||||
const ready = ref(false)
|
const ready = ref(false)
|
||||||
|
const galleryReady = ref(false)
|
||||||
const entries = ref({} as GalleryEntries)
|
const entries = ref({} as GalleryEntries)
|
||||||
const variants = ref(validateVariants(props.variants))
|
const variants = ref(validateVariants(props.variants))
|
||||||
const hasWarnings = ref(false)
|
const hasWarnings = ref(false)
|
||||||
const hideWarnings = defineModel('showWarnings', { type: Boolean })
|
const hideWarnings = defineModel('showWarnings', { type: Boolean })
|
||||||
|
|
||||||
const onDisplayEntries = () => {
|
const onDisplayEntries = () => {
|
||||||
ready.value = false
|
galleryReady.value = false
|
||||||
let currentEntries = config.entries
|
let currentEntries = config.entries
|
||||||
if (!!variants.value) {
|
if (!!variants.value) {
|
||||||
variants.value.forEach((variant) => {
|
variants.value.forEach((variant) => {
|
||||||
|
@ -43,7 +44,7 @@ const onDisplayEntries = () => {
|
||||||
}
|
}
|
||||||
entries.value = currentEntries
|
entries.value = currentEntries
|
||||||
hasWarnings.value = !!Object.values(entries.value).find(other => !!other.warning)
|
hasWarnings.value = !!Object.values(entries.value).find(other => !!other.warning)
|
||||||
setTimeout(() => ready.value = true)
|
setTimeout(() => galleryReady.value = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onTileClicked = (clickEvent: { event: Event, id: string }) => {
|
const onTileClicked = (clickEvent: { event: Event, id: string }) => {
|
||||||
|
@ -87,6 +88,7 @@ onMounted(async () => {
|
||||||
document.title = routeConfig.title
|
document.title = routeConfig.title
|
||||||
hideWarnings.value = storage.read(`${storageId}::hideWarnings`) || false
|
hideWarnings.value = storage.read(`${storageId}::hideWarnings`) || false
|
||||||
onDisplayEntries()
|
onDisplayEntries()
|
||||||
|
ready.value = true
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -115,7 +117,7 @@ onMounted(async () => {
|
||||||
)
|
)
|
||||||
Transition
|
Transition
|
||||||
.gallery(
|
.gallery(
|
||||||
v-if='ready'
|
v-if='galleryReady'
|
||||||
)
|
)
|
||||||
GalleryTile(
|
GalleryTile(
|
||||||
v-for='(entry, id) in entries'
|
v-for='(entry, id) in entries'
|
||||||
|
|
Loading…
Add table
Reference in a new issue