refactor: TransactionItem 左滑提示改为 prop 控制
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user