fix: custom history (#3999)

This commit is contained in:
ClarkXia 2021-01-05 19:55:21 +08:00 committed by GitHub
parent d2675e70fc
commit 31f8c5b686
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -81,7 +81,7 @@ runApp(appConfig);
- basename: 路由基准地址
- fallback: 开启按需加载时配置 fallback UI
- modifyRoutes: 动态修改路由
- history: 自定义创建 history 对象,[详见](https://github.com/ReactTraining/history/blob/master/docs/GettingStarted.md)
- history: 自定义创建 history 对象,[详见](https://github.com/ReactTraining/history/blob/master/docs/getting-started.md)
## 路由组件参数

View File

@ -25,9 +25,9 @@ export default ({ loadRuntimeModules, createElement, initHistory = true }) => {
let history = {};
if (!isMiniAppPlatform && initHistory) {
const { router } = appConfig;
const { type, basename } = router;
const { type, basename, history: customHistory } = router;
const location = context.initialContext ? context.initialContext.location : null;
history = createHistory({ type, basename, location });
history = createHistory({ type, basename, location, customHistory });
appConfig.router.history = history;
}