A页面点击子项可以跳转到对应详情页面C,关闭详情页面C回到A页面,B页面点击子项也可以跳转到对应详情页面C,关闭详情页面回到B页面。关闭详情页面C回到A页面还是B页面需要跳转路由时query传参来区分:
A页面跳转方法如下,query传参中有from:‘list’
toDetail(item) {
if (item.firstCategoryId && item.firstCategoryId != '- -' && ['aKey', 'bKey'].includes(item.type)) {
// && item.status != '1'
this.$router.push({
path: '/smartCommunity/service/repairListFlow',
query: {
id: item.id,
firstCategoryId: item.firstCategoryId,
from: 'list'
}
})
} else {
this.$router.push({
path: '/smartCommunity/service/repairListDetail',
query: {
id: item.id,
from: 'list'
}
})
}
}
B页面写法与A页面一样,query传参中少了from选项
详情页面C需要再关闭方法中做判断:
closeDialog() {
if (this.$route.query.from == 'list') {
this.$router.go(-1)
} else {
this.$router.push('/smartCommunity/service')
}
},