2
0

fix: 路由加载合并排序(还存在切换账号菜单缓存问题)

This commit is contained in:
TsMask
2024-12-02 20:03:31 +08:00
parent f6bfceab29
commit 18dacb0c75
5 changed files with 37 additions and 92 deletions

View File

@@ -1,7 +1,7 @@
import { useRouter } from 'vue-router';
import type { RouteLocationRaw } from 'vue-router';
import type { RouteKey } from '@elegant-router/types';
import { router as globalRouter } from '@/router';
import type {RouteLocationRaw} from 'vue-router';
import {useRouter} from 'vue-router';
import type {RouteKey} from '@elegant-router/types';
import {router as globalRouter} from '@/router';
/**
* Router push
@@ -24,7 +24,7 @@ export function useRouterPush(inSetup = true) {
}
async function routerPushByKey(key: RouteKey, options?: RouterPushOptions) {
const { query, params } = options || {};
const {query, params} = options || {};
const routeLocation: RouteLocationRaw = {
name: key
@@ -53,7 +53,6 @@ export function useRouterPush(inSetup = true) {
*/
async function toLogin(loginModule?: UnionKey.LoginModule, redirectUrl?: string) {
const module = loginModule || 'pwd-login';
const options: RouterPushOptions = {
params: {
module
@@ -77,7 +76,7 @@ export function useRouterPush(inSetup = true) {
async function toggleLoginModule(module: UnionKey.LoginModule) {
const query = route.value.query as Record<string, string>;
return routerPushByKey('login', { query, params: { module } });
return routerPushByKey('login', {query, params: {module}});
}
/** Redirect from login */