Refactor ImageViewer component to remove custom animation functions and simplify transition handling

- Eliminated the `useAnime` composable and its associated animation functions from ImageViewer.vue, opting for a more straightforward approach to transitions.
- Updated the onEnter function to focus solely on sound effects during transitions, enhancing clarity and maintainability of the code.
This commit is contained in:
AdingApkgg
2025-12-26 23:01:22 +08:00
parent 42608f50c1
commit 29fdabbb0e
2 changed files with 2 additions and 165 deletions

View File

@@ -5,7 +5,6 @@
*/
import { ref, computed, watch, onMounted, onUnmounted } from 'vue'
import { animate } from '@/composables/useAnime'
import {
X,
ChevronLeft,
@@ -68,26 +67,9 @@ const imageStyle = computed(() => {
}
})
// 动画函数
function onEnter(el: Element, done: () => void) {
// 进入动画时播放音效
function onEnter() {
playTransitionUp()
animate(el as HTMLElement, {
opacity: [0, 1],
scale: [0.95, 1],
duration: 250,
ease: 'outCubic',
complete: done,
})
}
function onLeave(el: Element, done: () => void) {
animate(el as HTMLElement, {
opacity: [1, 0],
scale: [1, 0.95],
duration: 200,
ease: 'inCubic',
complete: done,
})
}
// 监听图片切换