We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 0ed4540 + 6e92388 commit 0338b63Copy full SHA for 0338b63
src/link.js
@@ -5,21 +5,26 @@ module.exports = function (Vue) {
5
6
Vue.directive('link', {
7
8
+ isLiteral: true,
9
+
10
bind: function () {
- var vm = this.vm
- var href = this.expression
11
- if (this.el.tagName === 'A') {
12
- this.el.href = href
13
- }
+ var self = this
14
this.handler = function (e) {
15
e.preventDefault()
16
- vm.route._router.go(href)
+ self.vm.$root.route._router.go(self.destination)
17
}
18
this.el.addEventListener('click', this.handler)
19
},
20
21
unbind: function () {
22
this.el.removeEventListener('click', this.handler)
+ },
23
+ update: function (value) {
24
+ this.destination = value
25
+ if (this.el.tagName === 'A') {
26
+ this.el.href = value
27
+ }
28
29
30
})
0 commit comments