Skip to content

Commit

Permalink
fix: custom history (alibaba#3999)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClarkXia authored Jan 5, 2021
1 parent d2675e7 commit 31f8c5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/guide/basic/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

## 路由组件参数

Expand Down
4 changes: 2 additions & 2 deletions packages/create-app-shared/src/createBaseApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 31f8c5b

Please sign in to comment.