在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ ant design pro路由重定向出錯

ant design pro路由重定向出錯

ant design pro動態(tài)路由,進行用戶權限控制,但是路由跳不到指定頁面,
每次重新登錄會緩存上次請求的路由列表,重定向地址也不對,

clipboard.png
重新登錄又走了上一次登錄的時候的路由
沒有請求menu之前莫名獲取到了上次登錄的列表,

getBashRedirect = () => {

// 這里是重定向的,重定向到 url 的 redirect 參數所示地址
let { routerData } = this.props;
const urlParams = new URL(window.location.href);
const redirect = urlParams.searchParams.get('redirect');

if (redirect) {
  urlParams.searchParams.delete('redirect');
  window.history.replaceState(null, 'redirect', urlParams.href);
} else {
  
  const authorizedPath = Object.keys(routerData).find(
    item => check(routerData[item].authority, item) && item !== '/'
  );
  console.log('authorizedPath', authorizedPath);
  return authorizedPath;
}
return redirect;

};

回答
編輯回答
涼薄

解決了已經,每次重新登錄的時候清空props里面存儲的menu routerData就可以了

2017年5月5日 10:29