refactor: TransactionItem 左滑提示改为 prop 控制
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -40,3 +40,6 @@ server/uploads/
|
|||||||
# Playwright
|
# Playwright
|
||||||
.playwright-mcp/
|
.playwright-mcp/
|
||||||
server/backups/
|
server/backups/
|
||||||
|
|
||||||
|
# Workbuddy
|
||||||
|
.workbuddy/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="tx-item-wrap">
|
<view class="tx-item-wrap" :class="{ 'show-hint': swipeHint && !disableSwipe }">
|
||||||
<view
|
<view
|
||||||
class="tx-item"
|
class="tx-item"
|
||||||
:style="{ transform: `translateX(${offsetX}rpx)` }"
|
:style="{ transform: `translateX(${offsetX}rpx)` }"
|
||||||
@@ -61,7 +61,9 @@ const props = withDefaults(defineProps<{
|
|||||||
showCreator?: boolean
|
showCreator?: boolean
|
||||||
/** 当前用户 ID,用于判断是否为本人记录 */
|
/** 当前用户 ID,用于判断是否为本人记录 */
|
||||||
currentUserId?: number
|
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(() => {
|
const isOtherCreator = computed(() => {
|
||||||
@@ -132,8 +134,8 @@ function onTouchEnd() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 左滑提示:首次加载时微微露出删除按钮
|
// 左滑提示:仅在 swipeHint=true 且 disableSwipe=false 时播放一次
|
||||||
.tx-item-wrap:first-child .tx-item:not(.no-hint) {
|
.show-hint .tx-item {
|
||||||
animation: swipe-hint 0.6s ease 1.5s both;
|
animation: swipe-hint 0.6s ease 1.5s both;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +229,7 @@ function onTouchEnd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
.tx-item-wrap:first-child .tx-item {
|
.show-hint .tx-item {
|
||||||
animation: none;
|
animation: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user