fix: 解决嵌入页面选中问题
Showing
1 changed file
with
3 additions
and
5 deletions
| ... | @@ -4,6 +4,7 @@ import { useRouter } from "vue-router"; | ... | @@ -4,6 +4,7 @@ import { useRouter } from "vue-router"; |
| 4 | import useUserStore from "@/store/modules/user"; | 4 | import useUserStore from "@/store/modules/user"; |
| 5 | import useKeepAliveStore from '@/store/modules/keepAlive' | 5 | import useKeepAliveStore from '@/store/modules/keepAlive' |
| 6 | import { ElMessageBox, ElMessage } from "element-plus"; | 6 | import { ElMessageBox, ElMessage } from "element-plus"; |
| 7 | import { isEqual } from "lodash-es"; | ||
| 7 | 8 | ||
| 8 | const router = useRouter(); | 9 | const router = useRouter(); |
| 9 | const route = useRoute(); | 10 | const route = useRoute(); |
| ... | @@ -26,7 +27,7 @@ watch( | ... | @@ -26,7 +27,7 @@ watch( |
| 26 | if (tab.fullPath.includes(jionPath)) { | 27 | if (tab.fullPath.includes(jionPath)) { |
| 27 | pathIndex.value = index | 28 | pathIndex.value = index |
| 28 | } | 29 | } |
| 29 | return tab.fullPath === newRouter.fullPath; | 30 | return tab.fullPath === newRouter.fullPath || (tab.path == newRouter.path && isEqual(tab.query, newRouter.query)); |
| 30 | }); | 31 | }); |
| 31 | if (isExist.length == 0) { | 32 | if (isExist.length == 0) { |
| 32 | if (pathIndex.value != -1 && routerLength > 3) { | 33 | if (pathIndex.value != -1 && routerLength > 3) { |
| ... | @@ -45,11 +46,8 @@ watch( | ... | @@ -45,11 +46,8 @@ watch( |
| 45 | 46 | ||
| 46 | } | 47 | } |
| 47 | } | 48 | } |
| 48 | list.map(item => { | ||
| 49 | item.fullPath = item.fullPath; | ||
| 50 | }) | ||
| 51 | tabbarList.value = list; | 49 | tabbarList.value = list; |
| 52 | tabbarActive.value = newRouter.fullPath; | 50 | tabbarActive.value = isExist[0]?.fullPath || newRouter.fullPath; |
| 53 | userStore.setTabbar(tabbarList.value); | 51 | userStore.setTabbar(tabbarList.value); |
| 54 | userStore.setActiveTabbar(combPath, newRouter.fullPath); | 52 | userStore.setActiveTabbar(combPath, newRouter.fullPath); |
| 55 | }, | 53 | }, | ... | ... |
-
Please register or sign in to post a comment