|
1 | 1 | /*!
|
2 |
| - * vue-router v0.7.4 |
| 2 | + * vue-router v0.7.5 |
3 | 3 | * (c) 2015 Evan You
|
4 | 4 | * Released under the MIT License.
|
5 | 5 | */
|
@@ -344,7 +344,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
344 | 344 | throw new Error('Must start vue-router with a component and a ' + 'root container.');
|
345 | 345 | }
|
346 | 346 | this._appContainer = container;
|
347 |
| - this._appConstructor = typeof App === 'function' ? App : Vue.extend(App); |
| 347 | + var Ctor = this._appConstructor = typeof App === 'function' ? App : Vue.extend(App); |
| 348 | + // give it a name for better debugging |
| 349 | + Ctor.options.name = Ctor.options.name || 'RouterApp'; |
348 | 350 | }
|
349 | 351 | this.history.start();
|
350 | 352 | };
|
@@ -2683,22 +2685,28 @@ return /******/ (function(modules) { // webpackBootstrap
|
2683 | 2685 | if (e.button !== 0) return;
|
2684 | 2686 |
|
2685 | 2687 | var target = _this.target;
|
2686 |
| - if (_this.el.tagName === 'A' || e.target === _this.el) { |
2687 |
| - // v-link on <a v-link="'path'"> |
| 2688 | + var go = function go(target) { |
2688 | 2689 | e.preventDefault();
|
2689 | 2690 | if (target != null) {
|
2690 | 2691 | router.go(target);
|
2691 | 2692 | }
|
| 2693 | + }; |
| 2694 | + |
| 2695 | + if (_this.el.tagName === 'A' || e.target === _this.el) { |
| 2696 | + // v-link on <a v-link="'path'"> |
| 2697 | + go(target); |
2692 | 2698 | } else {
|
2693 | 2699 | // v-link delegate on <div v-link>
|
2694 | 2700 | var el = e.target;
|
2695 | 2701 | while (el && el.tagName !== 'A' && el !== _this.el) {
|
2696 | 2702 | el = el.parentNode;
|
2697 | 2703 | }
|
2698 |
| - if (!el || el.tagName !== 'A' || !el.href) return; |
2699 |
| - if (sameOrigin(el)) { |
2700 |
| - e.preventDefault(); |
2701 |
| - router.go({ |
| 2704 | + if (!el) return; |
| 2705 | + if (el.tagName !== 'A' || !el.href) { |
| 2706 | + // allow not anchor |
| 2707 | + go(target); |
| 2708 | + } else if (sameOrigin(el)) { |
| 2709 | + go({ |
2702 | 2710 | path: el.pathname,
|
2703 | 2711 | replace: target && target.replace,
|
2704 | 2712 | append: target && target.append
|
|
0 commit comments