fix: tab-router refresh fail (#289)

This commit is contained in:
yuyang 2022-09-03 22:15:00 +08:00 committed by Uyarn
parent 860a830407
commit c4f89d5c5f

View File

@ -114,10 +114,10 @@ export default defineComponent({
const route = tabRouters.find((i) => i.path === path); const route = tabRouters.find((i) => i.path === path);
router.push({ path, query: route.query }); router.push({ path, query: route.query });
}; };
const handleRefresh = (route: TRouterInfo) => { const handleRefresh = (route: TRouterInfo, routeIdx: number) => {
tabsRouterStore.toggleTabRouterAlive(route.routeIdx); tabsRouterStore.toggleTabRouterAlive(routeIdx);
nextTick(() => { nextTick(() => {
tabsRouterStore.toggleTabRouterAlive(route.routeIdx); tabsRouterStore.toggleTabRouterAlive(routeIdx);
router.replace({ path: route.path, query: route.query }); router.replace({ path: route.path, query: route.query });
}); });
}; };
@ -198,7 +198,7 @@ export default defineComponent({
dropdown: () => dropdown: () =>
router.path === route.path ? ( router.path === route.path ? (
<t-dropdown-menu> <t-dropdown-menu>
<t-dropdown-item onClick={() => handleRefresh(router)}> <t-dropdown-item onClick={() => handleRefresh(router, idx)}>
<t-icon name="refresh" /> <t-icon name="refresh" />
</t-dropdown-item> </t-dropdown-item>