ant-design-pro-plus icon indicating copy to clipboard operation
ant-design-pro-plus copied to clipboard

isSwitchTab 判断异常

Open CementSealing opened this issue 2 years ago • 7 comments

以前用得没什么问题,然后不知道怎么就报错了。报错主要是在登录页和redirect路由页面

图片

在文档中有说:在使用页面标签化的功能的时候注意 originalRoutes 需要处理得当,请问需要怎么注意处理得当,SwitchTabsLayout文件与DEMO的一样

CementSealing avatar Dec 16 '22 07:12 CementSealing

感谢反馈,下班后抽个时间看一下

yunsii avatar Dec 16 '22 08:12 yunsii

如果可以的话建议给个复现 demo 方便排查,抑或把 originalTabsRoutes 贴出来看看呢?

yunsii avatar Dec 18 '22 14:12 yunsii

图片

CementSealing avatar Dec 19 '22 01:12 CementSealing

我的意思是 console.log 一下报错时候的 originalTabsRoutes 😂

yunsii avatar Dec 19 '22 05:12 yunsii

location:

{
  "pathname": "/user/login",
  "search": "",
  "hash": "",
  "query": {},
  "key": "t714eu"
}

originalTabsRoutes:

  {
    "path": "/home-page",
    "name": "首页",
    "icon": {
      "type": {},
      "key": null,
      "ref": null,
      "props": {},
      "_owner": null,
      "_store": {}
    },
    "component": {},
    "exact": true,
    "unaccessible": false,
    "locale": "menu.home-page"
  },
  {
    "path": "https://pro.ant.design/docs/getting-started-cn",
    "name": "报表管理",
    "icon": {
      "type": {},
      "key": null,
      "ref": null,
      "props": {},
      "_owner": null,
      "_store": {}
    },
    "target": "_blank",
    "exact": true,
    "unaccessible": false,
    "locale": "menu.report-management"
  },
  {
    "path": "/index.html",
    "redirect": "/home-page",
    "exact": true,
    "unaccessible": false
  }
]```

好像当routes的path配置为url时会出现报错, 例如以上的 `"path": "https://pro.ant.design/docs/getting-started-cn",`

CementSealing avatar Dec 19 '22 05:12 CementSealing

那大概率是这个原因了,我回头看看

yunsii avatar Dec 19 '22 08:12 yunsii

@CementSealing 刚才突然想到,你可以暂时先把 routes 中的 https:// 开头的路由过滤掉试试

yunsii avatar Dec 20 '22 02:12 yunsii