@truenewx/tnxvue3 3.4.7 → 3.4.8
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 +1 -1
- package/src/tnxvue-router.ts +2 -17
- package/src/vue.d.ts +0 -6
package/package.json
CHANGED
package/src/tnxvue-router.ts
CHANGED
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
RouteLocationNormalized,
|
|
12
12
|
RouteLocationNormalizedLoaded,
|
|
13
13
|
RouteLocationNormalizedLoadedGeneric,
|
|
14
|
-
NavigationGuardNext,
|
|
15
14
|
} from 'vue-router';
|
|
16
15
|
import * as NetUtil from '../../tnxcore/src/util/net.ts';
|
|
17
16
|
|
|
@@ -160,8 +159,7 @@ export default function (items: RouteItem[], useHashHistory = true, fnImportPage
|
|
|
160
159
|
router.$beforeLeaveHandlers[path] = handler;
|
|
161
160
|
};
|
|
162
161
|
|
|
163
|
-
router.beforeEach((to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded
|
|
164
|
-
let allow = true;
|
|
162
|
+
router.beforeEach((to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded) => {
|
|
165
163
|
let beforeLeaveHandler = router.$beforeLeaveHandlers[from.path];
|
|
166
164
|
if (!beforeLeaveHandler) {
|
|
167
165
|
let toItem = findItemByPath(null, items, to.path);
|
|
@@ -177,20 +175,7 @@ export default function (items: RouteItem[], useHashHistory = true, fnImportPage
|
|
|
177
175
|
}
|
|
178
176
|
}
|
|
179
177
|
if (beforeLeaveHandler) {
|
|
180
|
-
|
|
181
|
-
if (result instanceof Promise) {
|
|
182
|
-
result.then((allowed: boolean): void => {
|
|
183
|
-
if (allowed) {
|
|
184
|
-
next();
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
return;
|
|
188
|
-
} else if (result === false) {
|
|
189
|
-
allow = false;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
if (allow) {
|
|
193
|
-
next();
|
|
178
|
+
return beforeLeaveHandler(to);
|
|
194
179
|
}
|
|
195
180
|
});
|
|
196
181
|
|