页面未重定向到更新的网址

Page is not redirecting to updated URL

本文关键字:更新 重定向      更新时间:2023-09-26

我需要重定向到我的应用程序的新URL。我有一个事件,我正在更改 URL。此处 URL 已更新,但页面未重定向。它仅在刷新后重定向。请帮我解决这个问题。谢谢。

.JS:

 _onNewFlowCreated(newFlow) {
        let url= '/#/flows/'+ newFlow.uid +'/edit';
        //window.history.pushState({}, '', url);
         window.location.href= url;
    }

我尝试使用react-router.但没有找到解决方案。

试试这个

import { Router, Redirect, Route, Link, browserHistory, IndexRoute, useRouterHistory, RouterContext, hashHistory } from 'react-router';
import { createHashHistory } from 'history';

如果您使用的是 reactjs 使用

browserHistory.push('/#/flows/'+ newFlow.uid +'/edit');

导航到另一个网址