Skip to content

Commit 47747dd

Browse files
committed
[build] 0.5.2
1 parent 76c5254 commit 47747dd

File tree

2 files changed

+40
-30
lines changed

2 files changed

+40
-30
lines changed

dist/vue-router.js

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* vue-router v0.5.1
2+
* vue-router v0.5.2
33
* (c) 2015 Evan You
44
* Released under the MIT License.
55
*/
@@ -96,7 +96,7 @@ return /******/ (function(modules) { // webpackBootstrap
9696
// auto install
9797
/* istanbul ignore if */
9898
if (typeof window !== 'undefined' && window.Vue) {
99-
_router2['default'].install(window.Vue);
99+
window.Vue.use(_router2['default']);
100100
}
101101

102102
exports['default'] = _router2['default'];
@@ -1044,6 +1044,7 @@ return /******/ (function(modules) { // webpackBootstrap
10441044
this._previousTransition = null;
10451045
this._notFoundHandler = null;
10461046
this._beforeEachHook = null;
1047+
this._afterEachHook = null;
10471048

10481049
// feature detection
10491050
this._hasPushState = typeof window !== 'undefined' && window.history && window.history.pushState;
@@ -1336,13 +1337,14 @@ return /******/ (function(modules) { // webpackBootstrap
13361337
_createClass(HTML5History, [{
13371338
key: 'start',
13381339
value: function start() {
1339-
var self = this;
1340+
var _this = this;
1341+
13401342
this.listener = function (e) {
13411343
var url = decodeURI(location.pathname + location.search);
1342-
if (this.root) {
1343-
url = url.replace(this.rootRE, '');
1344+
if (_this.root) {
1345+
url = url.replace(_this.rootRE, '');
13441346
}
1345-
self.onChange(url, e && e.state, location.hash);
1347+
_this.onChange(url, e && e.state, location.hash);
13461348
};
13471349
window.addEventListener('popstate', this.listener);
13481350
this.listener();
@@ -1472,6 +1474,16 @@ return /******/ (function(modules) { // webpackBootstrap
14721474
this._beforeEachHook = fn;
14731475
};
14741476

1477+
/**
1478+
* Set global after hook.
1479+
*
1480+
* @param {Function} fn
1481+
*/
1482+
1483+
Router.prototype.afterEach = function (fn) {
1484+
this._afterEachHook = fn;
1485+
};
1486+
14751487
/**
14761488
* Navigate to a given path.
14771489
* The path is assumed to be already decoded, and will
@@ -1743,6 +1755,13 @@ return /******/ (function(modules) { // webpackBootstrap
17431755
child.$route = route;
17441756
});
17451757
}
1758+
// call global after hook
1759+
if (this._afterEachHook) {
1760+
this._afterEachHook.call(null, {
1761+
to: transition.to,
1762+
from: transition.from
1763+
});
1764+
}
17461765
};
17471766

17481767
/**
@@ -1805,20 +1824,20 @@ return /******/ (function(modules) { // webpackBootstrap
18051824
* @param {Router} router
18061825
*/
18071826

1808-
'use strict';
1809-
1810-
var _classCallCheck = __webpack_require__(7)['default'];
1827+
"use strict";
18111828

1812-
var _Object$defineProperty = __webpack_require__(10)['default'];
1829+
var _classCallCheck = __webpack_require__(7)["default"];
18131830

1814-
Object.defineProperty(exports, '__esModule', {
1831+
Object.defineProperty(exports, "__esModule", {
18151832
value: true
18161833
});
18171834

18181835
var Route = function Route(path, router) {
18191836
_classCallCheck(this, Route);
18201837

18211838
this.path = path;
1839+
this.router = router;
1840+
18221841
var matched = router._recognizer.recognize(path);
18231842

18241843
this.query = matched ? matched.queryParams : {};
@@ -1833,20 +1852,11 @@ return /******/ (function(modules) { // webpackBootstrap
18331852
}, {}) : {};
18341853

18351854
// private stuff
1836-
this._aborted = false;
1837-
def(this, '_matched', matched || router._notFoundHandler);
1838-
def(this, '_router', router);
1855+
this._matched = matched || router._notFoundHandler;
18391856
};
18401857

1841-
exports['default'] = Route;
1842-
1843-
function def(obj, key, val) {
1844-
_Object$defineProperty(obj, key, {
1845-
value: val,
1846-
enumerable: false
1847-
});
1848-
}
1849-
module.exports = exports['default'];
1858+
exports["default"] = Route;
1859+
module.exports = exports["default"];
18501860

18511861
/***/ },
18521862
/* 18 */
@@ -2397,7 +2407,7 @@ return /******/ (function(modules) { // webpackBootstrap
23972407
// all we need to do here is registering this view
23982408
// in the router. actual component switching will be
23992409
// managed by the pipeline.
2400-
var router = this.router = route._router;
2410+
var router = this.router = route.router;
24012411
router._views.unshift(this);
24022412

24032413
// note the views are in reverse order.
@@ -2454,7 +2464,7 @@ return /******/ (function(modules) { // webpackBootstrap
24542464
(0, _util.warn)('v-link can only be used inside a ' + 'router-enabled app.');
24552465
return;
24562466
}
2457-
var router = vm.$route._router;
2467+
var router = vm.$route.router;
24582468
this.handler = function (e) {
24592469
if (e.button === 0) {
24602470
e.preventDefault();
@@ -2474,7 +2484,7 @@ return /******/ (function(modules) { // webpackBootstrap
24742484
updateClasses: function updateClasses(path) {
24752485
var el = this.el;
24762486
var dest = this.destination;
2477-
var router = this.vm.$route._router;
2487+
var router = this.vm.$route.router;
24782488
var activeClass = router._linkActiveClass;
24792489
var exactClass = activeClass + '-exact';
24802490
if (path.indexOf(dest) === 0 && path !== '/') {
@@ -2493,7 +2503,7 @@ return /******/ (function(modules) { // webpackBootstrap
24932503
this.destination = path;
24942504
this.updateClasses(this.vm.$route.path);
24952505
path = path || '';
2496-
var router = this.vm.$route._router;
2506+
var router = this.vm.$route.router;
24972507
var isAbsolute = path.charAt(0) === '/';
24982508
// do not format non-hash relative paths
24992509
var href = router.mode === 'hash' || isAbsolute ? router.history.formatPath(path) : path;
@@ -2533,7 +2543,7 @@ return /******/ (function(modules) { // webpackBootstrap
25332543
Vue.prototype.$addChild = function (opts, Ctor) {
25342544

25352545
var route = this.$route;
2536-
var router = route && route._router;
2546+
var router = route && route.router;
25372547

25382548
// inject meta
25392549
if (router) {

0 commit comments

Comments
 (0)