/** * @see https://umijs.org/docs/max/access#access * */ export default function access(initialState: { menuType: "distributor" | "miniApp",selectApp:{id:number} }) { return { isShow: (route: { name: string; }) => { if(initialState?.menuType){ const { menuType } = initialState; let regex = new RegExp(`^${menuType}\\.`); // //与2取余为0时设为小说 // if(initialState.selectApp.id % 2 === 0 && route.name.match(/(\.long$)|(\.short$)/)){ // return route.name.match(/\.long$/) // } return route.name.match(regex) } return false },//路由名称包含menuType才显示 }; }