我有超时后导航到某个网址的代码:
componentDidMount: function() {
var self = this;
setTimeout(function() { self.context.history.pushState(null, '/somePage'); }, 5000);
},
但我想要从服务器加载此页面,而不是SPA代码中的组件。 所以,当我这样做时,我只有:
Warning: Location "/somePage" did not match any routes
没有任何反应。 如何以正确的方式做到这一点? 谢谢。
答案 0 :(得分:1)
你能使用:
window.location = "/somePage";
所以:
componentDidMount: function() {
var self = this;
setTimeout(function() { window.location="/somePage"; }, 5000);
},