fix: fix missing page refresh parameters

This commit is contained in:
vben
2020-10-22 00:14:11 +08:00
parent 66acb21edd
commit 349d1978b1
11 changed files with 81 additions and 39 deletions

View File

@@ -90,15 +90,25 @@ export function useTabs() {
closeOther: () => canIUseFn() && closeOther(tabStore.getCurrentTab),
closeCurrent: () => canIUseFn() && closeCurrent(tabStore.getCurrentTab),
resetCache: () => canIUseFn() && resetCache(),
addTab: (path: PageEnum, goTo = false, replace = false) => {
addTab: (
path: PageEnum | string,
goTo = false,
opt?: { replace?: boolean; query?: any; params?: any }
) => {
const to = getTo(path);
if (!to) return;
useTimeout(() => {
tabStore.addTabByPathAction();
}, 0);
const { replace, query = {}, params = {} } = opt || {};
activeKeyRef.value = path;
goTo && replace ? router.replace : router.push(path);
const data = {
path,
query,
params,
};
goTo && replace ? router.replace(data) : router.push(data);
},
activeKeyRef,
};