Skip to content

Commit d5afbbf

Browse files
committed
fix compatibility with 0.12
1 parent ef54dce commit d5afbbf

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/mixin.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
export default function (Vue) {
22

3-
var _ = Vue.util
4-
5-
Vue.mixin({
3+
const _ = Vue.util
4+
const mixin = {
65
created: function () {
76
var route = this.$root.$route
87
if (route) {
98
route.router._children.push(this)
109
if (!this.$route) {
11-
_.defineReactive(this, '$route', route)
10+
if (this._defineMeta) {
11+
// 0.12 compat
12+
this._defineMeta('$route', route)
13+
} else {
14+
_.defineReactive(this, '$route', route)
15+
}
1216
}
1317
}
1418
},
@@ -18,5 +22,12 @@ export default function (Vue) {
1822
route.router._children.$remove(this)
1923
}
2024
}
21-
})
25+
}
26+
27+
if (Vue.mixin) {
28+
Vue.mixin(mixin)
29+
} else {
30+
// 0.12 compat
31+
Vue.options = _.mergeOptions(Vue.options, mixin)
32+
}
2233
}

src/pipeline.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ export function activate (view, transition, depth, cb) {
128128
// itself as view.childView.
129129
let component = view.build({
130130
_meta: {
131-
$route: view.vm.$route,
132131
$loadingRouteData: !!(dataHook && !waitForData)
133132
}
134133
})

0 commit comments

Comments
 (0)