You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
在源码中点击菜单栏进行跳转
const goto = (item: RouteRecordRaw) => {
router.push({
name: item.name,
});
};
export default function setupServerPermissionGuard(router: Router) {
router.beforeEach(async (to, from, next) => {
// A simple example 简单示例
// 针对来自服务端的菜单配置进行处理
// Handle routing configuration from the server
// 根据需要自行完善来源于服务端的菜单配置的permission逻辑
// Refine the permission logic from the server's menu configuration as needed
const appStore = useAppStore();
if (appStore.menuFromServer) {
const serverMenuConfig = [...appStore.appServerMenuConfig, ...whiteList];
let exist = false;
while (serverMenuConfig.length) {
const element = serverMenuConfig.shift();
if (element?.name === to.name) exist = true;
if (element?.children) {
serverMenuConfig.push(
...(element.children as unknown as RouteRecordNormalized[])
);
}
}
if (exist) next();
else next({ name: 'notFound' });
} else {
next();
}
Basic Info
What problem does this feature solve?
在源码中点击菜单栏进行跳转
const goto = (item: RouteRecordRaw) => {
router.push({
name: item.name,
});
};
export default function setupServerPermissionGuard(router: Router) {
router.beforeEach(async (to, from, next) => {
// A simple example 简单示例
});
}
What are the similar cases of this feature
该种方式通过name进行跳转,但实际开发中,路径是会带参数传递,带参数传递传递的路径该如何进行权限判断,是否能在Pro
中给一个案例,比如个人中心详情
The text was updated successfully, but these errors were encountered: