Skip to content

Commit 3f44b15

Browse files
committed
fix: Slightly improve future Vue 3 compatibility
1 parent 007337a commit 3f44b15

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/vue-router.common.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ export const createRouter = (
3333
});
3434

3535
// Vue 3 compatibility
36-
if (proto.config && proto.config.globalProperties) {
37-
proto.config.globalProperties.$routeTo = router.push.bind(router);
38-
proto.config.globalProperties.$routeBack = router.back.bind(router);
39-
proto.config.globalProperties.$router = router;
36+
if (vm.createApp && vm.config.globalProperties) {
37+
vm.config.globalProperties.$routeTo = router.push.bind(router);
38+
vm.config.globalProperties.$routeBack = router.back.bind(router);
39+
vm.config.globalProperties.$router = router;
4040
} else {
4141
proto.$routeTo = router.push.bind(router);
4242
proto.$routeBack = router.back.bind(router);

0 commit comments

Comments
 (0)