修复跳转问题

This commit is contained in:
hupeng
2023-12-28 10:34:53 +08:00
parent 6f4f3ef17b
commit e69d31e5ad

View File

@ -69,14 +69,23 @@ export default {
let redirect = cookie.get('redirect').replace(/\ /g, '') let redirect = cookie.get('redirect').replace(/\ /g, '')
cookie.remove('redirect') cookie.remove('redirect')
if (redirect && redirect.indexOf('/pages') != -1) { if (redirect && redirect.indexOf('/pages') != -1) {
uni.showToast({ // uni.showToast({
title: '/pages' + redirect.split('/pages')[1], // title: '/pages' + redirect.split('/pages')[1],
icon: 'none', // icon: 'none',
duration: 2000, // duration: 2000,
}) // })
this.$yrouter.replace({ //此处跳转tab 得判断
path: '/pages' + redirect.split('/pages')[1], let pathUrl = '/pages' + redirect.split('/pages')[1]
}) if(pathUrl == '/pages/home/index' || pathUrl == '/pages/shop/GoodsClass/index' || pathUrl == '/pages/shop/ShoppingCart/index' || pathUrl == '/pages/user/User/index'){
this.$yrouter.switchTab({
path: pathUrl,
})
}else{
this.$yrouter.replace({
path: pathUrl,
})
}
} else { } else {
this.$yrouter.switchTab({ this.$yrouter.switchTab({
path: '/pages/home/index', path: '/pages/home/index',