详情顶部导航跳转

This commit is contained in:
2023-07-26 19:27:30 +08:00
parent 44d99b26ce
commit 77b5e5e6aa
7 changed files with 44 additions and 47 deletions

View File

@@ -9,7 +9,8 @@ const routes = [
name: 'home',
component: HomeView,
meta: {
title: "首页"
title: "首页",
path:'/'
}
},
{
@@ -46,38 +47,43 @@ const routes = [
}
},
{//个人房源
path: '/personHousing/:type?/:data?/:areaItem?',
path: '/personHousing/:type?/:data?/:areaItem?/:types?',
component: () => import(/* webpackChunkName: "housing" */ '@/views/housingView/person.vue'),
meta: {
title: '个人房源'
title: '个人房源',
path:'/personHousing'
}
},
{//中介房源
path: '/intermediaryHousing',
component: () => import(/* webpackChunkName: "housing" */ '@/views/housingView/intermediary.vue'),
meta: {
title: '中介房源'
title: '中介房源',
path:'/intermediaryHousing'
}
},
{//求房源
path: '/needHousing',
component: () => import(/* webpackChunkName: "housing" */ '@/views/housingView/needHousing.vue'),
meta: {
title: '求房源'
title: '求房源',
path:'/needHousing'
}
},
{//搜索
path: '/seachPage',
component: () => import(/* webpackChunkName: "seachPage" */ '@/views/seachIndex.vue'),
meta: {
title: '搜索'
title: '搜索',
path:'/seachPage'
}
},
{
path: "/apartment",
component: () => import(/* webpackChunkName: "housing" */ '@/views/housingView/apartment.vue'),
meta: {
title: "品牌公寓"
title: "品牌公寓",
path:'/apartment'
}
},
{
@@ -104,10 +110,7 @@ router.beforeEach((to, from, next) => {
//导航数据
if (/['seachPage','needHousing','intermediaryHousing','personHousing']/.test(from.path)) {
store.state.routeList.secondaryIndex.title = from.meta.title
store.state.routeList.secondaryIndex.path = from.path==='/needHousing'?'/needHousing':
from.path==='/intermediaryHousing'?'/intermediaryHousing':
from.path==='/personHousing'?'/personHousing':
from.path==='/seachPage'?'/seachPage':''
store.state.routeList.secondaryIndex.path = from.meta.path
}
next()
let meta = to['meta'] || {}