react中history的使用
2020-06-12 本文已影响0人
sweetBoy_9126
import { createBrowserHistory, createHashHistory } from 'history';
const history = createBrowserHistory() // history模式
const history = createHashHistory() // hash模式
history.push('/')
interface HistoryProp {
history?: History & { push: (str: string) => void};
}
(history as HistoryProp).push('/')