为了账号安全,请及时绑定邮箱和手机立即绑定

为什么我的url输入每次都会自动添加一个#

为什么我的url输入每次都会自动添加一个#

叮当猫咪 2019-02-20 22:19:06
用的是react-router4,每一次手动输入url进行跳转都会自动添加一个#比如 我输入 localhost:8000/index => localhost:8000/index#/ 变成这样了路由代码是function RouterConfig({ history }) {  return(  <Router history={history}>     <Switch>      <Route exact path="" component={lsPage}/>      <Route exact path="/index" component={layout} />      </Switch>  </Router>  )} export default RouterConfig;
查看完整描述

1 回答

?
红颜莎娜

TA贡献1842条经验 获得超12个赞

您是不是使用的hashHistory路由。
使用hashHistory,浏览器的url就是这样的:localhost:8000/index#/
而使用browserHistory,浏览器的url是这样的:localhost:8000/index

希望我的回答能帮助到您^_^


查看完整回答
反对 回复 2019-02-24
  • 1 回答
  • 0 关注
  • 329 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信