Skip to content

Commit

Permalink
fix (router) : 修复多次点击跳转时的路由导航错误
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhuid committed Feb 22, 2024
1 parent a5dcab8 commit 4e42ead
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/views/Cinemas/Cinemas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@
<div class="main">
<van-nav-bar
:title="'影院'"
@click-left="$router.push({ name: 'city' })"
@click-right="$router.push({ name: 'searchCinemas' })"
@click-left="
() => {
const path = '/city'
if (this.$route.path === path) return
$router.push({ name: 'city' })
}
"
@click-right="
() => {
const path = '/cinemas/search'
if (this.$route.path === path) return
$router.push({ name: 'searchCinemas' })
}
"
>
<template #left>
{{ $store.state.cityName }}
Expand All @@ -15,7 +27,7 @@
</template>
</van-nav-bar>
<transition name="h" appear mode="out-in">
<router-view :height="getCinemaListHeight()"></router-view>
<router-view :height="getCinemaListHeight()"></router-view>
</transition>
</div>
</template>
Expand Down

0 comments on commit 4e42ead

Please sign in to comment.