Skip to content

Commit f227de5

Browse files
committed
1.0-rc compat
1 parent 19fa0bd commit f227de5

File tree

4 files changed

+29
-42
lines changed

4 files changed

+29
-42
lines changed

src/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import util, { warn } from './util'
2+
import initAPI from './router/api'
3+
import initInternal from './router/internal'
4+
import initMixin from './mixin'
25
import Recognizer from 'route-recognizer'
3-
import RouterApi from './router/api'
4-
import RouterInternal from './router/internal'
56
import View from './directives/view'
67
import Link from './directives/link'
7-
import Override from './override'
88
import AbstractHistory from './history/abstract'
99
import HashHistory from './history/hash'
1010
import HTML5History from './history/html5'
@@ -113,11 +113,11 @@ Router.install = function (Vue) {
113113
warn('already installed.')
114114
return
115115
}
116-
RouterApi(Vue, Router)
117-
RouterInternal(Vue, Router)
116+
initAPI(Vue, Router)
117+
initInternal(Vue, Router)
118+
initMixin(Vue)
118119
View(Vue)
119120
Link(Vue)
120-
Override(Vue)
121121
util.Vue = Vue
122122
// 1.0 only: enable route mixins
123123
var strats = Vue.config.optionMergeStrategies

src/mixin.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
export default function (Vue) {
2+
3+
var _ = Vue.util
4+
5+
Vue.mixin({
6+
created: function () {
7+
var route = this.$root.$route
8+
if (route) {
9+
route.router._children.push(this)
10+
if (!this.$route) {
11+
_.defineReactive(this, '$route', route)
12+
}
13+
}
14+
},
15+
beforeDestroy: function () {
16+
var route = this.$root.$route
17+
if (route) {
18+
route.router._children.$remove(this)
19+
}
20+
}
21+
})
22+
}

src/override.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/pipeline.js

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

0 commit comments

Comments
 (0)