我怎样才能忘记这条路线? 我的功能"执行"继续运行一个Im cliking on links
const unlisten = browserHistory.listen(unlis);
function handleUrl(location){
const newPath = location.pathname;
if(!newPath.includes(${id})
)){
执行();
UNLISTEN(window.location的);
}
其他unlisten(window.location);
browserHistory.listen(handleUrl);
handleUrl(window.location的);
我试过:
browserHistory.push(`/search/${id}');
const unlisten = browserHistory.listen(location);
function handleUrl(location) {
const newPath = location.pathname;
if (!newPath.includes(`${id})`) {
execute();
unlisten(window.location);
else unliste;
browserHistory.listen(handleUrl);
handleUrl(window.location);
但没有运气
答案 0 :(得分:0)
了解如何解决问题
let unlisten;
function handleUrl(location) {
const newPath = location.pathname;
if (!newPath.includes(`${id})`)) {
execute();
unlisten();
}
unlisten = browserHistory.listen(handleUrl);
handleUrl(window.location);
}