File tree 2 files changed +10
-7
lines changed
2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ p.start = function (vm) {
131
131
return
132
132
}
133
133
this . _started = true
134
- this . _vm = this . _vm || vm
134
+ this . _vm = this . _vm || vm . $root
135
135
if ( ! this . _vm ) {
136
136
throw new Error (
137
137
'vue-router must be started with a root Vue instance.'
Original file line number Diff line number Diff line change @@ -6,20 +6,23 @@ module.exports = function (Vue) {
6
6
Vue . directive ( 'link' , {
7
7
8
8
bind : function ( ) {
9
- var vm = this . vm
10
- var href = this . expression
11
- if ( this . el . tagName === 'A' ) {
12
- this . el . href = href
13
- }
9
+ var self = this
14
10
this . handler = function ( e ) {
15
11
e . preventDefault ( )
16
- vm . route . _router . go ( href )
12
+ self . vm . $root . route . _router . go ( self . destination )
17
13
}
18
14
this . el . addEventListener ( 'click' , this . handler )
19
15
} ,
20
16
21
17
unbind : function ( ) {
22
18
this . el . removeEventListener ( 'click' , this . handler )
19
+ } ,
20
+
21
+ update : function ( value ) {
22
+ this . destination = value
23
+ if ( this . el . tagName === 'A' ) {
24
+ this . el . href = value
25
+ }
23
26
}
24
27
25
28
} )
You can’t perform that action at this time.
0 commit comments