@@ -23,7 +23,7 @@ export const install: Install<Router | PluginOptions> = (
23
23
const app : any = { }
24
24
let router : Router
25
25
let globalMiddlewares : Middleware [ ] = [ ]
26
- let context : RouteContext = { app }
26
+ let context : RouteContext = { app : vue }
27
27
28
28
if ( options && ( options as PluginOptions ) . router ) {
29
29
// if options object
@@ -97,17 +97,17 @@ export const install: Install<Router | PluginOptions> = (
97
97
router . beforeEach ( routeHook )
98
98
99
99
// ==== helpers ============
100
- app . $MiddlewarePlugin = true
101
- app . $getMiddlewareContext = ( ) => {
100
+ vue . $MiddlewarePlugin = true
101
+ vue . $getMiddlewareContext = ( ) => {
102
102
const { app, ..._context } = context
103
103
return _context
104
104
}
105
- app . $setMiddlewareContext = ( _context : any ) : any => {
105
+ vue . $setMiddlewareContext = ( _context : any ) : any => {
106
106
const { app, to, from, redirect } = context
107
107
context = { ..._context , app, to, from, redirect }
108
108
return context
109
109
}
110
- app . $updateMiddlewareContext = ( key : string , value : any ) => {
110
+ vue . $updateMiddlewareContext = ( key : string , value : any ) => {
111
111
const { app, to, from, redirect } = context
112
112
context = { [ key ] : value , app, to, from, redirect }
113
113
}
0 commit comments