forked from Mirrors/elk
feat(ui): smoothly unblurring picture placeholders (#1026)
Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe> resolves https://github.com/elk-zone/elk/issues/1022
This commit is contained in:
parent
5e940e58cb
commit
6cb3183c2e
1 changed files with 15 additions and 2 deletions
|
@ -38,6 +38,19 @@ onMounted(() => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<img v-if="isLoaded || !placeholderSrc" v-bind="$attrs" :src="src" :srcset="srcset">
|
||||
<img v-else v-bind="$attrs" :src="placeholderSrc">
|
||||
<Transition>
|
||||
<img v-if="isLoaded || !placeholderSrc" v-bind="$attrs" :src="src" :srcset="srcset" absolute>
|
||||
<img v-else v-bind="$attrs" :src="placeholderSrc" absolute>
|
||||
</Transition>
|
||||
<img v-bind="$attrs" :src="placeholderSrc" z-0 aria-hidden>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.v-enter-active {
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
.v-enter-from {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in a new issue