Skip to content

Commit

Permalink
fix: modifyHistroy改为modifyCreateHistroy,避免执行不必要的创建初始逻辑路由
Browse files Browse the repository at this point in the history
  • Loading branch information
wanchun committed May 31, 2021
1 parent e52b523 commit 2097206
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions docs/zh/reference/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ export default {

配置 webpack 的 publicPath。当打包的时候,webpack 会在静态文件路径前面添加 `publicPath` 的值,当你需要修改静态文件地址时,比如使用 CDN 部署,把 `publicPath` 的值设为 CDN 的值就可以。

## router

- 类型: `object`
- 默认值: `{ mode: 'hash' }`
- 详情: 配置路由,具体请查看指南中关于路由的介绍

## singular
- 类型: `boolean`
- 默认值: `false`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function (api) {
// 修改路由
'patchRoutes',
// 修改histror
'modifyHistroy',
'modifyCreateHistroy',
// 生成router时触发
'onRouterCreated'
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@ export const createRouter = (routes) => {
if (router) {
return router;
}
history = plugin.applyPlugins({
key: 'modifyHistroy',
const createHistory = plugin.applyPlugins({
key: 'modifyCreateHistroy',
type: ApplyPluginsType.modify,
initialValue: {{{ CREATE_HISTORY }}}(ROUTER_BASE),
args: {
base: ROUTER_BASE
},
initialValue: {{{ CREATE_HISTORY }}},
});
history = createHistory(ROUTER_BASE)
router = createVueRouter({
history,
routes
Expand Down

0 comments on commit 2097206

Please sign in to comment.