在页面1使用vant4的van-swipe-cell组件,ios手机(安卓手机没问题)在页面1右划(不是点击箭头,点击箭头返回不会出现问题)返回页面2时,页面2点击按钮第一次无效,第二次才有效
<van-swipe-cell :key="timingListIndex" :ref="`swipeCellRef${timingListIndex}`" right-width="64">
<div class="cell-content flex-space" v-longhandle="()=>longpress(timingListIndex, timersIndex)">
<div class="leftWrap" @click.stop="(e) => goDetail(e, timer)">
<div class="content-box">
<div class="time">
{{ handleTimeDisplay(timer).title }}
</div>
<div class="week">
{{ handleTimeDisplay(timer).subTitle }}
</div>
</div>
</div>
<van-switch v-model="timer.checked" size="27px" @change="(e) => switchStatus(e, timer)" />
</div>
<template #right>
<img class="time-delete" src="@/assets/timing/time_delete.png" alt=""
@click="() => deleteTimer(timer)" />
</template>
</van-swipe-cell>
通过路由,在返回首页时刷新一下页面,就不会出现这个问题了
onBeforeRouteLeave((to, from, next) => {
if(to.name === 'Home'){
window.location.reload();
}
next(); // 确保路由正常跳转
});