我这样定义一个反应路由路径:阵营路由问题与hashHistory推
/customer/:cid
,当我浏览到所需的路径从我的传奇故事是这样呼吁哈希历史推:
yield call(hashHistory.push, `/customer/${cid}`);
我在浏览器中没有看到'客户'字样,并且出现警告,表明该URL与路由路径不匹配。当我使用/${cid}
期望从/customer/${cid}
路由器工作正常。我错过了什么?
我这样定义一个反应路由路径:阵营路由问题与hashHistory推
/customer/:cid
,当我浏览到所需的路径从我的传奇故事是这样呼吁哈希历史推:
yield call(hashHistory.push, `/customer/${cid}`);
我在浏览器中没有看到'客户'字样,并且出现警告,表明该URL与路由路径不匹配。当我使用/${cid}
期望从/customer/${cid}
路由器工作正常。我错过了什么?
可以尝试:
window.history.pushState(null, null, `#/customer/${cid}`);
或进行模块hashHistory:
// hashHistory.js
import { createHashHistory } from 'history';
export default createHashHistory({});
并使用它:
import hashHistory from './hashHistory';
// ....
hashHistory.push(`/customer/${cid}`);
我想,你可以跳过前面客户的第一个正斜杠。 因为您推送到hashHistory的url与应用程序根URL有关。所以只需跳过第一个正斜杠。希望帮助
什么这儿,在使用产量调用点功能是同步的? –