如题:http://localhost:9090/#/businessList/TEST?_k=5weflx
后面的跟的一个参数是什么?有什么用么?
react-router使用hashHistory
wengcd
#2
cxxsn
#3
这个参数可以通过router组件的props.location.key取到,重复点击链接时key会变化。
比如在导航菜单中,当前选中的菜单路由是businessList/menu1,继续点击businessList/menu1时,可以通过key的变化来刷新页面。
lobos
#7
import { Router, useRouterHistory } from 'react-router'
import { createHashHistory } from 'history'
// useRouterHistory creates a composable higher-order function
const appHistory = useRouterHistory(createHashHistory)({ queryKey: false })
<Router history={appHistory} />
1 Like