react-router为啥自己生成一个?_k=xxxx的query?

代码:
clipboard.png

效果:
clipboard.png

补充:
无论是定义了哪个路由,都会默认带一个_k的query,不知道为啥,求解?

阅读 5.5k
2 个回答
import { Router, Route, IndexRoute, hashHistory } from 'react-router';
import { createHashHistory } from 'history';
var routerHistory = require('react-router').useRouterHistory;   //去掉?_k=****
const appHistory = routerHistory(createHashHistory)({ queryKey: false }) ;
import App from './app';
import Editor from './editor';
import Previewer from './previewer';
import Sbrt from './sbrt';
import React from 'react';
import ReactDOM from 'react-dom';
 /*hashHistory 有sbrt?_k=pm2dkp*/
const router = <Router history={appHistory}>   
  <Route path='/' component={App}>
    <IndexRoute component={Editor} />
      <Route path='editor' component={Editor} />
      <Route path='previewer' component={Previewer} />
      <Route path='sbrt' component={Sbrt} />
  </Route>
</Router>;

ReactDOM.render(
    router,
    document.getElementById('content')
);

图片描述

图片描述

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题