admin管理员组文章数量:1633790
修改如下:
step1 :修改src\utils\authority.ts中的配置:
export function getAuthority(str?: string): string | string[] {
const authorityString =
typeof str === 'undefined' && localStorage ? localStorage.getItem('antd-pro-authority') : str;
// authorityString could be admin, "admin", ["admin"]
let authority;
try {
if (authorityString) {
authority = JSON.parse(authorityString);
}
} catch (e) {
authority = authorityString;
}
if (typeof authority === 'string') {
return [authority];
}
// 注释以下代码即可
// preview.pro.ant.design only do not use in your production.
// preview.pro.ant.design 专用环境变量,请不要在你的项目中使用它。
// if (!authority && ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION === 'site') {
// return ['admin'];
// }
return authority;
step2 :修改config\config.ts中的配置:
routes: [
{
path: '/',
component: '../layouts/BlankLayout',
routes: [
{
path: '/',
component: '../layouts/UserLayout',
routes: [
// 新增重定向
{
path: '/',
redirect: '/user/login',
},
{
path: '/user/login',
name: 'login',
component: './User/login',
},
{
path: '/user',
redirect: '/user/login',
},
{
name: 'register-result',
icon: 'smile',
path: '/user/register-result',
component: './user/register-result',
},
{
name: 'register',
icon: 'smile',
path: '/user/register',
component: './user/register',
},
{
component: '404',
},
],
},
... ...
],
},
],
版权声明:本文标题:Ant Design Pro V4 默认进入登录页 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1729178390a1189007.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论