fix: modifyHistroy改为modifyCreateHistroy,避免执行不必要的创建初始逻辑路由

This commit is contained in:
harrywan 2021-05-31 17:03:38 +08:00
parent e52b5232ae
commit 2097206e19
3 changed files with 14 additions and 4 deletions

View File

@ -296,6 +296,12 @@ export default {
配置 webpack 的 publicPath。当打包的时候webpack 会在静态文件路径前面添加 `publicPath` 的值,当你需要修改静态文件地址时,比如使用 CDN 部署,把 `publicPath` 的值设为 CDN 的值就可以。
## router
- 类型: `object`
- 默认值: `{ mode: 'hash' }`
- 详情: 配置路由,具体请查看指南中关于路由的介绍
## singular
- 类型: `boolean`
- 默认值: `false`

View File

@ -28,7 +28,7 @@ export default function (api) {
// 修改路由
'patchRoutes',
// 修改histror
'modifyHistroy',
'modifyCreateHistroy',
// 生成router时触发
'onRouterCreated'
]

View File

@ -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