refactor: TransactionItem 左滑提示改为 prop 控制

This commit is contained in:
2026-06-10 17:35:58 +08:00
parent 31f6487d61
commit ae9b415822
2 changed files with 10 additions and 5 deletions

3
.gitignore vendored
View File

@@ -40,3 +40,6 @@ server/uploads/
# Playwright
.playwright-mcp/
server/backups/
# Workbuddy
.workbuddy/

View File

@@ -1,5 +1,5 @@
<template>
<view class="tx-item-wrap">
<view class="tx-item-wrap" :class="{ 'show-hint': swipeHint && !disableSwipe }">
<view
class="tx-item"
:style="{ transform: `translateX(${offsetX}rpx)` }"
@@ -61,7 +61,9 @@ const props = withDefaults(defineProps<{
showCreator?: boolean
/** 当前用户 ID用于判断是否为本人记录 */
currentUserId?: number
}>(), { hideDate: false, disableSwipe: false, showCreator: false, currentUserId: 0 })
/** 是否显示左滑提示动画由父组件控制仅首个可删除项传入true */
swipeHint?: boolean
}>(), { hideDate: false, disableSwipe: false, showCreator: false, currentUserId: 0, swipeHint: false })
/** 是否为他人的记录(群组模式下,非本人的才显示创建者信息) */
const isOtherCreator = computed(() => {
@@ -132,8 +134,8 @@ function onTouchEnd() {
}
}
// 左滑提示:首次加载时微微露出删除按钮
.tx-item-wrap:first-child .tx-item:not(.no-hint) {
// 左滑提示:仅在 swipeHint=true 且 disableSwipe=false 时播放一次
.show-hint .tx-item {
animation: swipe-hint 0.6s ease 1.5s both;
}
@@ -227,7 +229,7 @@ function onTouchEnd() {
}
@media (prefers-reduced-motion: reduce) {
.tx-item-wrap:first-child .tx-item {
.show-hint .tx-item {
animation: none;
}
}