|
1 | 1 | /** |
2 | | - * vue-class-component v5.0.1 |
| 2 | + * vue-class-component v5.0.2 |
3 | 3 | * (c) 2015-2017 Evan You |
4 | 4 | * @license MIT |
5 | 5 | */ |
|
9 | 9 | (factory((global.VueClassComponent = global.VueClassComponent || {}),global.Vue)); |
10 | 10 | }(this, (function (exports,Vue) { 'use strict'; |
11 | 11 |
|
12 | | -Vue = 'default' in Vue ? Vue['default'] : Vue; |
| 12 | +Vue = Vue && 'default' in Vue ? Vue['default'] : Vue; |
13 | 13 |
|
14 | 14 | function createDecorator(factory) { |
15 | | - return function (_, key, index) { |
| 15 | + return function (target, key, index) { |
| 16 | + var Ctor = target.constructor; |
| 17 | + if (!Ctor.__decorators__) { |
| 18 | + Ctor.__decorators__ = []; |
| 19 | + } |
16 | 20 | if (typeof index !== 'number') { |
17 | 21 | index = undefined; |
18 | 22 | } |
19 | | - $decoratorQueue.push(function (options) { return factory(options, key, index); }); |
| 23 | + Ctor.__decorators__.push(function (options) { return factory(options, key, index); }); |
20 | 24 | }; |
21 | 25 | } |
22 | 26 | function warn(message) { |
@@ -75,7 +79,6 @@ var $internalHooks = [ |
75 | 79 | 'deactivated', |
76 | 80 | 'render' |
77 | 81 | ]; |
78 | | -var $decoratorQueue = []; |
79 | 82 | function componentFactory(Component, options) { |
80 | 83 | if (options === void 0) { options = {}; } |
81 | 84 | options.name = options.name || Component._componentTag || Component.name; |
@@ -104,8 +107,10 @@ function componentFactory(Component, options) { |
104 | 107 | return collectDataFromConstructor(this, Component); |
105 | 108 | } |
106 | 109 | }); |
107 | | - $decoratorQueue.forEach(function (fn) { return fn(options); }); |
108 | | - $decoratorQueue = []; |
| 110 | + var decorators = Component.__decorators__; |
| 111 | + if (decorators) { |
| 112 | + decorators.forEach(function (fn) { return fn(options); }); |
| 113 | + } |
109 | 114 | var superProto = Object.getPrototypeOf(Component.prototype); |
110 | 115 | var Super = superProto instanceof Vue |
111 | 116 | ? superProto.constructor |
|
0 commit comments