zova-module-a-router 5.0.56 → 5.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/bean/bean.router.ts +2 -2
- package/src/monkey.ts +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-module-a-router",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.58",
|
|
4
4
|
"title": "a-router",
|
|
5
5
|
"zovaModule": {
|
|
6
6
|
"capabilities": {
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"vue-router": "^4.3.2"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "6ab950f2066f8feb2dfddb94575fcbb2cf07afe7"
|
|
44
44
|
}
|
package/src/bean/bean.router.ts
CHANGED
|
@@ -33,7 +33,7 @@ export class BeanRouter extends BeanBase {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
private _createRouter() {
|
|
36
|
-
const createHistory =
|
|
36
|
+
const createHistory = process.env.SERVER
|
|
37
37
|
? createMemoryHistory
|
|
38
38
|
: this.app.config.env.appRouterMode === 'history'
|
|
39
39
|
? createWebHistory
|
|
@@ -68,7 +68,7 @@ export class BeanRouter extends BeanBase {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
public checkPathValid(to?: { name?: string; path?: string } | string): boolean {
|
|
71
|
-
const _path = to && typeof to === 'object' ? to.name ?? to.path : to;
|
|
71
|
+
const _path = to && typeof to === 'object' ? (to.name ?? to.path) : to;
|
|
72
72
|
if (!_path) return true;
|
|
73
73
|
const moduleName = ModuleInfo.parseName(_path);
|
|
74
74
|
if (!moduleName) return true;
|
package/src/monkey.ts
CHANGED
|
@@ -52,6 +52,15 @@ export class Monkey extends BeanSimple implements IMonkeySystem, IMonkeyModule,
|
|
|
52
52
|
async appReady(_bean: BeanContainer) {
|
|
53
53
|
// use router
|
|
54
54
|
this.app.vue.use(this._beanRouter);
|
|
55
|
+
// ssr
|
|
56
|
+
if (process.env.SERVER) {
|
|
57
|
+
// push
|
|
58
|
+
const url = this.ctx.meta.ssr.context.req.url;
|
|
59
|
+
this._beanRouter.push(url);
|
|
60
|
+
await this._beanRouter.isReady();
|
|
61
|
+
} else if (process.env.CLIENT && this.ctx.meta.ssr.isRuntimeSsrPreHydration) {
|
|
62
|
+
await this._beanRouter.isReady();
|
|
63
|
+
}
|
|
55
64
|
}
|
|
56
65
|
async beanInit(bean: BeanContainer, beanInstance: BeanBase) {
|
|
57
66
|
const self = this;
|