|
1 | 1 | (function (global, factory) { |
2 | | - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('vue-property-decorator'), require('vue-class-component'), require('reflect-metadata'), require('vuex-class')) : |
3 | | - typeof define === 'function' && define.amd ? define(['exports', 'vue', 'vue-property-decorator', 'vue-class-component', 'reflect-metadata', 'vuex-class'], factory) : |
4 | | - (factory((global.NuxtPropertyDecorator = {}),global.Vue,global.vuePropertyDecorator,global.VueClassComponent,null,global.vuexClass)); |
5 | | -}(this, (function (exports,vue,vuePropertyDecorator,Component,reflectMetadata,vuexClass) { 'use strict'; |
| 2 | + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('vue-property-decorator'), require('vue-class-component'), require('reflect-metadata'), require('vuex-class')) : |
| 3 | + typeof define === 'function' && define.amd ? define(['exports', 'vue', 'vue-property-decorator', 'vue-class-component', 'reflect-metadata', 'vuex-class'], factory) : |
| 4 | + (global = global || self, factory(global.NuxtPropertyDecorator = {}, global.Vue, global.VuePropertyDecorator, global.VueClassComponent, null, global.VuexClass)); |
| 5 | +}(this, function (exports, vue, vuePropertyDecorator, Component, reflectMetadata, vuexClass) { 'use strict'; |
6 | 6 |
|
7 | | -vue = vue && vue.hasOwnProperty('default') ? vue['default'] : vue; |
8 | | -var Component__default = 'default' in Component ? Component['default'] : Component; |
| 7 | + vue = vue && vue.hasOwnProperty('default') ? vue['default'] : vue; |
| 8 | + var Component__default = 'default' in Component ? Component['default'] : Component; |
9 | 9 |
|
10 | | -Component__default.registerHooks([ |
11 | | - 'beforeRouteEnter', |
12 | | - 'beforeRouteUpdate', |
13 | | - 'beforeRouteLeave', |
14 | | - 'asyncData', |
15 | | - 'fetch', |
16 | | - 'head', |
17 | | - 'middleware', |
18 | | - 'layout', |
19 | | - 'transition', |
20 | | - 'scrollToTop', |
21 | | - 'validate' |
22 | | -]); |
23 | | -// const Component = require('nuxt-class-component'); |
24 | | -// const { createDecorator } = require('nuxt-class-component'); |
25 | | -// Code copied from Vue/src/shared/util.js |
26 | | -var hyphenateRE = /\B([A-Z])/g; |
27 | | -var hyphenate = function (str) { return str.replace(hyphenateRE, '-$1').toLowerCase(); }; |
28 | | -/** |
29 | | - * decorator of $off |
30 | | - * @param event The name of the event |
31 | | - * @param method The name of the method |
32 | | - */ |
33 | | -function Off(event, method) { |
34 | | - return function (target, key, descriptor) { |
35 | | - key = hyphenate(key); |
36 | | - var original = descriptor.value; |
37 | | - descriptor.value = function offer() { |
38 | | - var args = []; |
39 | | - for (var _i = 0; _i < arguments.length; _i++) { |
40 | | - args[_i] = arguments[_i]; |
41 | | - } |
42 | | - if (original.apply(this, args) !== false) { |
43 | | - if (method) { |
44 | | - if (typeof this[method] === 'function') { |
45 | | - this.$off(event || key, this[method]); |
46 | | - } |
47 | | - else { |
48 | | - throw new TypeError('must be a method name'); |
49 | | - } |
50 | | - } |
51 | | - else if (event) { |
52 | | - this.$off(event || key); |
53 | | - } |
54 | | - else { |
55 | | - this.$off(); |
56 | | - } |
57 | | - } |
58 | | - }; |
59 | | - }; |
60 | | -} |
61 | | -/** |
62 | | - * decorator of $on |
63 | | - * @param event The name of the event |
64 | | - */ |
65 | | -function On(event) { |
66 | | - return Component.createDecorator(function (componentOptions, k) { |
67 | | - var key = hyphenate(k); |
68 | | - if (typeof componentOptions.created !== 'function') { |
69 | | - componentOptions.created = function () { }; |
70 | | - } |
71 | | - var original = componentOptions.created; |
72 | | - componentOptions.created = function () { |
73 | | - original(); |
74 | | - if (typeof componentOptions.methods !== 'undefined') { |
75 | | - this.$on(event || key, componentOptions.methods[k]); |
76 | | - } |
77 | | - }; |
78 | | - }); |
79 | | -} |
80 | | -/** |
81 | | - * decorator of $once |
82 | | - * @param event The name of the event |
83 | | - */ |
84 | | -function Once(event) { |
85 | | - return Component.createDecorator(function (componentOptions, k) { |
86 | | - var key = hyphenate(k); |
87 | | - if (typeof componentOptions.created !== 'function') { |
88 | | - componentOptions.created = function () { }; |
89 | | - } |
90 | | - var original = componentOptions.created; |
91 | | - componentOptions.created = function () { |
92 | | - original(); |
93 | | - if (typeof componentOptions.methods !== 'undefined') { |
94 | | - this.$once(event || key, componentOptions.methods[k]); |
95 | | - } |
96 | | - }; |
97 | | - }); |
98 | | -} |
99 | | -/** |
100 | | - * decorator of $nextTick |
101 | | - * |
102 | | - * @export |
103 | | - * @param {string} method |
104 | | - * @returns {MethodDecorator} |
105 | | - */ |
106 | | -function NextTick(method) { |
107 | | - return function (target, key, descriptor) { |
108 | | - var original = descriptor.value; |
109 | | - descriptor.value = function emitter() { |
110 | | - var args = []; |
111 | | - for (var _i = 0; _i < arguments.length; _i++) { |
112 | | - args[_i] = arguments[_i]; |
113 | | - } |
114 | | - if (original.apply(this, args) !== false) |
115 | | - if (typeof this[method] === 'function') { |
116 | | - this.$nextTick(this[method]); |
117 | | - } |
118 | | - else { |
119 | | - throw new TypeError('must be a method name'); |
120 | | - } |
121 | | - }; |
122 | | - }; |
123 | | -} |
| 10 | + Component__default.registerHooks([ |
| 11 | + 'beforeRouteEnter', |
| 12 | + 'beforeRouteUpdate', |
| 13 | + 'beforeRouteLeave', |
| 14 | + 'asyncData', |
| 15 | + 'fetch', |
| 16 | + 'head', |
| 17 | + 'middleware', |
| 18 | + 'layout', |
| 19 | + 'transition', |
| 20 | + 'scrollToTop', |
| 21 | + 'validate' |
| 22 | + ]); |
| 23 | + // Code copied from Vue/src/shared/util.js |
| 24 | + var hyphenateRE = /\B([A-Z])/g; |
| 25 | + var hyphenate = function (str) { return str.replace(hyphenateRE, '-$1').toLowerCase(); }; |
| 26 | + /** |
| 27 | + * decorator of $off |
| 28 | + * @param event The name of the event |
| 29 | + * @param method The name of the method |
| 30 | + */ |
| 31 | + function Off(event, method) { |
| 32 | + return function (target, key, descriptor) { |
| 33 | + key = hyphenate(key); |
| 34 | + var original = descriptor.value; |
| 35 | + descriptor.value = function offer() { |
| 36 | + var args = []; |
| 37 | + for (var _i = 0; _i < arguments.length; _i++) { |
| 38 | + args[_i] = arguments[_i]; |
| 39 | + } |
| 40 | + if (original.apply(this, args) !== false) { |
| 41 | + if (method) { |
| 42 | + if (typeof this[method] === 'function') { |
| 43 | + this.$off(event || key, this[method]); |
| 44 | + } |
| 45 | + else { |
| 46 | + throw new TypeError('must be a method name'); |
| 47 | + } |
| 48 | + } |
| 49 | + else if (event) { |
| 50 | + this.$off(event || key); |
| 51 | + } |
| 52 | + else { |
| 53 | + this.$off(); |
| 54 | + } |
| 55 | + } |
| 56 | + }; |
| 57 | + }; |
| 58 | + } |
| 59 | + /** |
| 60 | + * decorator of $on |
| 61 | + * @param event The name of the event |
| 62 | + */ |
| 63 | + function On(event) { |
| 64 | + return Component.createDecorator(function (componentOptions, k) { |
| 65 | + var key = hyphenate(k); |
| 66 | + if (typeof componentOptions.created !== 'function') { |
| 67 | + componentOptions.created = function () { }; |
| 68 | + } |
| 69 | + var original = componentOptions.created; |
| 70 | + componentOptions.created = function () { |
| 71 | + original(); |
| 72 | + if (typeof componentOptions.methods !== 'undefined') { |
| 73 | + this.$on(event || key, componentOptions.methods[k]); |
| 74 | + } |
| 75 | + }; |
| 76 | + }); |
| 77 | + } |
| 78 | + /** |
| 79 | + * decorator of $once |
| 80 | + * @param event The name of the event |
| 81 | + */ |
| 82 | + function Once(event) { |
| 83 | + return Component.createDecorator(function (componentOptions, k) { |
| 84 | + var key = hyphenate(k); |
| 85 | + if (typeof componentOptions.created !== 'function') { |
| 86 | + componentOptions.created = function () { }; |
| 87 | + } |
| 88 | + var original = componentOptions.created; |
| 89 | + componentOptions.created = function () { |
| 90 | + original(); |
| 91 | + if (typeof componentOptions.methods !== 'undefined') { |
| 92 | + this.$once(event || key, componentOptions.methods[k]); |
| 93 | + } |
| 94 | + }; |
| 95 | + }); |
| 96 | + } |
| 97 | + /** |
| 98 | + * decorator of $nextTick |
| 99 | + * |
| 100 | + * @export |
| 101 | + * @param {string} method |
| 102 | + * @returns {MethodDecorator} |
| 103 | + */ |
| 104 | + function NextTick(method) { |
| 105 | + return function (target, key, descriptor) { |
| 106 | + var original = descriptor.value; |
| 107 | + descriptor.value = function emitter() { |
| 108 | + var args = []; |
| 109 | + for (var _i = 0; _i < arguments.length; _i++) { |
| 110 | + args[_i] = arguments[_i]; |
| 111 | + } |
| 112 | + if (original.apply(this, args) !== false) |
| 113 | + if (typeof this[method] === 'function') { |
| 114 | + this.$nextTick(this[method]); |
| 115 | + } |
| 116 | + else { |
| 117 | + throw new TypeError('must be a method name'); |
| 118 | + } |
| 119 | + }; |
| 120 | + }; |
| 121 | + } |
124 | 122 |
|
125 | | -exports.Off = Off; |
126 | | -exports.On = On; |
127 | | -exports.Once = Once; |
128 | | -exports.NextTick = NextTick; |
129 | | -exports.Vue = vue; |
130 | | -exports.Component = Component__default; |
131 | | -exports.Emit = vuePropertyDecorator.Emit; |
132 | | -exports.Inject = vuePropertyDecorator.Inject; |
133 | | -exports.Model = vuePropertyDecorator.Model; |
134 | | -exports.Prop = vuePropertyDecorator.Prop; |
135 | | -exports.Provide = vuePropertyDecorator.Provide; |
136 | | -exports.Watch = vuePropertyDecorator.Watch; |
137 | | -exports.mixins = Component.mixins; |
138 | | -exports.State = vuexClass.State; |
139 | | -exports.Getter = vuexClass.Getter; |
140 | | -exports.Action = vuexClass.Action; |
141 | | -exports.Mutation = vuexClass.Mutation; |
142 | | -exports.namespace = vuexClass.namespace; |
| 123 | + exports.Vue = vue; |
| 124 | + exports.Emit = vuePropertyDecorator.Emit; |
| 125 | + exports.Inject = vuePropertyDecorator.Inject; |
| 126 | + exports.Model = vuePropertyDecorator.Model; |
| 127 | + exports.Prop = vuePropertyDecorator.Prop; |
| 128 | + exports.Provide = vuePropertyDecorator.Provide; |
| 129 | + exports.Watch = vuePropertyDecorator.Watch; |
| 130 | + exports.Component = Component__default; |
| 131 | + exports.mixins = Component.mixins; |
| 132 | + exports.State = vuexClass.State; |
| 133 | + exports.Getter = vuexClass.Getter; |
| 134 | + exports.Action = vuexClass.Action; |
| 135 | + exports.Mutation = vuexClass.Mutation; |
| 136 | + exports.namespace = vuexClass.namespace; |
| 137 | + exports.Off = Off; |
| 138 | + exports.On = On; |
| 139 | + exports.Once = Once; |
| 140 | + exports.NextTick = NextTick; |
143 | 141 |
|
144 | | -Object.defineProperty(exports, '__esModule', { value: true }); |
| 142 | + Object.defineProperty(exports, '__esModule', { value: true }); |
145 | 143 |
|
146 | | -}))); |
| 144 | +})); |
0 commit comments