SOURCE

console 命令行工具 X clear

                    
>
console
function goToUser(url,data) {
  window.parent.parent.postMessage(
    JSON.stringify({
      token: "MAIN_EVENT_LOCATION_CHANGE",
      url: url,
      data:data
    }),'https://3yx16y1qq6.codesandbox.io'
  );
}

var aDom = document.getElementById('go')
aDom.addEventListener('click',function(){
  goToUser('/user/category',{from:'jssssrun'});
});

var aDomre = document.getElementById('go-report')
aDomre.addEventListener('click',function(){
  goToUser('/report');
});
<div class="App"><h1>Hello CodeSandbox</h1>
  <a id="go" href="#ff">点我导航到/user (我带了参数)</a>
  <div>
  <a id="go-report" href="#ff">点我导航到/report</a>
    </div>
  
  <h2>Start editing to see some magic happen!</h2></div>