Skip to content

Commit

Permalink
FilePath (改变router组件路径)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhuid committed Feb 21, 2024
1 parent 943e267 commit a5dcab8
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 56 deletions.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const routes = [
{
path: '/city',
name: 'city',
component: () => import('@/views/Cinemas/City')
component: () => import('@/views/City')
},
{
path: '/cinemas',
Expand All @@ -69,11 +69,11 @@ const routes = [
{
path: 'search',
name: 'searchCinemas',
component: () => import('@/views/Cinemas/Search')
component: () => import('@/components/SearchCinemas')
},
{
path: '',
component: () => import("@/components/CinemaList.vue"),
component: () => import("@/components/CinemaList"),
meta: {
isMain: true,
}
Expand Down
96 changes: 43 additions & 53 deletions src/views/Cinemas/Cinemas.vue
Original file line number Diff line number Diff line change
@@ -1,68 +1,58 @@
<template>
<div class="main">
<van-nav-bar
:title="'影院'"
@click-left="$router.push({ name: 'city' })"
@click-right="$router.push({ name: 'searchCinemas' })">
<template #left>
{{ $store.state.cityName }}
<van-icon
name="arrow-down"
color="black" />
</template>
<div class="main">
<van-nav-bar
:title="'影院'"
@click-left="$router.push({ name: 'city' })"
@click-right="$router.push({ name: 'searchCinemas' })"
>
<template #left>
{{ $store.state.cityName }}
<van-icon name="arrow-down" color="black" />
</template>

<template #right>
<van-icon
name="search"
size="22"
color="black" />
</template>
</van-nav-bar>
<transition
name="h"
appear
mode="out-in">
<keep-alive>
<router-view :height="getCinemaListHeight()"></router-view>
</keep-alive>
</transition>
</div>
<template #right>
<van-icon name="search" size="22" color="black" />
</template>
</van-nav-bar>
<transition name="h" appear mode="out-in">
<router-view :height="getCinemaListHeight()"></router-view>
</transition>
</div>
</template>
<script>
import { NavBar } from "vant"
import { Icon } from "vant"
export default {
name: "cinemas",
components: {
[NavBar.name]: NavBar,
[Icon.name]: Icon,
},
data() {
return {
height: window.outerHeight,
}
},
methods: {
getCinemaListHeight() {
let height =
this.height > window.outerHeight ? this.height : window.outerHeight
return height - 46 - 49 + "px"
}
},
activated() {
if (this.$store.state.cinemasData.length === 0) {
this.$store.dispatch("getCinemasData", this.$store.state.cityId)
}
},
name: "cinemas",
components: {
[NavBar.name]: NavBar,
[Icon.name]: Icon
},
data() {
return {
height: window.outerHeight
}
},
methods: {
getCinemaListHeight() {
let height = this.height > window.outerHeight ? this.height : window.outerHeight
return height - 46 - 49 + "px"
}
},
activated() {
if (this.$store.state.cinemasData.length === 0) {
this.$store.dispatch("getCinemasData", this.$store.state.cityId)
}
}
}
</script>
<style scoped>
.hhh-enter-active {
transition: all 0.3s;
/* animation: 1s run ease reverse; */
transition: all 0.3s;
/* animation: 1s run ease reverse; */
}
.hhh-enter {
opacity: 0;
transform: translateY(30px);
opacity: 0;
transform: translateY(30px);
}
</style>
File renamed without changes.

0 comments on commit a5dcab8

Please sign in to comment.