1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | 'use strict';
|
7 |
|
8 |
|
9 |
|
10 | var emptyObject = Object.freeze({});
|
11 |
|
12 |
|
13 |
|
14 | function isUndef (v) {
|
15 | return v === undefined || v === null
|
16 | }
|
17 |
|
18 | function isDef (v) {
|
19 | return v !== undefined && v !== null
|
20 | }
|
21 |
|
22 | function isTrue (v) {
|
23 | return v === true
|
24 | }
|
25 |
|
26 | function isFalse (v) {
|
27 | return v === false
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 |
|
33 | function isPrimitive (value) {
|
34 | return (
|
35 | typeof value === 'string' ||
|
36 | typeof value === 'number' ||
|
37 |
|
38 | typeof value === 'symbol' ||
|
39 | typeof value === 'boolean'
|
40 | )
|
41 | }
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | function isObject (obj) {
|
49 | return obj !== null && typeof obj === 'object'
|
50 | }
|
51 |
|
52 |
|
53 |
|
54 |
|
55 | var _toString = Object.prototype.toString;
|
56 |
|
57 | function toRawType (value) {
|
58 | return _toString.call(value).slice(8, -1)
|
59 | }
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | function isPlainObject (obj) {
|
66 | return _toString.call(obj) === '[object Object]'
|
67 | }
|
68 |
|
69 | function isRegExp (v) {
|
70 | return _toString.call(v) === '[object RegExp]'
|
71 | }
|
72 |
|
73 |
|
74 |
|
75 |
|
76 | function isValidArrayIndex (val) {
|
77 | var n = parseFloat(String(val));
|
78 | return n >= 0 && Math.floor(n) === n && isFinite(val)
|
79 | }
|
80 |
|
81 | function isPromise (val) {
|
82 | return (
|
83 | isDef(val) &&
|
84 | typeof val.then === 'function' &&
|
85 | typeof val.catch === 'function'
|
86 | )
|
87 | }
|
88 |
|
89 |
|
90 |
|
91 |
|
92 | function toString (val) {
|
93 | return val == null
|
94 | ? ''
|
95 | : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
|
96 | ? JSON.stringify(val, null, 2)
|
97 | : String(val)
|
98 | }
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 | function toNumber (val) {
|
105 | var n = parseFloat(val);
|
106 | return isNaN(n) ? val : n
|
107 | }
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 | function makeMap (
|
114 | str,
|
115 | expectsLowerCase
|
116 | ) {
|
117 | var map = Object.create(null);
|
118 | var list = str.split(',');
|
119 | for (var i = 0; i < list.length; i++) {
|
120 | map[list[i]] = true;
|
121 | }
|
122 | return expectsLowerCase
|
123 | ? function (val) { return map[val.toLowerCase()]; }
|
124 | : function (val) { return map[val]; }
|
125 | }
|
126 |
|
127 |
|
128 |
|
129 |
|
130 | var isBuiltInTag = makeMap('slot,component', true);
|
131 |
|
132 |
|
133 |
|
134 |
|
135 | var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
|
136 |
|
137 |
|
138 |
|
139 |
|
140 | function remove (arr, item) {
|
141 | if (arr.length) {
|
142 | var index = arr.indexOf(item);
|
143 | if (index > -1) {
|
144 | return arr.splice(index, 1)
|
145 | }
|
146 | }
|
147 | }
|
148 |
|
149 |
|
150 |
|
151 |
|
152 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
153 | function hasOwn (obj, key) {
|
154 | return hasOwnProperty.call(obj, key)
|
155 | }
|
156 |
|
157 |
|
158 |
|
159 |
|
160 | function cached (fn) {
|
161 | var cache = Object.create(null);
|
162 | return (function cachedFn (str) {
|
163 | var hit = cache[str];
|
164 | return hit || (cache[str] = fn(str))
|
165 | })
|
166 | }
|
167 |
|
168 |
|
169 |
|
170 |
|
171 | var camelizeRE = /-(\w)/g;
|
172 | var camelize = cached(function (str) {
|
173 | return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
|
174 | });
|
175 |
|
176 |
|
177 |
|
178 |
|
179 | var capitalize = cached(function (str) {
|
180 | return str.charAt(0).toUpperCase() + str.slice(1)
|
181 | });
|
182 |
|
183 |
|
184 |
|
185 |
|
186 | var hyphenateRE = /\B([A-Z])/g;
|
187 | var hyphenate = cached(function (str) {
|
188 | return str.replace(hyphenateRE, '-$1').toLowerCase()
|
189 | });
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 | function polyfillBind (fn, ctx) {
|
201 | function boundFn (a) {
|
202 | var l = arguments.length;
|
203 | return l
|
204 | ? l > 1
|
205 | ? fn.apply(ctx, arguments)
|
206 | : fn.call(ctx, a)
|
207 | : fn.call(ctx)
|
208 | }
|
209 |
|
210 | boundFn._length = fn.length;
|
211 | return boundFn
|
212 | }
|
213 |
|
214 | function nativeBind (fn, ctx) {
|
215 | return fn.bind(ctx)
|
216 | }
|
217 |
|
218 | var bind = Function.prototype.bind
|
219 | ? nativeBind
|
220 | : polyfillBind;
|
221 |
|
222 |
|
223 |
|
224 |
|
225 | function toArray (list, start) {
|
226 | start = start || 0;
|
227 | var i = list.length - start;
|
228 | var ret = new Array(i);
|
229 | while (i--) {
|
230 | ret[i] = list[i + start];
|
231 | }
|
232 | return ret
|
233 | }
|
234 |
|
235 |
|
236 |
|
237 |
|
238 | function extend (to, _from) {
|
239 | for (var key in _from) {
|
240 | to[key] = _from[key];
|
241 | }
|
242 | return to
|
243 | }
|
244 |
|
245 |
|
246 |
|
247 |
|
248 | function toObject (arr) {
|
249 | var res = {};
|
250 | for (var i = 0; i < arr.length; i++) {
|
251 | if (arr[i]) {
|
252 | extend(res, arr[i]);
|
253 | }
|
254 | }
|
255 | return res
|
256 | }
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 | function noop (a, b, c) {}
|
266 |
|
267 |
|
268 |
|
269 |
|
270 | var no = function (a, b, c) { return false; };
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 | var identity = function (_) { return _; };
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 | function looseEqual (a, b) {
|
284 | if (a === b) { return true }
|
285 | var isObjectA = isObject(a);
|
286 | var isObjectB = isObject(b);
|
287 | if (isObjectA && isObjectB) {
|
288 | try {
|
289 | var isArrayA = Array.isArray(a);
|
290 | var isArrayB = Array.isArray(b);
|
291 | if (isArrayA && isArrayB) {
|
292 | return a.length === b.length && a.every(function (e, i) {
|
293 | return looseEqual(e, b[i])
|
294 | })
|
295 | } else if (a instanceof Date && b instanceof Date) {
|
296 | return a.getTime() === b.getTime()
|
297 | } else if (!isArrayA && !isArrayB) {
|
298 | var keysA = Object.keys(a);
|
299 | var keysB = Object.keys(b);
|
300 | return keysA.length === keysB.length && keysA.every(function (key) {
|
301 | return looseEqual(a[key], b[key])
|
302 | })
|
303 | } else {
|
304 |
|
305 | return false
|
306 | }
|
307 | } catch (e) {
|
308 |
|
309 | return false
|
310 | }
|
311 | } else if (!isObjectA && !isObjectB) {
|
312 | return String(a) === String(b)
|
313 | } else {
|
314 | return false
|
315 | }
|
316 | }
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 | function looseIndexOf (arr, val) {
|
324 | for (var i = 0; i < arr.length; i++) {
|
325 | if (looseEqual(arr[i], val)) { return i }
|
326 | }
|
327 | return -1
|
328 | }
|
329 |
|
330 |
|
331 |
|
332 |
|
333 | function once (fn) {
|
334 | var called = false;
|
335 | return function () {
|
336 | if (!called) {
|
337 | called = true;
|
338 | fn.apply(this, arguments);
|
339 | }
|
340 | }
|
341 | }
|
342 |
|
343 | var SSR_ATTR = 'data-server-rendered';
|
344 |
|
345 | var ASSET_TYPES = [
|
346 | 'component',
|
347 | 'directive',
|
348 | 'filter'
|
349 | ];
|
350 |
|
351 | var LIFECYCLE_HOOKS = [
|
352 | 'beforeCreate',
|
353 | 'created',
|
354 | 'beforeMount',
|
355 | 'mounted',
|
356 | 'beforeUpdate',
|
357 | 'updated',
|
358 | 'beforeDestroy',
|
359 | 'destroyed',
|
360 | 'activated',
|
361 | 'deactivated',
|
362 | 'errorCaptured',
|
363 | 'serverPrefetch'
|
364 | ];
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 | var config = ({
|
371 | |
372 |
|
373 |
|
374 |
|
375 | optionMergeStrategies: Object.create(null),
|
376 |
|
377 | |
378 |
|
379 |
|
380 | silent: false,
|
381 |
|
382 | |
383 |
|
384 |
|
385 | productionTip: "development" !== 'production',
|
386 |
|
387 | |
388 |
|
389 |
|
390 | devtools: "development" !== 'production',
|
391 |
|
392 | |
393 |
|
394 |
|
395 | performance: false,
|
396 |
|
397 | |
398 |
|
399 |
|
400 | errorHandler: null,
|
401 |
|
402 | |
403 |
|
404 |
|
405 | warnHandler: null,
|
406 |
|
407 | |
408 |
|
409 |
|
410 | ignoredElements: [],
|
411 |
|
412 | |
413 |
|
414 |
|
415 |
|
416 | keyCodes: Object.create(null),
|
417 |
|
418 | |
419 |
|
420 |
|
421 |
|
422 | isReservedTag: no,
|
423 |
|
424 | |
425 |
|
426 |
|
427 |
|
428 | isReservedAttr: no,
|
429 |
|
430 | |
431 |
|
432 |
|
433 |
|
434 | isUnknownElement: no,
|
435 |
|
436 | |
437 |
|
438 |
|
439 | getTagNamespace: noop,
|
440 |
|
441 | |
442 |
|
443 |
|
444 | parsePlatformTagName: identity,
|
445 |
|
446 | |
447 |
|
448 |
|
449 |
|
450 | mustUseProp: no,
|
451 |
|
452 | |
453 |
|
454 |
|
455 |
|
456 | async: true,
|
457 |
|
458 | |
459 |
|
460 |
|
461 | _lifecycleHooks: LIFECYCLE_HOOKS
|
462 | });
|
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 | var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
|
472 |
|
473 |
|
474 |
|
475 |
|
476 | function isReserved (str) {
|
477 | var c = (str + '').charCodeAt(0);
|
478 | return c === 0x24 || c === 0x5F
|
479 | }
|
480 |
|
481 |
|
482 |
|
483 |
|
484 | function def (obj, key, val, enumerable) {
|
485 | Object.defineProperty(obj, key, {
|
486 | value: val,
|
487 | enumerable: !!enumerable,
|
488 | writable: true,
|
489 | configurable: true
|
490 | });
|
491 | }
|
492 |
|
493 |
|
494 |
|
495 |
|
496 | var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
|
497 | function parsePath (path) {
|
498 | if (bailRE.test(path)) {
|
499 | return
|
500 | }
|
501 | var segments = path.split('.');
|
502 | return function (obj) {
|
503 | for (var i = 0; i < segments.length; i++) {
|
504 | if (!obj) { return }
|
505 | obj = obj[segments[i]];
|
506 | }
|
507 | return obj
|
508 | }
|
509 | }
|
510 |
|
511 |
|
512 |
|
513 |
|
514 | var hasProto = '__proto__' in {};
|
515 |
|
516 |
|
517 | var inBrowser = typeof window !== 'undefined';
|
518 | var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
|
519 | var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
|
520 | var UA = inBrowser && window.navigator.userAgent.toLowerCase();
|
521 | var isIE = UA && /msie|trident/.test(UA);
|
522 | var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
|
523 | var isEdge = UA && UA.indexOf('edge/') > 0;
|
524 | var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
|
525 | var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
|
526 | var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
|
527 | var isPhantomJS = UA && /phantomjs/.test(UA);
|
528 | var isFF = UA && UA.match(/firefox\/(\d+)/);
|
529 |
|
530 |
|
531 | var nativeWatch = ({}).watch;
|
532 |
|
533 | var supportsPassive = false;
|
534 | if (inBrowser) {
|
535 | try {
|
536 | var opts = {};
|
537 | Object.defineProperty(opts, 'passive', ({
|
538 | get: function get () {
|
539 |
|
540 | supportsPassive = true;
|
541 | }
|
542 | }));
|
543 | window.addEventListener('test-passive', null, opts);
|
544 | } catch (e) {}
|
545 | }
|
546 |
|
547 |
|
548 |
|
549 | var _isServer;
|
550 | var isServerRendering = function () {
|
551 | if (_isServer === undefined) {
|
552 |
|
553 | if (!inBrowser && !inWeex && typeof global !== 'undefined') {
|
554 |
|
555 |
|
556 | _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
|
557 | } else {
|
558 | _isServer = false;
|
559 | }
|
560 | }
|
561 | return _isServer
|
562 | };
|
563 |
|
564 |
|
565 | var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
566 |
|
567 |
|
568 | function isNative (Ctor) {
|
569 | return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
|
570 | }
|
571 |
|
572 | var hasSymbol =
|
573 | typeof Symbol !== 'undefined' && isNative(Symbol) &&
|
574 | typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
|
575 |
|
576 | var _Set;
|
577 |
|
578 | if (typeof Set !== 'undefined' && isNative(Set)) {
|
579 |
|
580 | _Set = Set;
|
581 | } else {
|
582 |
|
583 | _Set = (function () {
|
584 | function Set () {
|
585 | this.set = Object.create(null);
|
586 | }
|
587 | Set.prototype.has = function has (key) {
|
588 | return this.set[key] === true
|
589 | };
|
590 | Set.prototype.add = function add (key) {
|
591 | this.set[key] = true;
|
592 | };
|
593 | Set.prototype.clear = function clear () {
|
594 | this.set = Object.create(null);
|
595 | };
|
596 |
|
597 | return Set;
|
598 | }());
|
599 | }
|
600 |
|
601 |
|
602 |
|
603 | var warn = noop;
|
604 | var tip = noop;
|
605 | var generateComponentTrace = (noop);
|
606 | var formatComponentName = (noop);
|
607 |
|
608 | {
|
609 | var hasConsole = typeof console !== 'undefined';
|
610 | var classifyRE = /(?:^|[-_])(\w)/g;
|
611 | var classify = function (str) { return str
|
612 | .replace(classifyRE, function (c) { return c.toUpperCase(); })
|
613 | .replace(/[-_]/g, ''); };
|
614 |
|
615 | warn = function (msg, vm) {
|
616 | var trace = vm ? generateComponentTrace(vm) : '';
|
617 |
|
618 | if (config.warnHandler) {
|
619 | config.warnHandler.call(null, msg, vm, trace);
|
620 | } else if (hasConsole && (!config.silent)) {
|
621 | console.error(("[Vue warn]: " + msg + trace));
|
622 | }
|
623 | };
|
624 |
|
625 | tip = function (msg, vm) {
|
626 | if (hasConsole && (!config.silent)) {
|
627 | console.warn("[Vue tip]: " + msg + (
|
628 | vm ? generateComponentTrace(vm) : ''
|
629 | ));
|
630 | }
|
631 | };
|
632 |
|
633 | formatComponentName = function (vm, includeFile) {
|
634 | if (vm.$root === vm) {
|
635 | return '<Root>'
|
636 | }
|
637 | var options = typeof vm === 'function' && vm.cid != null
|
638 | ? vm.options
|
639 | : vm._isVue
|
640 | ? vm.$options || vm.constructor.options
|
641 | : vm;
|
642 | var name = options.name || options._componentTag;
|
643 | var file = options.__file;
|
644 | if (!name && file) {
|
645 | var match = file.match(/([^/\\]+)\.vue$/);
|
646 | name = match && match[1];
|
647 | }
|
648 |
|
649 | return (
|
650 | (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
|
651 | (file && includeFile !== false ? (" at " + file) : '')
|
652 | )
|
653 | };
|
654 |
|
655 | var repeat = function (str, n) {
|
656 | var res = '';
|
657 | while (n) {
|
658 | if (n % 2 === 1) { res += str; }
|
659 | if (n > 1) { str += str; }
|
660 | n >>= 1;
|
661 | }
|
662 | return res
|
663 | };
|
664 |
|
665 | generateComponentTrace = function (vm) {
|
666 | if (vm._isVue && vm.$parent) {
|
667 | var tree = [];
|
668 | var currentRecursiveSequence = 0;
|
669 | while (vm) {
|
670 | if (tree.length > 0) {
|
671 | var last = tree[tree.length - 1];
|
672 | if (last.constructor === vm.constructor) {
|
673 | currentRecursiveSequence++;
|
674 | vm = vm.$parent;
|
675 | continue
|
676 | } else if (currentRecursiveSequence > 0) {
|
677 | tree[tree.length - 1] = [last, currentRecursiveSequence];
|
678 | currentRecursiveSequence = 0;
|
679 | }
|
680 | }
|
681 | tree.push(vm);
|
682 | vm = vm.$parent;
|
683 | }
|
684 | return '\n\nfound in\n\n' + tree
|
685 | .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
|
686 | ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
|
687 | : formatComponentName(vm))); })
|
688 | .join('\n')
|
689 | } else {
|
690 | return ("\n\n(found in " + (formatComponentName(vm)) + ")")
|
691 | }
|
692 | };
|
693 | }
|
694 |
|
695 |
|
696 |
|
697 | var uid = 0;
|
698 |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 | var Dep = function Dep () {
|
704 | this.id = uid++;
|
705 | this.subs = [];
|
706 | };
|
707 |
|
708 | Dep.prototype.addSub = function addSub (sub) {
|
709 | this.subs.push(sub);
|
710 | };
|
711 |
|
712 | Dep.prototype.removeSub = function removeSub (sub) {
|
713 | remove(this.subs, sub);
|
714 | };
|
715 |
|
716 | Dep.prototype.depend = function depend () {
|
717 | if (Dep.target) {
|
718 | Dep.target.addDep(this);
|
719 | }
|
720 | };
|
721 |
|
722 | Dep.prototype.notify = function notify () {
|
723 |
|
724 | var subs = this.subs.slice();
|
725 | if (!config.async) {
|
726 |
|
727 |
|
728 |
|
729 | subs.sort(function (a, b) { return a.id - b.id; });
|
730 | }
|
731 | for (var i = 0, l = subs.length; i < l; i++) {
|
732 | subs[i].update();
|
733 | }
|
734 | };
|
735 |
|
736 |
|
737 |
|
738 |
|
739 | Dep.target = null;
|
740 | var targetStack = [];
|
741 |
|
742 | function pushTarget (target) {
|
743 | targetStack.push(target);
|
744 | Dep.target = target;
|
745 | }
|
746 |
|
747 | function popTarget () {
|
748 | targetStack.pop();
|
749 | Dep.target = targetStack[targetStack.length - 1];
|
750 | }
|
751 |
|
752 |
|
753 |
|
754 | var VNode = function VNode (
|
755 | tag,
|
756 | data,
|
757 | children,
|
758 | text,
|
759 | elm,
|
760 | context,
|
761 | componentOptions,
|
762 | asyncFactory
|
763 | ) {
|
764 | this.tag = tag;
|
765 | this.data = data;
|
766 | this.children = children;
|
767 | this.text = text;
|
768 | this.elm = elm;
|
769 | this.ns = undefined;
|
770 | this.context = context;
|
771 | this.fnContext = undefined;
|
772 | this.fnOptions = undefined;
|
773 | this.fnScopeId = undefined;
|
774 | this.key = data && data.key;
|
775 | this.componentOptions = componentOptions;
|
776 | this.componentInstance = undefined;
|
777 | this.parent = undefined;
|
778 | this.raw = false;
|
779 | this.isStatic = false;
|
780 | this.isRootInsert = true;
|
781 | this.isComment = false;
|
782 | this.isCloned = false;
|
783 | this.isOnce = false;
|
784 | this.asyncFactory = asyncFactory;
|
785 | this.asyncMeta = undefined;
|
786 | this.isAsyncPlaceholder = false;
|
787 | };
|
788 |
|
789 | var prototypeAccessors = { child: { configurable: true } };
|
790 |
|
791 |
|
792 |
|
793 | prototypeAccessors.child.get = function () {
|
794 | return this.componentInstance
|
795 | };
|
796 |
|
797 | Object.defineProperties( VNode.prototype, prototypeAccessors );
|
798 |
|
799 | var createEmptyVNode = function (text) {
|
800 | if ( text === void 0 ) text = '';
|
801 |
|
802 | var node = new VNode();
|
803 | node.text = text;
|
804 | node.isComment = true;
|
805 | return node
|
806 | };
|
807 |
|
808 | function createTextVNode (val) {
|
809 | return new VNode(undefined, undefined, undefined, String(val))
|
810 | }
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 | function cloneVNode (vnode) {
|
817 | var cloned = new VNode(
|
818 | vnode.tag,
|
819 | vnode.data,
|
820 |
|
821 |
|
822 |
|
823 | vnode.children && vnode.children.slice(),
|
824 | vnode.text,
|
825 | vnode.elm,
|
826 | vnode.context,
|
827 | vnode.componentOptions,
|
828 | vnode.asyncFactory
|
829 | );
|
830 | cloned.ns = vnode.ns;
|
831 | cloned.isStatic = vnode.isStatic;
|
832 | cloned.key = vnode.key;
|
833 | cloned.isComment = vnode.isComment;
|
834 | cloned.fnContext = vnode.fnContext;
|
835 | cloned.fnOptions = vnode.fnOptions;
|
836 | cloned.fnScopeId = vnode.fnScopeId;
|
837 | cloned.asyncMeta = vnode.asyncMeta;
|
838 | cloned.isCloned = true;
|
839 | return cloned
|
840 | }
|
841 |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 |
|
847 | var arrayProto = Array.prototype;
|
848 | var arrayMethods = Object.create(arrayProto);
|
849 |
|
850 | var methodsToPatch = [
|
851 | 'push',
|
852 | 'pop',
|
853 | 'shift',
|
854 | 'unshift',
|
855 | 'splice',
|
856 | 'sort',
|
857 | 'reverse'
|
858 | ];
|
859 |
|
860 |
|
861 |
|
862 |
|
863 | methodsToPatch.forEach(function (method) {
|
864 |
|
865 | var original = arrayProto[method];
|
866 | def(arrayMethods, method, function mutator () {
|
867 | var args = [], len = arguments.length;
|
868 | while ( len-- ) args[ len ] = arguments[ len ];
|
869 |
|
870 | var result = original.apply(this, args);
|
871 | var ob = this.__ob__;
|
872 | var inserted;
|
873 | switch (method) {
|
874 | case 'push':
|
875 | case 'unshift':
|
876 | inserted = args;
|
877 | break
|
878 | case 'splice':
|
879 | inserted = args.slice(2);
|
880 | break
|
881 | }
|
882 | if (inserted) { ob.observeArray(inserted); }
|
883 |
|
884 | ob.dep.notify();
|
885 | return result
|
886 | });
|
887 | });
|
888 |
|
889 |
|
890 |
|
891 | var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 | var shouldObserve = true;
|
898 |
|
899 | function toggleObserving (value) {
|
900 | shouldObserve = value;
|
901 | }
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 | var Observer = function Observer (value) {
|
910 | this.value = value;
|
911 | this.dep = new Dep();
|
912 | this.vmCount = 0;
|
913 | def(value, '__ob__', this);
|
914 | if (Array.isArray(value)) {
|
915 | if (hasProto) {
|
916 | protoAugment(value, arrayMethods);
|
917 | } else {
|
918 | copyAugment(value, arrayMethods, arrayKeys);
|
919 | }
|
920 | this.observeArray(value);
|
921 | } else {
|
922 | this.walk(value);
|
923 | }
|
924 | };
|
925 |
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 | Observer.prototype.walk = function walk (obj) {
|
932 | var keys = Object.keys(obj);
|
933 | for (var i = 0; i < keys.length; i++) {
|
934 | defineReactive$$1(obj, keys[i]);
|
935 | }
|
936 | };
|
937 |
|
938 |
|
939 |
|
940 |
|
941 | Observer.prototype.observeArray = function observeArray (items) {
|
942 | for (var i = 0, l = items.length; i < l; i++) {
|
943 | observe(items[i]);
|
944 | }
|
945 | };
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 | function protoAugment (target, src) {
|
954 |
|
955 | target.__proto__ = src;
|
956 |
|
957 | }
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 | function copyAugment (target, src, keys) {
|
965 | for (var i = 0, l = keys.length; i < l; i++) {
|
966 | var key = keys[i];
|
967 | def(target, key, src[key]);
|
968 | }
|
969 | }
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 | function observe (value, asRootData) {
|
977 | if (!isObject(value) || value instanceof VNode) {
|
978 | return
|
979 | }
|
980 | var ob;
|
981 | if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
982 | ob = value.__ob__;
|
983 | } else if (
|
984 | shouldObserve &&
|
985 | !isServerRendering() &&
|
986 | (Array.isArray(value) || isPlainObject(value)) &&
|
987 | Object.isExtensible(value) &&
|
988 | !value._isVue
|
989 | ) {
|
990 | ob = new Observer(value);
|
991 | }
|
992 | if (asRootData && ob) {
|
993 | ob.vmCount++;
|
994 | }
|
995 | return ob
|
996 | }
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 | function defineReactive$$1 (
|
1002 | obj,
|
1003 | key,
|
1004 | val,
|
1005 | customSetter,
|
1006 | shallow
|
1007 | ) {
|
1008 | var dep = new Dep();
|
1009 |
|
1010 | var property = Object.getOwnPropertyDescriptor(obj, key);
|
1011 | if (property && property.configurable === false) {
|
1012 | return
|
1013 | }
|
1014 |
|
1015 |
|
1016 | var getter = property && property.get;
|
1017 | var setter = property && property.set;
|
1018 | if ((!getter || setter) && arguments.length === 2) {
|
1019 | val = obj[key];
|
1020 | }
|
1021 |
|
1022 | var childOb = !shallow && observe(val);
|
1023 | Object.defineProperty(obj, key, {
|
1024 | enumerable: true,
|
1025 | configurable: true,
|
1026 | get: function reactiveGetter () {
|
1027 | var value = getter ? getter.call(obj) : val;
|
1028 | if (Dep.target) {
|
1029 | dep.depend();
|
1030 | if (childOb) {
|
1031 | childOb.dep.depend();
|
1032 | if (Array.isArray(value)) {
|
1033 | dependArray(value);
|
1034 | }
|
1035 | }
|
1036 | }
|
1037 | return value
|
1038 | },
|
1039 | set: function reactiveSetter (newVal) {
|
1040 | var value = getter ? getter.call(obj) : val;
|
1041 |
|
1042 | if (newVal === value || (newVal !== newVal && value !== value)) {
|
1043 | return
|
1044 | }
|
1045 |
|
1046 | if (customSetter) {
|
1047 | customSetter();
|
1048 | }
|
1049 |
|
1050 | if (getter && !setter) { return }
|
1051 | if (setter) {
|
1052 | setter.call(obj, newVal);
|
1053 | } else {
|
1054 | val = newVal;
|
1055 | }
|
1056 | childOb = !shallow && observe(newVal);
|
1057 | dep.notify();
|
1058 | }
|
1059 | });
|
1060 | }
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 | function set (target, key, val) {
|
1068 | if (isUndef(target) || isPrimitive(target)
|
1069 | ) {
|
1070 | warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
|
1071 | }
|
1072 | if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1073 | target.length = Math.max(target.length, key);
|
1074 | target.splice(key, 1, val);
|
1075 | return val
|
1076 | }
|
1077 | if (key in target && !(key in Object.prototype)) {
|
1078 | target[key] = val;
|
1079 | return val
|
1080 | }
|
1081 | var ob = (target).__ob__;
|
1082 | if (target._isVue || (ob && ob.vmCount)) {
|
1083 | warn(
|
1084 | 'Avoid adding reactive properties to a Vue instance or its root $data ' +
|
1085 | 'at runtime - declare it upfront in the data option.'
|
1086 | );
|
1087 | return val
|
1088 | }
|
1089 | if (!ob) {
|
1090 | target[key] = val;
|
1091 | return val
|
1092 | }
|
1093 | defineReactive$$1(ob.value, key, val);
|
1094 | ob.dep.notify();
|
1095 | return val
|
1096 | }
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 | function del (target, key) {
|
1102 | if (isUndef(target) || isPrimitive(target)
|
1103 | ) {
|
1104 | warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
|
1105 | }
|
1106 | if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1107 | target.splice(key, 1);
|
1108 | return
|
1109 | }
|
1110 | var ob = (target).__ob__;
|
1111 | if (target._isVue || (ob && ob.vmCount)) {
|
1112 | warn(
|
1113 | 'Avoid deleting properties on a Vue instance or its root $data ' +
|
1114 | '- just set it to null.'
|
1115 | );
|
1116 | return
|
1117 | }
|
1118 | if (!hasOwn(target, key)) {
|
1119 | return
|
1120 | }
|
1121 | delete target[key];
|
1122 | if (!ob) {
|
1123 | return
|
1124 | }
|
1125 | ob.dep.notify();
|
1126 | }
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 |
|
1132 | function dependArray (value) {
|
1133 | for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
|
1134 | e = value[i];
|
1135 | e && e.__ob__ && e.__ob__.dep.depend();
|
1136 | if (Array.isArray(e)) {
|
1137 | dependArray(e);
|
1138 | }
|
1139 | }
|
1140 | }
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 | var strats = config.optionMergeStrategies;
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 | {
|
1155 | strats.el = strats.propsData = function (parent, child, vm, key) {
|
1156 | if (!vm) {
|
1157 | warn(
|
1158 | "option \"" + key + "\" can only be used during instance " +
|
1159 | 'creation with the `new` keyword.'
|
1160 | );
|
1161 | }
|
1162 | return defaultStrat(parent, child)
|
1163 | };
|
1164 | }
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 | function mergeData (to, from) {
|
1170 | if (!from) { return to }
|
1171 | var key, toVal, fromVal;
|
1172 |
|
1173 | var keys = hasSymbol
|
1174 | ? Reflect.ownKeys(from)
|
1175 | : Object.keys(from);
|
1176 |
|
1177 | for (var i = 0; i < keys.length; i++) {
|
1178 | key = keys[i];
|
1179 |
|
1180 | if (key === '__ob__') { continue }
|
1181 | toVal = to[key];
|
1182 | fromVal = from[key];
|
1183 | if (!hasOwn(to, key)) {
|
1184 | set(to, key, fromVal);
|
1185 | } else if (
|
1186 | toVal !== fromVal &&
|
1187 | isPlainObject(toVal) &&
|
1188 | isPlainObject(fromVal)
|
1189 | ) {
|
1190 | mergeData(toVal, fromVal);
|
1191 | }
|
1192 | }
|
1193 | return to
|
1194 | }
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 | function mergeDataOrFn (
|
1200 | parentVal,
|
1201 | childVal,
|
1202 | vm
|
1203 | ) {
|
1204 | if (!vm) {
|
1205 |
|
1206 | if (!childVal) {
|
1207 | return parentVal
|
1208 | }
|
1209 | if (!parentVal) {
|
1210 | return childVal
|
1211 | }
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 |
|
1217 | return function mergedDataFn () {
|
1218 | return mergeData(
|
1219 | typeof childVal === 'function' ? childVal.call(this, this) : childVal,
|
1220 | typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
|
1221 | )
|
1222 | }
|
1223 | } else {
|
1224 | return function mergedInstanceDataFn () {
|
1225 |
|
1226 | var instanceData = typeof childVal === 'function'
|
1227 | ? childVal.call(vm, vm)
|
1228 | : childVal;
|
1229 | var defaultData = typeof parentVal === 'function'
|
1230 | ? parentVal.call(vm, vm)
|
1231 | : parentVal;
|
1232 | if (instanceData) {
|
1233 | return mergeData(instanceData, defaultData)
|
1234 | } else {
|
1235 | return defaultData
|
1236 | }
|
1237 | }
|
1238 | }
|
1239 | }
|
1240 |
|
1241 | strats.data = function (
|
1242 | parentVal,
|
1243 | childVal,
|
1244 | vm
|
1245 | ) {
|
1246 | if (!vm) {
|
1247 | if (childVal && typeof childVal !== 'function') {
|
1248 | warn(
|
1249 | 'The "data" option should be a function ' +
|
1250 | 'that returns a per-instance value in component ' +
|
1251 | 'definitions.',
|
1252 | vm
|
1253 | );
|
1254 |
|
1255 | return parentVal
|
1256 | }
|
1257 | return mergeDataOrFn(parentVal, childVal)
|
1258 | }
|
1259 |
|
1260 | return mergeDataOrFn(parentVal, childVal, vm)
|
1261 | };
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 | function mergeHook (
|
1267 | parentVal,
|
1268 | childVal
|
1269 | ) {
|
1270 | var res = childVal
|
1271 | ? parentVal
|
1272 | ? parentVal.concat(childVal)
|
1273 | : Array.isArray(childVal)
|
1274 | ? childVal
|
1275 | : [childVal]
|
1276 | : parentVal;
|
1277 | return res
|
1278 | ? dedupeHooks(res)
|
1279 | : res
|
1280 | }
|
1281 |
|
1282 | function dedupeHooks (hooks) {
|
1283 | var res = [];
|
1284 | for (var i = 0; i < hooks.length; i++) {
|
1285 | if (res.indexOf(hooks[i]) === -1) {
|
1286 | res.push(hooks[i]);
|
1287 | }
|
1288 | }
|
1289 | return res
|
1290 | }
|
1291 |
|
1292 | LIFECYCLE_HOOKS.forEach(function (hook) {
|
1293 | strats[hook] = mergeHook;
|
1294 | });
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 |
|
1303 | function mergeAssets (
|
1304 | parentVal,
|
1305 | childVal,
|
1306 | vm,
|
1307 | key
|
1308 | ) {
|
1309 | var res = Object.create(parentVal || null);
|
1310 | if (childVal) {
|
1311 | assertObjectType(key, childVal, vm);
|
1312 | return extend(res, childVal)
|
1313 | } else {
|
1314 | return res
|
1315 | }
|
1316 | }
|
1317 |
|
1318 | ASSET_TYPES.forEach(function (type) {
|
1319 | strats[type + 's'] = mergeAssets;
|
1320 | });
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 | strats.watch = function (
|
1329 | parentVal,
|
1330 | childVal,
|
1331 | vm,
|
1332 | key
|
1333 | ) {
|
1334 |
|
1335 | if (parentVal === nativeWatch) { parentVal = undefined; }
|
1336 | if (childVal === nativeWatch) { childVal = undefined; }
|
1337 |
|
1338 | if (!childVal) { return Object.create(parentVal || null) }
|
1339 | {
|
1340 | assertObjectType(key, childVal, vm);
|
1341 | }
|
1342 | if (!parentVal) { return childVal }
|
1343 | var ret = {};
|
1344 | extend(ret, parentVal);
|
1345 | for (var key$1 in childVal) {
|
1346 | var parent = ret[key$1];
|
1347 | var child = childVal[key$1];
|
1348 | if (parent && !Array.isArray(parent)) {
|
1349 | parent = [parent];
|
1350 | }
|
1351 | ret[key$1] = parent
|
1352 | ? parent.concat(child)
|
1353 | : Array.isArray(child) ? child : [child];
|
1354 | }
|
1355 | return ret
|
1356 | };
|
1357 |
|
1358 |
|
1359 |
|
1360 |
|
1361 | strats.props =
|
1362 | strats.methods =
|
1363 | strats.inject =
|
1364 | strats.computed = function (
|
1365 | parentVal,
|
1366 | childVal,
|
1367 | vm,
|
1368 | key
|
1369 | ) {
|
1370 | if (childVal && "development" !== 'production') {
|
1371 | assertObjectType(key, childVal, vm);
|
1372 | }
|
1373 | if (!parentVal) { return childVal }
|
1374 | var ret = Object.create(null);
|
1375 | extend(ret, parentVal);
|
1376 | if (childVal) { extend(ret, childVal); }
|
1377 | return ret
|
1378 | };
|
1379 | strats.provide = mergeDataOrFn;
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 | var defaultStrat = function (parentVal, childVal) {
|
1385 | return childVal === undefined
|
1386 | ? parentVal
|
1387 | : childVal
|
1388 | };
|
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 | function checkComponents (options) {
|
1394 | for (var key in options.components) {
|
1395 | validateComponentName(key);
|
1396 | }
|
1397 | }
|
1398 |
|
1399 | function validateComponentName (name) {
|
1400 | if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
|
1401 | warn(
|
1402 | 'Invalid component name: "' + name + '". Component names ' +
|
1403 | 'should conform to valid custom element name in html5 specification.'
|
1404 | );
|
1405 | }
|
1406 | if (isBuiltInTag(name) || config.isReservedTag(name)) {
|
1407 | warn(
|
1408 | 'Do not use built-in or reserved HTML elements as component ' +
|
1409 | 'id: ' + name
|
1410 | );
|
1411 | }
|
1412 | }
|
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 | function normalizeProps (options, vm) {
|
1419 | var props = options.props;
|
1420 | if (!props) { return }
|
1421 | var res = {};
|
1422 | var i, val, name;
|
1423 | if (Array.isArray(props)) {
|
1424 | i = props.length;
|
1425 | while (i--) {
|
1426 | val = props[i];
|
1427 | if (typeof val === 'string') {
|
1428 | name = camelize(val);
|
1429 | res[name] = { type: null };
|
1430 | } else {
|
1431 | warn('props must be strings when using array syntax.');
|
1432 | }
|
1433 | }
|
1434 | } else if (isPlainObject(props)) {
|
1435 | for (var key in props) {
|
1436 | val = props[key];
|
1437 | name = camelize(key);
|
1438 | res[name] = isPlainObject(val)
|
1439 | ? val
|
1440 | : { type: val };
|
1441 | }
|
1442 | } else {
|
1443 | warn(
|
1444 | "Invalid value for option \"props\": expected an Array or an Object, " +
|
1445 | "but got " + (toRawType(props)) + ".",
|
1446 | vm
|
1447 | );
|
1448 | }
|
1449 | options.props = res;
|
1450 | }
|
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 | function normalizeInject (options, vm) {
|
1456 | var inject = options.inject;
|
1457 | if (!inject) { return }
|
1458 | var normalized = options.inject = {};
|
1459 | if (Array.isArray(inject)) {
|
1460 | for (var i = 0; i < inject.length; i++) {
|
1461 | normalized[inject[i]] = { from: inject[i] };
|
1462 | }
|
1463 | } else if (isPlainObject(inject)) {
|
1464 | for (var key in inject) {
|
1465 | var val = inject[key];
|
1466 | normalized[key] = isPlainObject(val)
|
1467 | ? extend({ from: key }, val)
|
1468 | : { from: val };
|
1469 | }
|
1470 | } else {
|
1471 | warn(
|
1472 | "Invalid value for option \"inject\": expected an Array or an Object, " +
|
1473 | "but got " + (toRawType(inject)) + ".",
|
1474 | vm
|
1475 | );
|
1476 | }
|
1477 | }
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 | function normalizeDirectives (options) {
|
1483 | var dirs = options.directives;
|
1484 | if (dirs) {
|
1485 | for (var key in dirs) {
|
1486 | var def$$1 = dirs[key];
|
1487 | if (typeof def$$1 === 'function') {
|
1488 | dirs[key] = { bind: def$$1, update: def$$1 };
|
1489 | }
|
1490 | }
|
1491 | }
|
1492 | }
|
1493 |
|
1494 | function assertObjectType (name, value, vm) {
|
1495 | if (!isPlainObject(value)) {
|
1496 | warn(
|
1497 | "Invalid value for option \"" + name + "\": expected an Object, " +
|
1498 | "but got " + (toRawType(value)) + ".",
|
1499 | vm
|
1500 | );
|
1501 | }
|
1502 | }
|
1503 |
|
1504 |
|
1505 |
|
1506 |
|
1507 |
|
1508 | function mergeOptions (
|
1509 | parent,
|
1510 | child,
|
1511 | vm
|
1512 | ) {
|
1513 | {
|
1514 | checkComponents(child);
|
1515 | }
|
1516 |
|
1517 | if (typeof child === 'function') {
|
1518 | child = child.options;
|
1519 | }
|
1520 |
|
1521 | normalizeProps(child, vm);
|
1522 | normalizeInject(child, vm);
|
1523 | normalizeDirectives(child);
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 | if (!child._base) {
|
1530 | if (child.extends) {
|
1531 | parent = mergeOptions(parent, child.extends, vm);
|
1532 | }
|
1533 | if (child.mixins) {
|
1534 | for (var i = 0, l = child.mixins.length; i < l; i++) {
|
1535 | parent = mergeOptions(parent, child.mixins[i], vm);
|
1536 | }
|
1537 | }
|
1538 | }
|
1539 |
|
1540 | var options = {};
|
1541 | var key;
|
1542 | for (key in parent) {
|
1543 | mergeField(key);
|
1544 | }
|
1545 | for (key in child) {
|
1546 | if (!hasOwn(parent, key)) {
|
1547 | mergeField(key);
|
1548 | }
|
1549 | }
|
1550 | function mergeField (key) {
|
1551 | var strat = strats[key] || defaultStrat;
|
1552 | options[key] = strat(parent[key], child[key], vm, key);
|
1553 | }
|
1554 | return options
|
1555 | }
|
1556 |
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 | function resolveAsset (
|
1563 | options,
|
1564 | type,
|
1565 | id,
|
1566 | warnMissing
|
1567 | ) {
|
1568 |
|
1569 | if (typeof id !== 'string') {
|
1570 | return
|
1571 | }
|
1572 | var assets = options[type];
|
1573 |
|
1574 | if (hasOwn(assets, id)) { return assets[id] }
|
1575 | var camelizedId = camelize(id);
|
1576 | if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
|
1577 | var PascalCaseId = capitalize(camelizedId);
|
1578 | if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
|
1579 |
|
1580 | var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
|
1581 | if (warnMissing && !res) {
|
1582 | warn(
|
1583 | 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
|
1584 | options
|
1585 | );
|
1586 | }
|
1587 | return res
|
1588 | }
|
1589 |
|
1590 |
|
1591 |
|
1592 |
|
1593 |
|
1594 | function validateProp (
|
1595 | key,
|
1596 | propOptions,
|
1597 | propsData,
|
1598 | vm
|
1599 | ) {
|
1600 | var prop = propOptions[key];
|
1601 | var absent = !hasOwn(propsData, key);
|
1602 | var value = propsData[key];
|
1603 |
|
1604 | var booleanIndex = getTypeIndex(Boolean, prop.type);
|
1605 | if (booleanIndex > -1) {
|
1606 | if (absent && !hasOwn(prop, 'default')) {
|
1607 | value = false;
|
1608 | } else if (value === '' || value === hyphenate(key)) {
|
1609 |
|
1610 |
|
1611 | var stringIndex = getTypeIndex(String, prop.type);
|
1612 | if (stringIndex < 0 || booleanIndex < stringIndex) {
|
1613 | value = true;
|
1614 | }
|
1615 | }
|
1616 | }
|
1617 |
|
1618 | if (value === undefined) {
|
1619 | value = getPropDefaultValue(vm, prop, key);
|
1620 |
|
1621 |
|
1622 | var prevShouldObserve = shouldObserve;
|
1623 | toggleObserving(true);
|
1624 | observe(value);
|
1625 | toggleObserving(prevShouldObserve);
|
1626 | }
|
1627 | {
|
1628 | assertProp(prop, key, value, vm, absent);
|
1629 | }
|
1630 | return value
|
1631 | }
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 | function getPropDefaultValue (vm, prop, key) {
|
1637 |
|
1638 | if (!hasOwn(prop, 'default')) {
|
1639 | return undefined
|
1640 | }
|
1641 | var def = prop.default;
|
1642 |
|
1643 | if (isObject(def)) {
|
1644 | warn(
|
1645 | 'Invalid default value for prop "' + key + '": ' +
|
1646 | 'Props with type Object/Array must use a factory function ' +
|
1647 | 'to return the default value.',
|
1648 | vm
|
1649 | );
|
1650 | }
|
1651 |
|
1652 |
|
1653 | if (vm && vm.$options.propsData &&
|
1654 | vm.$options.propsData[key] === undefined &&
|
1655 | vm._props[key] !== undefined
|
1656 | ) {
|
1657 | return vm._props[key]
|
1658 | }
|
1659 |
|
1660 |
|
1661 | return typeof def === 'function' && getType(prop.type) !== 'Function'
|
1662 | ? def.call(vm)
|
1663 | : def
|
1664 | }
|
1665 |
|
1666 |
|
1667 |
|
1668 |
|
1669 | function assertProp (
|
1670 | prop,
|
1671 | name,
|
1672 | value,
|
1673 | vm,
|
1674 | absent
|
1675 | ) {
|
1676 | if (prop.required && absent) {
|
1677 | warn(
|
1678 | 'Missing required prop: "' + name + '"',
|
1679 | vm
|
1680 | );
|
1681 | return
|
1682 | }
|
1683 | if (value == null && !prop.required) {
|
1684 | return
|
1685 | }
|
1686 | var type = prop.type;
|
1687 | var valid = !type || type === true;
|
1688 | var expectedTypes = [];
|
1689 | if (type) {
|
1690 | if (!Array.isArray(type)) {
|
1691 | type = [type];
|
1692 | }
|
1693 | for (var i = 0; i < type.length && !valid; i++) {
|
1694 | var assertedType = assertType(value, type[i], vm);
|
1695 | expectedTypes.push(assertedType.expectedType || '');
|
1696 | valid = assertedType.valid;
|
1697 | }
|
1698 | }
|
1699 |
|
1700 | var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
|
1701 | if (!valid && haveExpectedTypes) {
|
1702 | warn(
|
1703 | getInvalidTypeMessage(name, value, expectedTypes),
|
1704 | vm
|
1705 | );
|
1706 | return
|
1707 | }
|
1708 | var validator = prop.validator;
|
1709 | if (validator) {
|
1710 | if (!validator(value)) {
|
1711 | warn(
|
1712 | 'Invalid prop: custom validator check failed for prop "' + name + '".',
|
1713 | vm
|
1714 | );
|
1715 | }
|
1716 | }
|
1717 | }
|
1718 |
|
1719 | var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
|
1720 |
|
1721 | function assertType (value, type, vm) {
|
1722 | var valid;
|
1723 | var expectedType = getType(type);
|
1724 | if (simpleCheckRE.test(expectedType)) {
|
1725 | var t = typeof value;
|
1726 | valid = t === expectedType.toLowerCase();
|
1727 |
|
1728 | if (!valid && t === 'object') {
|
1729 | valid = value instanceof type;
|
1730 | }
|
1731 | } else if (expectedType === 'Object') {
|
1732 | valid = isPlainObject(value);
|
1733 | } else if (expectedType === 'Array') {
|
1734 | valid = Array.isArray(value);
|
1735 | } else {
|
1736 | try {
|
1737 | valid = value instanceof type;
|
1738 | } catch (e) {
|
1739 | warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
|
1740 | valid = false;
|
1741 | }
|
1742 | }
|
1743 | return {
|
1744 | valid: valid,
|
1745 | expectedType: expectedType
|
1746 | }
|
1747 | }
|
1748 |
|
1749 | var functionTypeCheckRE = /^\s*function (\w+)/;
|
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 | function getType (fn) {
|
1757 | var match = fn && fn.toString().match(functionTypeCheckRE);
|
1758 | return match ? match[1] : ''
|
1759 | }
|
1760 |
|
1761 | function isSameType (a, b) {
|
1762 | return getType(a) === getType(b)
|
1763 | }
|
1764 |
|
1765 | function getTypeIndex (type, expectedTypes) {
|
1766 | if (!Array.isArray(expectedTypes)) {
|
1767 | return isSameType(expectedTypes, type) ? 0 : -1
|
1768 | }
|
1769 | for (var i = 0, len = expectedTypes.length; i < len; i++) {
|
1770 | if (isSameType(expectedTypes[i], type)) {
|
1771 | return i
|
1772 | }
|
1773 | }
|
1774 | return -1
|
1775 | }
|
1776 |
|
1777 | function getInvalidTypeMessage (name, value, expectedTypes) {
|
1778 | var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
|
1779 | " Expected " + (expectedTypes.map(capitalize).join(', '));
|
1780 | var expectedType = expectedTypes[0];
|
1781 | var receivedType = toRawType(value);
|
1782 |
|
1783 | if (
|
1784 | expectedTypes.length === 1 &&
|
1785 | isExplicable(expectedType) &&
|
1786 | isExplicable(typeof value) &&
|
1787 | !isBoolean(expectedType, receivedType)
|
1788 | ) {
|
1789 | message += " with value " + (styleValue(value, expectedType));
|
1790 | }
|
1791 | message += ", got " + receivedType + " ";
|
1792 |
|
1793 | if (isExplicable(receivedType)) {
|
1794 | message += "with value " + (styleValue(value, receivedType)) + ".";
|
1795 | }
|
1796 | return message
|
1797 | }
|
1798 |
|
1799 | function styleValue (value, type) {
|
1800 | if (type === 'String') {
|
1801 | return ("\"" + value + "\"")
|
1802 | } else if (type === 'Number') {
|
1803 | return ("" + (Number(value)))
|
1804 | } else {
|
1805 | return ("" + value)
|
1806 | }
|
1807 | }
|
1808 |
|
1809 | var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
|
1810 | function isExplicable (value) {
|
1811 | return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; })
|
1812 | }
|
1813 |
|
1814 | function isBoolean () {
|
1815 | var args = [], len = arguments.length;
|
1816 | while ( len-- ) args[ len ] = arguments[ len ];
|
1817 |
|
1818 | return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
|
1819 | }
|
1820 |
|
1821 |
|
1822 |
|
1823 | function handleError (err, vm, info) {
|
1824 |
|
1825 |
|
1826 | pushTarget();
|
1827 | try {
|
1828 | if (vm) {
|
1829 | var cur = vm;
|
1830 | while ((cur = cur.$parent)) {
|
1831 | var hooks = cur.$options.errorCaptured;
|
1832 | if (hooks) {
|
1833 | for (var i = 0; i < hooks.length; i++) {
|
1834 | try {
|
1835 | var capture = hooks[i].call(cur, err, vm, info) === false;
|
1836 | if (capture) { return }
|
1837 | } catch (e) {
|
1838 | globalHandleError(e, cur, 'errorCaptured hook');
|
1839 | }
|
1840 | }
|
1841 | }
|
1842 | }
|
1843 | }
|
1844 | globalHandleError(err, vm, info);
|
1845 | } finally {
|
1846 | popTarget();
|
1847 | }
|
1848 | }
|
1849 |
|
1850 | function invokeWithErrorHandling (
|
1851 | handler,
|
1852 | context,
|
1853 | args,
|
1854 | vm,
|
1855 | info
|
1856 | ) {
|
1857 | var res;
|
1858 | try {
|
1859 | res = args ? handler.apply(context, args) : handler.call(context);
|
1860 | if (res && !res._isVue && isPromise(res) && !res._handled) {
|
1861 | res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
|
1862 |
|
1863 |
|
1864 | res._handled = true;
|
1865 | }
|
1866 | } catch (e) {
|
1867 | handleError(e, vm, info);
|
1868 | }
|
1869 | return res
|
1870 | }
|
1871 |
|
1872 | function globalHandleError (err, vm, info) {
|
1873 | if (config.errorHandler) {
|
1874 | try {
|
1875 | return config.errorHandler.call(null, err, vm, info)
|
1876 | } catch (e) {
|
1877 |
|
1878 |
|
1879 | if (e !== err) {
|
1880 | logError(e, null, 'config.errorHandler');
|
1881 | }
|
1882 | }
|
1883 | }
|
1884 | logError(err, vm, info);
|
1885 | }
|
1886 |
|
1887 | function logError (err, vm, info) {
|
1888 | {
|
1889 | warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
|
1890 | }
|
1891 |
|
1892 | if ((inBrowser || inWeex) && typeof console !== 'undefined') {
|
1893 | console.error(err);
|
1894 | } else {
|
1895 | throw err
|
1896 | }
|
1897 | }
|
1898 |
|
1899 |
|
1900 |
|
1901 | var isUsingMicroTask = false;
|
1902 |
|
1903 | var callbacks = [];
|
1904 | var pending = false;
|
1905 |
|
1906 | function flushCallbacks () {
|
1907 | pending = false;
|
1908 | var copies = callbacks.slice(0);
|
1909 | callbacks.length = 0;
|
1910 | for (var i = 0; i < copies.length; i++) {
|
1911 | copies[i]();
|
1912 | }
|
1913 | }
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 | var timerFunc;
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 | if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
1936 | var p = Promise.resolve();
|
1937 | timerFunc = function () {
|
1938 | p.then(flushCallbacks);
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 | if (isIOS) { setTimeout(noop); }
|
1945 | };
|
1946 | isUsingMicroTask = true;
|
1947 | } else if (!isIE && typeof MutationObserver !== 'undefined' && (
|
1948 | isNative(MutationObserver) ||
|
1949 |
|
1950 | MutationObserver.toString() === '[object MutationObserverConstructor]'
|
1951 | )) {
|
1952 |
|
1953 |
|
1954 |
|
1955 | var counter = 1;
|
1956 | var observer = new MutationObserver(flushCallbacks);
|
1957 | var textNode = document.createTextNode(String(counter));
|
1958 | observer.observe(textNode, {
|
1959 | characterData: true
|
1960 | });
|
1961 | timerFunc = function () {
|
1962 | counter = (counter + 1) % 2;
|
1963 | textNode.data = String(counter);
|
1964 | };
|
1965 | isUsingMicroTask = true;
|
1966 | } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
1967 |
|
1968 |
|
1969 |
|
1970 | timerFunc = function () {
|
1971 | setImmediate(flushCallbacks);
|
1972 | };
|
1973 | } else {
|
1974 |
|
1975 | timerFunc = function () {
|
1976 | setTimeout(flushCallbacks, 0);
|
1977 | };
|
1978 | }
|
1979 |
|
1980 | function nextTick (cb, ctx) {
|
1981 | var _resolve;
|
1982 | callbacks.push(function () {
|
1983 | if (cb) {
|
1984 | try {
|
1985 | cb.call(ctx);
|
1986 | } catch (e) {
|
1987 | handleError(e, ctx, 'nextTick');
|
1988 | }
|
1989 | } else if (_resolve) {
|
1990 | _resolve(ctx);
|
1991 | }
|
1992 | });
|
1993 | if (!pending) {
|
1994 | pending = true;
|
1995 | timerFunc();
|
1996 | }
|
1997 |
|
1998 | if (!cb && typeof Promise !== 'undefined') {
|
1999 | return new Promise(function (resolve) {
|
2000 | _resolve = resolve;
|
2001 | })
|
2002 | }
|
2003 | }
|
2004 |
|
2005 |
|
2006 |
|
2007 |
|
2008 |
|
2009 | var initProxy;
|
2010 |
|
2011 | {
|
2012 | var allowedGlobals = makeMap(
|
2013 | 'Infinity,undefined,NaN,isFinite,isNaN,' +
|
2014 | 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
2015 | 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
|
2016 | 'require'
|
2017 | );
|
2018 |
|
2019 | var warnNonPresent = function (target, key) {
|
2020 | warn(
|
2021 | "Property or method \"" + key + "\" is not defined on the instance but " +
|
2022 | 'referenced during render. Make sure that this property is reactive, ' +
|
2023 | 'either in the data option, or for class-based components, by ' +
|
2024 | 'initializing the property. ' +
|
2025 | 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
|
2026 | target
|
2027 | );
|
2028 | };
|
2029 |
|
2030 | var warnReservedPrefix = function (target, key) {
|
2031 | warn(
|
2032 | "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
|
2033 | 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
2034 | 'prevent conflicts with Vue internals. ' +
|
2035 | 'See: https://vuejs.org/v2/api/#data',
|
2036 | target
|
2037 | );
|
2038 | };
|
2039 |
|
2040 | var hasProxy =
|
2041 | typeof Proxy !== 'undefined' && isNative(Proxy);
|
2042 |
|
2043 | if (hasProxy) {
|
2044 | var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
|
2045 | config.keyCodes = new Proxy(config.keyCodes, {
|
2046 | set: function set (target, key, value) {
|
2047 | if (isBuiltInModifier(key)) {
|
2048 | warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
|
2049 | return false
|
2050 | } else {
|
2051 | target[key] = value;
|
2052 | return true
|
2053 | }
|
2054 | }
|
2055 | });
|
2056 | }
|
2057 |
|
2058 | var hasHandler = {
|
2059 | has: function has (target, key) {
|
2060 | var has = key in target;
|
2061 | var isAllowed = allowedGlobals(key) ||
|
2062 | (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
|
2063 | if (!has && !isAllowed) {
|
2064 | if (key in target.$data) { warnReservedPrefix(target, key); }
|
2065 | else { warnNonPresent(target, key); }
|
2066 | }
|
2067 | return has || !isAllowed
|
2068 | }
|
2069 | };
|
2070 |
|
2071 | var getHandler = {
|
2072 | get: function get (target, key) {
|
2073 | if (typeof key === 'string' && !(key in target)) {
|
2074 | if (key in target.$data) { warnReservedPrefix(target, key); }
|
2075 | else { warnNonPresent(target, key); }
|
2076 | }
|
2077 | return target[key]
|
2078 | }
|
2079 | };
|
2080 |
|
2081 | initProxy = function initProxy (vm) {
|
2082 | if (hasProxy) {
|
2083 |
|
2084 | var options = vm.$options;
|
2085 | var handlers = options.render && options.render._withStripped
|
2086 | ? getHandler
|
2087 | : hasHandler;
|
2088 | vm._renderProxy = new Proxy(vm, handlers);
|
2089 | } else {
|
2090 | vm._renderProxy = vm;
|
2091 | }
|
2092 | };
|
2093 | }
|
2094 |
|
2095 |
|
2096 |
|
2097 | var seenObjects = new _Set();
|
2098 |
|
2099 |
|
2100 |
|
2101 |
|
2102 |
|
2103 |
|
2104 | function traverse (val) {
|
2105 | _traverse(val, seenObjects);
|
2106 | seenObjects.clear();
|
2107 | }
|
2108 |
|
2109 | function _traverse (val, seen) {
|
2110 | var i, keys;
|
2111 | var isA = Array.isArray(val);
|
2112 | if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
|
2113 | return
|
2114 | }
|
2115 | if (val.__ob__) {
|
2116 | var depId = val.__ob__.dep.id;
|
2117 | if (seen.has(depId)) {
|
2118 | return
|
2119 | }
|
2120 | seen.add(depId);
|
2121 | }
|
2122 | if (isA) {
|
2123 | i = val.length;
|
2124 | while (i--) { _traverse(val[i], seen); }
|
2125 | } else {
|
2126 | keys = Object.keys(val);
|
2127 | i = keys.length;
|
2128 | while (i--) { _traverse(val[keys[i]], seen); }
|
2129 | }
|
2130 | }
|
2131 |
|
2132 | var mark;
|
2133 | var measure;
|
2134 |
|
2135 | {
|
2136 | var perf = inBrowser && window.performance;
|
2137 |
|
2138 | if (
|
2139 | perf &&
|
2140 | perf.mark &&
|
2141 | perf.measure &&
|
2142 | perf.clearMarks &&
|
2143 | perf.clearMeasures
|
2144 | ) {
|
2145 | mark = function (tag) { return perf.mark(tag); };
|
2146 | measure = function (name, startTag, endTag) {
|
2147 | perf.measure(name, startTag, endTag);
|
2148 | perf.clearMarks(startTag);
|
2149 | perf.clearMarks(endTag);
|
2150 |
|
2151 | };
|
2152 | }
|
2153 | }
|
2154 |
|
2155 |
|
2156 |
|
2157 | var normalizeEvent = cached(function (name) {
|
2158 | var passive = name.charAt(0) === '&';
|
2159 | name = passive ? name.slice(1) : name;
|
2160 | var once$$1 = name.charAt(0) === '~';
|
2161 | name = once$$1 ? name.slice(1) : name;
|
2162 | var capture = name.charAt(0) === '!';
|
2163 | name = capture ? name.slice(1) : name;
|
2164 | return {
|
2165 | name: name,
|
2166 | once: once$$1,
|
2167 | capture: capture,
|
2168 | passive: passive
|
2169 | }
|
2170 | });
|
2171 |
|
2172 | function createFnInvoker (fns, vm) {
|
2173 | function invoker () {
|
2174 | var arguments$1 = arguments;
|
2175 |
|
2176 | var fns = invoker.fns;
|
2177 | if (Array.isArray(fns)) {
|
2178 | var cloned = fns.slice();
|
2179 | for (var i = 0; i < cloned.length; i++) {
|
2180 | invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
|
2181 | }
|
2182 | } else {
|
2183 |
|
2184 | return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
|
2185 | }
|
2186 | }
|
2187 | invoker.fns = fns;
|
2188 | return invoker
|
2189 | }
|
2190 |
|
2191 | function updateListeners (
|
2192 | on,
|
2193 | oldOn,
|
2194 | add,
|
2195 | remove$$1,
|
2196 | createOnceHandler,
|
2197 | vm
|
2198 | ) {
|
2199 | var name, def$$1, cur, old, event;
|
2200 | for (name in on) {
|
2201 | def$$1 = cur = on[name];
|
2202 | old = oldOn[name];
|
2203 | event = normalizeEvent(name);
|
2204 | if (isUndef(cur)) {
|
2205 | warn(
|
2206 | "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
|
2207 | vm
|
2208 | );
|
2209 | } else if (isUndef(old)) {
|
2210 | if (isUndef(cur.fns)) {
|
2211 | cur = on[name] = createFnInvoker(cur, vm);
|
2212 | }
|
2213 | if (isTrue(event.once)) {
|
2214 | cur = on[name] = createOnceHandler(event.name, cur, event.capture);
|
2215 | }
|
2216 | add(event.name, cur, event.capture, event.passive, event.params);
|
2217 | } else if (cur !== old) {
|
2218 | old.fns = cur;
|
2219 | on[name] = old;
|
2220 | }
|
2221 | }
|
2222 | for (name in oldOn) {
|
2223 | if (isUndef(on[name])) {
|
2224 | event = normalizeEvent(name);
|
2225 | remove$$1(event.name, oldOn[name], event.capture);
|
2226 | }
|
2227 | }
|
2228 | }
|
2229 |
|
2230 |
|
2231 |
|
2232 | function mergeVNodeHook (def, hookKey, hook) {
|
2233 | if (def instanceof VNode) {
|
2234 | def = def.data.hook || (def.data.hook = {});
|
2235 | }
|
2236 | var invoker;
|
2237 | var oldHook = def[hookKey];
|
2238 |
|
2239 | function wrappedHook () {
|
2240 | hook.apply(this, arguments);
|
2241 |
|
2242 |
|
2243 | remove(invoker.fns, wrappedHook);
|
2244 | }
|
2245 |
|
2246 | if (isUndef(oldHook)) {
|
2247 |
|
2248 | invoker = createFnInvoker([wrappedHook]);
|
2249 | } else {
|
2250 |
|
2251 | if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
|
2252 |
|
2253 | invoker = oldHook;
|
2254 | invoker.fns.push(wrappedHook);
|
2255 | } else {
|
2256 |
|
2257 | invoker = createFnInvoker([oldHook, wrappedHook]);
|
2258 | }
|
2259 | }
|
2260 |
|
2261 | invoker.merged = true;
|
2262 | def[hookKey] = invoker;
|
2263 | }
|
2264 |
|
2265 |
|
2266 |
|
2267 | function extractPropsFromVNodeData (
|
2268 | data,
|
2269 | Ctor,
|
2270 | tag
|
2271 | ) {
|
2272 |
|
2273 |
|
2274 |
|
2275 | var propOptions = Ctor.options.props;
|
2276 | if (isUndef(propOptions)) {
|
2277 | return
|
2278 | }
|
2279 | var res = {};
|
2280 | var attrs = data.attrs;
|
2281 | var props = data.props;
|
2282 | if (isDef(attrs) || isDef(props)) {
|
2283 | for (var key in propOptions) {
|
2284 | var altKey = hyphenate(key);
|
2285 | {
|
2286 | var keyInLowerCase = key.toLowerCase();
|
2287 | if (
|
2288 | key !== keyInLowerCase &&
|
2289 | attrs && hasOwn(attrs, keyInLowerCase)
|
2290 | ) {
|
2291 | tip(
|
2292 | "Prop \"" + keyInLowerCase + "\" is passed to component " +
|
2293 | (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
|
2294 | " \"" + key + "\". " +
|
2295 | "Note that HTML attributes are case-insensitive and camelCased " +
|
2296 | "props need to use their kebab-case equivalents when using in-DOM " +
|
2297 | "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
|
2298 | );
|
2299 | }
|
2300 | }
|
2301 | checkProp(res, props, key, altKey, true) ||
|
2302 | checkProp(res, attrs, key, altKey, false);
|
2303 | }
|
2304 | }
|
2305 | return res
|
2306 | }
|
2307 |
|
2308 | function checkProp (
|
2309 | res,
|
2310 | hash,
|
2311 | key,
|
2312 | altKey,
|
2313 | preserve
|
2314 | ) {
|
2315 | if (isDef(hash)) {
|
2316 | if (hasOwn(hash, key)) {
|
2317 | res[key] = hash[key];
|
2318 | if (!preserve) {
|
2319 | delete hash[key];
|
2320 | }
|
2321 | return true
|
2322 | } else if (hasOwn(hash, altKey)) {
|
2323 | res[key] = hash[altKey];
|
2324 | if (!preserve) {
|
2325 | delete hash[altKey];
|
2326 | }
|
2327 | return true
|
2328 | }
|
2329 | }
|
2330 | return false
|
2331 | }
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 |
|
2346 |
|
2347 | function simpleNormalizeChildren (children) {
|
2348 | for (var i = 0; i < children.length; i++) {
|
2349 | if (Array.isArray(children[i])) {
|
2350 | return Array.prototype.concat.apply([], children)
|
2351 | }
|
2352 | }
|
2353 | return children
|
2354 | }
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 | function normalizeChildren (children) {
|
2361 | return isPrimitive(children)
|
2362 | ? [createTextVNode(children)]
|
2363 | : Array.isArray(children)
|
2364 | ? normalizeArrayChildren(children)
|
2365 | : undefined
|
2366 | }
|
2367 |
|
2368 | function isTextNode (node) {
|
2369 | return isDef(node) && isDef(node.text) && isFalse(node.isComment)
|
2370 | }
|
2371 |
|
2372 | function normalizeArrayChildren (children, nestedIndex) {
|
2373 | var res = [];
|
2374 | var i, c, lastIndex, last;
|
2375 | for (i = 0; i < children.length; i++) {
|
2376 | c = children[i];
|
2377 | if (isUndef(c) || typeof c === 'boolean') { continue }
|
2378 | lastIndex = res.length - 1;
|
2379 | last = res[lastIndex];
|
2380 |
|
2381 | if (Array.isArray(c)) {
|
2382 | if (c.length > 0) {
|
2383 | c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
|
2384 |
|
2385 | if (isTextNode(c[0]) && isTextNode(last)) {
|
2386 | res[lastIndex] = createTextVNode(last.text + (c[0]).text);
|
2387 | c.shift();
|
2388 | }
|
2389 | res.push.apply(res, c);
|
2390 | }
|
2391 | } else if (isPrimitive(c)) {
|
2392 | if (isTextNode(last)) {
|
2393 |
|
2394 |
|
2395 |
|
2396 | res[lastIndex] = createTextVNode(last.text + c);
|
2397 | } else if (c !== '') {
|
2398 |
|
2399 | res.push(createTextVNode(c));
|
2400 | }
|
2401 | } else {
|
2402 | if (isTextNode(c) && isTextNode(last)) {
|
2403 |
|
2404 | res[lastIndex] = createTextVNode(last.text + c.text);
|
2405 | } else {
|
2406 |
|
2407 | if (isTrue(children._isVList) &&
|
2408 | isDef(c.tag) &&
|
2409 | isUndef(c.key) &&
|
2410 | isDef(nestedIndex)) {
|
2411 | c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
2412 | }
|
2413 | res.push(c);
|
2414 | }
|
2415 | }
|
2416 | }
|
2417 | return res
|
2418 | }
|
2419 |
|
2420 |
|
2421 |
|
2422 | function initProvide (vm) {
|
2423 | var provide = vm.$options.provide;
|
2424 | if (provide) {
|
2425 | vm._provided = typeof provide === 'function'
|
2426 | ? provide.call(vm)
|
2427 | : provide;
|
2428 | }
|
2429 | }
|
2430 |
|
2431 | function initInjections (vm) {
|
2432 | var result = resolveInject(vm.$options.inject, vm);
|
2433 | if (result) {
|
2434 | toggleObserving(false);
|
2435 | Object.keys(result).forEach(function (key) {
|
2436 |
|
2437 | {
|
2438 | defineReactive$$1(vm, key, result[key], function () {
|
2439 | warn(
|
2440 | "Avoid mutating an injected value directly since the changes will be " +
|
2441 | "overwritten whenever the provided component re-renders. " +
|
2442 | "injection being mutated: \"" + key + "\"",
|
2443 | vm
|
2444 | );
|
2445 | });
|
2446 | }
|
2447 | });
|
2448 | toggleObserving(true);
|
2449 | }
|
2450 | }
|
2451 |
|
2452 | function resolveInject (inject, vm) {
|
2453 | if (inject) {
|
2454 |
|
2455 | var result = Object.create(null);
|
2456 | var keys = hasSymbol
|
2457 | ? Reflect.ownKeys(inject)
|
2458 | : Object.keys(inject);
|
2459 |
|
2460 | for (var i = 0; i < keys.length; i++) {
|
2461 | var key = keys[i];
|
2462 |
|
2463 | if (key === '__ob__') { continue }
|
2464 | var provideKey = inject[key].from;
|
2465 | var source = vm;
|
2466 | while (source) {
|
2467 | if (source._provided && hasOwn(source._provided, provideKey)) {
|
2468 | result[key] = source._provided[provideKey];
|
2469 | break
|
2470 | }
|
2471 | source = source.$parent;
|
2472 | }
|
2473 | if (!source) {
|
2474 | if ('default' in inject[key]) {
|
2475 | var provideDefault = inject[key].default;
|
2476 | result[key] = typeof provideDefault === 'function'
|
2477 | ? provideDefault.call(vm)
|
2478 | : provideDefault;
|
2479 | } else {
|
2480 | warn(("Injection \"" + key + "\" not found"), vm);
|
2481 | }
|
2482 | }
|
2483 | }
|
2484 | return result
|
2485 | }
|
2486 | }
|
2487 |
|
2488 |
|
2489 |
|
2490 |
|
2491 |
|
2492 |
|
2493 |
|
2494 |
|
2495 | function resolveSlots (
|
2496 | children,
|
2497 | context
|
2498 | ) {
|
2499 | if (!children || !children.length) {
|
2500 | return {}
|
2501 | }
|
2502 | var slots = {};
|
2503 | for (var i = 0, l = children.length; i < l; i++) {
|
2504 | var child = children[i];
|
2505 | var data = child.data;
|
2506 |
|
2507 | if (data && data.attrs && data.attrs.slot) {
|
2508 | delete data.attrs.slot;
|
2509 | }
|
2510 |
|
2511 |
|
2512 | if ((child.context === context || child.fnContext === context) &&
|
2513 | data && data.slot != null
|
2514 | ) {
|
2515 | var name = data.slot;
|
2516 | var slot = (slots[name] || (slots[name] = []));
|
2517 | if (child.tag === 'template') {
|
2518 | slot.push.apply(slot, child.children || []);
|
2519 | } else {
|
2520 | slot.push(child);
|
2521 | }
|
2522 | } else {
|
2523 | (slots.default || (slots.default = [])).push(child);
|
2524 | }
|
2525 | }
|
2526 |
|
2527 | for (var name$1 in slots) {
|
2528 | if (slots[name$1].every(isWhitespace)) {
|
2529 | delete slots[name$1];
|
2530 | }
|
2531 | }
|
2532 | return slots
|
2533 | }
|
2534 |
|
2535 | function isWhitespace (node) {
|
2536 | return (node.isComment && !node.asyncFactory) || node.text === ' '
|
2537 | }
|
2538 |
|
2539 |
|
2540 |
|
2541 | function isAsyncPlaceholder (node) {
|
2542 | return node.isComment && node.asyncFactory
|
2543 | }
|
2544 |
|
2545 |
|
2546 |
|
2547 | function normalizeScopedSlots (
|
2548 | slots,
|
2549 | normalSlots,
|
2550 | prevSlots
|
2551 | ) {
|
2552 | var res;
|
2553 | var hasNormalSlots = Object.keys(normalSlots).length > 0;
|
2554 | var isStable = slots ? !!slots.$stable : !hasNormalSlots;
|
2555 | var key = slots && slots.$key;
|
2556 | if (!slots) {
|
2557 | res = {};
|
2558 | } else if (slots._normalized) {
|
2559 |
|
2560 | return slots._normalized
|
2561 | } else if (
|
2562 | isStable &&
|
2563 | prevSlots &&
|
2564 | prevSlots !== emptyObject &&
|
2565 | key === prevSlots.$key &&
|
2566 | !hasNormalSlots &&
|
2567 | !prevSlots.$hasNormal
|
2568 | ) {
|
2569 |
|
2570 |
|
2571 | return prevSlots
|
2572 | } else {
|
2573 | res = {};
|
2574 | for (var key$1 in slots) {
|
2575 | if (slots[key$1] && key$1[0] !== '$') {
|
2576 | res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
|
2577 | }
|
2578 | }
|
2579 | }
|
2580 |
|
2581 | for (var key$2 in normalSlots) {
|
2582 | if (!(key$2 in res)) {
|
2583 | res[key$2] = proxyNormalSlot(normalSlots, key$2);
|
2584 | }
|
2585 | }
|
2586 |
|
2587 |
|
2588 | if (slots && Object.isExtensible(slots)) {
|
2589 | (slots)._normalized = res;
|
2590 | }
|
2591 | def(res, '$stable', isStable);
|
2592 | def(res, '$key', key);
|
2593 | def(res, '$hasNormal', hasNormalSlots);
|
2594 | return res
|
2595 | }
|
2596 |
|
2597 | function normalizeScopedSlot(normalSlots, key, fn) {
|
2598 | var normalized = function () {
|
2599 | var res = arguments.length ? fn.apply(null, arguments) : fn({});
|
2600 | res = res && typeof res === 'object' && !Array.isArray(res)
|
2601 | ? [res]
|
2602 | : normalizeChildren(res);
|
2603 | var vnode = res && res[0];
|
2604 | return res && (
|
2605 | !vnode ||
|
2606 | (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))
|
2607 | ) ? undefined
|
2608 | : res
|
2609 | };
|
2610 |
|
2611 |
|
2612 |
|
2613 | if (fn.proxy) {
|
2614 | Object.defineProperty(normalSlots, key, {
|
2615 | get: normalized,
|
2616 | enumerable: true,
|
2617 | configurable: true
|
2618 | });
|
2619 | }
|
2620 | return normalized
|
2621 | }
|
2622 |
|
2623 | function proxyNormalSlot(slots, key) {
|
2624 | return function () { return slots[key]; }
|
2625 | }
|
2626 |
|
2627 |
|
2628 |
|
2629 |
|
2630 |
|
2631 |
|
2632 | function renderList (
|
2633 | val,
|
2634 | render
|
2635 | ) {
|
2636 | var ret, i, l, keys, key;
|
2637 | if (Array.isArray(val) || typeof val === 'string') {
|
2638 | ret = new Array(val.length);
|
2639 | for (i = 0, l = val.length; i < l; i++) {
|
2640 | ret[i] = render(val[i], i);
|
2641 | }
|
2642 | } else if (typeof val === 'number') {
|
2643 | ret = new Array(val);
|
2644 | for (i = 0; i < val; i++) {
|
2645 | ret[i] = render(i + 1, i);
|
2646 | }
|
2647 | } else if (isObject(val)) {
|
2648 | if (hasSymbol && val[Symbol.iterator]) {
|
2649 | ret = [];
|
2650 | var iterator = val[Symbol.iterator]();
|
2651 | var result = iterator.next();
|
2652 | while (!result.done) {
|
2653 | ret.push(render(result.value, ret.length));
|
2654 | result = iterator.next();
|
2655 | }
|
2656 | } else {
|
2657 | keys = Object.keys(val);
|
2658 | ret = new Array(keys.length);
|
2659 | for (i = 0, l = keys.length; i < l; i++) {
|
2660 | key = keys[i];
|
2661 | ret[i] = render(val[key], key, i);
|
2662 | }
|
2663 | }
|
2664 | }
|
2665 | if (!isDef(ret)) {
|
2666 | ret = [];
|
2667 | }
|
2668 | (ret)._isVList = true;
|
2669 | return ret
|
2670 | }
|
2671 |
|
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 |
|
2677 | function renderSlot (
|
2678 | name,
|
2679 | fallbackRender,
|
2680 | props,
|
2681 | bindObject
|
2682 | ) {
|
2683 | var scopedSlotFn = this.$scopedSlots[name];
|
2684 | var nodes;
|
2685 | if (scopedSlotFn) {
|
2686 |
|
2687 | props = props || {};
|
2688 | if (bindObject) {
|
2689 | if (!isObject(bindObject)) {
|
2690 | warn('slot v-bind without argument expects an Object', this);
|
2691 | }
|
2692 | props = extend(extend({}, bindObject), props);
|
2693 | }
|
2694 | nodes =
|
2695 | scopedSlotFn(props) ||
|
2696 | (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
|
2697 | } else {
|
2698 | nodes =
|
2699 | this.$slots[name] ||
|
2700 | (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
|
2701 | }
|
2702 |
|
2703 | var target = props && props.slot;
|
2704 | if (target) {
|
2705 | return this.$createElement('template', { slot: target }, nodes)
|
2706 | } else {
|
2707 | return nodes
|
2708 | }
|
2709 | }
|
2710 |
|
2711 |
|
2712 |
|
2713 |
|
2714 |
|
2715 |
|
2716 | function resolveFilter (id) {
|
2717 | return resolveAsset(this.$options, 'filters', id, true) || identity
|
2718 | }
|
2719 |
|
2720 |
|
2721 |
|
2722 | function isKeyNotMatch (expect, actual) {
|
2723 | if (Array.isArray(expect)) {
|
2724 | return expect.indexOf(actual) === -1
|
2725 | } else {
|
2726 | return expect !== actual
|
2727 | }
|
2728 | }
|
2729 |
|
2730 |
|
2731 |
|
2732 |
|
2733 |
|
2734 |
|
2735 | function checkKeyCodes (
|
2736 | eventKeyCode,
|
2737 | key,
|
2738 | builtInKeyCode,
|
2739 | eventKeyName,
|
2740 | builtInKeyName
|
2741 | ) {
|
2742 | var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
|
2743 | if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
|
2744 | return isKeyNotMatch(builtInKeyName, eventKeyName)
|
2745 | } else if (mappedKeyCode) {
|
2746 | return isKeyNotMatch(mappedKeyCode, eventKeyCode)
|
2747 | } else if (eventKeyName) {
|
2748 | return hyphenate(eventKeyName) !== key
|
2749 | }
|
2750 | return eventKeyCode === undefined
|
2751 | }
|
2752 |
|
2753 |
|
2754 |
|
2755 |
|
2756 |
|
2757 |
|
2758 | function bindObjectProps (
|
2759 | data,
|
2760 | tag,
|
2761 | value,
|
2762 | asProp,
|
2763 | isSync
|
2764 | ) {
|
2765 | if (value) {
|
2766 | if (!isObject(value)) {
|
2767 | warn(
|
2768 | 'v-bind without argument expects an Object or Array value',
|
2769 | this
|
2770 | );
|
2771 | } else {
|
2772 | if (Array.isArray(value)) {
|
2773 | value = toObject(value);
|
2774 | }
|
2775 | var hash;
|
2776 | var loop = function ( key ) {
|
2777 | if (
|
2778 | key === 'class' ||
|
2779 | key === 'style' ||
|
2780 | isReservedAttribute(key)
|
2781 | ) {
|
2782 | hash = data;
|
2783 | } else {
|
2784 | var type = data.attrs && data.attrs.type;
|
2785 | hash = asProp || config.mustUseProp(tag, type, key)
|
2786 | ? data.domProps || (data.domProps = {})
|
2787 | : data.attrs || (data.attrs = {});
|
2788 | }
|
2789 | var camelizedKey = camelize(key);
|
2790 | var hyphenatedKey = hyphenate(key);
|
2791 | if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
|
2792 | hash[key] = value[key];
|
2793 |
|
2794 | if (isSync) {
|
2795 | var on = data.on || (data.on = {});
|
2796 | on[("update:" + key)] = function ($event) {
|
2797 | value[key] = $event;
|
2798 | };
|
2799 | }
|
2800 | }
|
2801 | };
|
2802 |
|
2803 | for (var key in value) loop( key );
|
2804 | }
|
2805 | }
|
2806 | return data
|
2807 | }
|
2808 |
|
2809 |
|
2810 |
|
2811 |
|
2812 |
|
2813 |
|
2814 | function renderStatic (
|
2815 | index,
|
2816 | isInFor
|
2817 | ) {
|
2818 | var cached = this._staticTrees || (this._staticTrees = []);
|
2819 | var tree = cached[index];
|
2820 |
|
2821 |
|
2822 | if (tree && !isInFor) {
|
2823 | return tree
|
2824 | }
|
2825 |
|
2826 | tree = cached[index] = this.$options.staticRenderFns[index].call(
|
2827 | this._renderProxy,
|
2828 | null,
|
2829 | this
|
2830 | );
|
2831 | markStatic(tree, ("__static__" + index), false);
|
2832 | return tree
|
2833 | }
|
2834 |
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 | function markOnce (
|
2840 | tree,
|
2841 | index,
|
2842 | key
|
2843 | ) {
|
2844 | markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
|
2845 | return tree
|
2846 | }
|
2847 |
|
2848 | function markStatic (
|
2849 | tree,
|
2850 | key,
|
2851 | isOnce
|
2852 | ) {
|
2853 | if (Array.isArray(tree)) {
|
2854 | for (var i = 0; i < tree.length; i++) {
|
2855 | if (tree[i] && typeof tree[i] !== 'string') {
|
2856 | markStaticNode(tree[i], (key + "_" + i), isOnce);
|
2857 | }
|
2858 | }
|
2859 | } else {
|
2860 | markStaticNode(tree, key, isOnce);
|
2861 | }
|
2862 | }
|
2863 |
|
2864 | function markStaticNode (node, key, isOnce) {
|
2865 | node.isStatic = true;
|
2866 | node.key = key;
|
2867 | node.isOnce = isOnce;
|
2868 | }
|
2869 |
|
2870 |
|
2871 |
|
2872 | function bindObjectListeners (data, value) {
|
2873 | if (value) {
|
2874 | if (!isPlainObject(value)) {
|
2875 | warn(
|
2876 | 'v-on without argument expects an Object value',
|
2877 | this
|
2878 | );
|
2879 | } else {
|
2880 | var on = data.on = data.on ? extend({}, data.on) : {};
|
2881 | for (var key in value) {
|
2882 | var existing = on[key];
|
2883 | var ours = value[key];
|
2884 | on[key] = existing ? [].concat(existing, ours) : ours;
|
2885 | }
|
2886 | }
|
2887 | }
|
2888 | return data
|
2889 | }
|
2890 |
|
2891 |
|
2892 |
|
2893 | function resolveScopedSlots (
|
2894 | fns, // see flow/vnode
|
2895 | res,
|
2896 |
|
2897 | hasDynamicKeys,
|
2898 | contentHashKey
|
2899 | ) {
|
2900 | res = res || { $stable: !hasDynamicKeys };
|
2901 | for (var i = 0; i < fns.length; i++) {
|
2902 | var slot = fns[i];
|
2903 | if (Array.isArray(slot)) {
|
2904 | resolveScopedSlots(slot, res, hasDynamicKeys);
|
2905 | } else if (slot) {
|
2906 |
|
2907 | if (slot.proxy) {
|
2908 | slot.fn.proxy = true;
|
2909 | }
|
2910 | res[slot.key] = slot.fn;
|
2911 | }
|
2912 | }
|
2913 | if (contentHashKey) {
|
2914 | (res).$key = contentHashKey;
|
2915 | }
|
2916 | return res
|
2917 | }
|
2918 |
|
2919 |
|
2920 |
|
2921 | function bindDynamicKeys (baseObj, values) {
|
2922 | for (var i = 0; i < values.length; i += 2) {
|
2923 | var key = values[i];
|
2924 | if (typeof key === 'string' && key) {
|
2925 | baseObj[values[i]] = values[i + 1];
|
2926 | } else if (key !== '' && key !== null) {
|
2927 |
|
2928 | warn(
|
2929 | ("Invalid value for dynamic directive argument (expected string or null): " + key),
|
2930 | this
|
2931 | );
|
2932 | }
|
2933 | }
|
2934 | return baseObj
|
2935 | }
|
2936 |
|
2937 |
|
2938 |
|
2939 |
|
2940 | function prependModifier (value, symbol) {
|
2941 | return typeof value === 'string' ? symbol + value : value
|
2942 | }
|
2943 |
|
2944 |
|
2945 |
|
2946 | function installRenderHelpers (target) {
|
2947 | target._o = markOnce;
|
2948 | target._n = toNumber;
|
2949 | target._s = toString;
|
2950 | target._l = renderList;
|
2951 | target._t = renderSlot;
|
2952 | target._q = looseEqual;
|
2953 | target._i = looseIndexOf;
|
2954 | target._m = renderStatic;
|
2955 | target._f = resolveFilter;
|
2956 | target._k = checkKeyCodes;
|
2957 | target._b = bindObjectProps;
|
2958 | target._v = createTextVNode;
|
2959 | target._e = createEmptyVNode;
|
2960 | target._u = resolveScopedSlots;
|
2961 | target._g = bindObjectListeners;
|
2962 | target._d = bindDynamicKeys;
|
2963 | target._p = prependModifier;
|
2964 | }
|
2965 |
|
2966 |
|
2967 |
|
2968 | function FunctionalRenderContext (
|
2969 | data,
|
2970 | props,
|
2971 | children,
|
2972 | parent,
|
2973 | Ctor
|
2974 | ) {
|
2975 | var this$1 = this;
|
2976 |
|
2977 | var options = Ctor.options;
|
2978 |
|
2979 |
|
2980 | var contextVm;
|
2981 | if (hasOwn(parent, '_uid')) {
|
2982 | contextVm = Object.create(parent);
|
2983 |
|
2984 | contextVm._original = parent;
|
2985 | } else {
|
2986 |
|
2987 |
|
2988 |
|
2989 | contextVm = parent;
|
2990 |
|
2991 | parent = parent._original;
|
2992 | }
|
2993 | var isCompiled = isTrue(options._compiled);
|
2994 | var needNormalization = !isCompiled;
|
2995 |
|
2996 | this.data = data;
|
2997 | this.props = props;
|
2998 | this.children = children;
|
2999 | this.parent = parent;
|
3000 | this.listeners = data.on || emptyObject;
|
3001 | this.injections = resolveInject(options.inject, parent);
|
3002 | this.slots = function () {
|
3003 | if (!this$1.$slots) {
|
3004 | normalizeScopedSlots(
|
3005 | data.scopedSlots,
|
3006 | this$1.$slots = resolveSlots(children, parent)
|
3007 | );
|
3008 | }
|
3009 | return this$1.$slots
|
3010 | };
|
3011 |
|
3012 | Object.defineProperty(this, 'scopedSlots', ({
|
3013 | enumerable: true,
|
3014 | get: function get () {
|
3015 | return normalizeScopedSlots(data.scopedSlots, this.slots())
|
3016 | }
|
3017 | }));
|
3018 |
|
3019 |
|
3020 | if (isCompiled) {
|
3021 |
|
3022 | this.$options = options;
|
3023 |
|
3024 | this.$slots = this.slots();
|
3025 | this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
|
3026 | }
|
3027 |
|
3028 | if (options._scopeId) {
|
3029 | this._c = function (a, b, c, d) {
|
3030 | var vnode = createElement(contextVm, a, b, c, d, needNormalization);
|
3031 | if (vnode && !Array.isArray(vnode)) {
|
3032 | vnode.fnScopeId = options._scopeId;
|
3033 | vnode.fnContext = parent;
|
3034 | }
|
3035 | return vnode
|
3036 | };
|
3037 | } else {
|
3038 | this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
|
3039 | }
|
3040 | }
|
3041 |
|
3042 | installRenderHelpers(FunctionalRenderContext.prototype);
|
3043 |
|
3044 | function createFunctionalComponent (
|
3045 | Ctor,
|
3046 | propsData,
|
3047 | data,
|
3048 | contextVm,
|
3049 | children
|
3050 | ) {
|
3051 | var options = Ctor.options;
|
3052 | var props = {};
|
3053 | var propOptions = options.props;
|
3054 | if (isDef(propOptions)) {
|
3055 | for (var key in propOptions) {
|
3056 | props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
3057 | }
|
3058 | } else {
|
3059 | if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
|
3060 | if (isDef(data.props)) { mergeProps(props, data.props); }
|
3061 | }
|
3062 |
|
3063 | var renderContext = new FunctionalRenderContext(
|
3064 | data,
|
3065 | props,
|
3066 | children,
|
3067 | contextVm,
|
3068 | Ctor
|
3069 | );
|
3070 |
|
3071 | var vnode = options.render.call(null, renderContext._c, renderContext);
|
3072 |
|
3073 | if (vnode instanceof VNode) {
|
3074 | return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
|
3075 | } else if (Array.isArray(vnode)) {
|
3076 | var vnodes = normalizeChildren(vnode) || [];
|
3077 | var res = new Array(vnodes.length);
|
3078 | for (var i = 0; i < vnodes.length; i++) {
|
3079 | res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
|
3080 | }
|
3081 | return res
|
3082 | }
|
3083 | }
|
3084 |
|
3085 | function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
|
3086 |
|
3087 |
|
3088 |
|
3089 | var clone = cloneVNode(vnode);
|
3090 | clone.fnContext = contextVm;
|
3091 | clone.fnOptions = options;
|
3092 | {
|
3093 | (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
|
3094 | }
|
3095 | if (data.slot) {
|
3096 | (clone.data || (clone.data = {})).slot = data.slot;
|
3097 | }
|
3098 | return clone
|
3099 | }
|
3100 |
|
3101 | function mergeProps (to, from) {
|
3102 | for (var key in from) {
|
3103 | to[camelize(key)] = from[key];
|
3104 | }
|
3105 | }
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 |
|
3116 | var componentVNodeHooks = {
|
3117 | init: function init (vnode, hydrating) {
|
3118 | if (
|
3119 | vnode.componentInstance &&
|
3120 | !vnode.componentInstance._isDestroyed &&
|
3121 | vnode.data.keepAlive
|
3122 | ) {
|
3123 |
|
3124 | var mountedNode = vnode;
|
3125 | componentVNodeHooks.prepatch(mountedNode, mountedNode);
|
3126 | } else {
|
3127 | var child = vnode.componentInstance = createComponentInstanceForVnode(
|
3128 | vnode,
|
3129 | activeInstance
|
3130 | );
|
3131 | child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
3132 | }
|
3133 | },
|
3134 |
|
3135 | prepatch: function prepatch (oldVnode, vnode) {
|
3136 | var options = vnode.componentOptions;
|
3137 | var child = vnode.componentInstance = oldVnode.componentInstance;
|
3138 | updateChildComponent(
|
3139 | child,
|
3140 | options.propsData,
|
3141 | options.listeners,
|
3142 | vnode,
|
3143 | options.children
|
3144 | );
|
3145 | },
|
3146 |
|
3147 | insert: function insert (vnode) {
|
3148 | var context = vnode.context;
|
3149 | var componentInstance = vnode.componentInstance;
|
3150 | if (!componentInstance._isMounted) {
|
3151 | componentInstance._isMounted = true;
|
3152 | callHook(componentInstance, 'mounted');
|
3153 | }
|
3154 | if (vnode.data.keepAlive) {
|
3155 | if (context._isMounted) {
|
3156 |
|
3157 |
|
3158 |
|
3159 |
|
3160 |
|
3161 | queueActivatedComponent(componentInstance);
|
3162 | } else {
|
3163 | activateChildComponent(componentInstance, true );
|
3164 | }
|
3165 | }
|
3166 | },
|
3167 |
|
3168 | destroy: function destroy (vnode) {
|
3169 | var componentInstance = vnode.componentInstance;
|
3170 | if (!componentInstance._isDestroyed) {
|
3171 | if (!vnode.data.keepAlive) {
|
3172 | componentInstance.$destroy();
|
3173 | } else {
|
3174 | deactivateChildComponent(componentInstance, true );
|
3175 | }
|
3176 | }
|
3177 | }
|
3178 | };
|
3179 |
|
3180 | var hooksToMerge = Object.keys(componentVNodeHooks);
|
3181 |
|
3182 | function createComponent (
|
3183 | Ctor,
|
3184 | data,
|
3185 | context,
|
3186 | children,
|
3187 | tag
|
3188 | ) {
|
3189 | if (isUndef(Ctor)) {
|
3190 | return
|
3191 | }
|
3192 |
|
3193 | var baseCtor = context.$options._base;
|
3194 |
|
3195 |
|
3196 | if (isObject(Ctor)) {
|
3197 | Ctor = baseCtor.extend(Ctor);
|
3198 | }
|
3199 |
|
3200 |
|
3201 |
|
3202 | if (typeof Ctor !== 'function') {
|
3203 | {
|
3204 | warn(("Invalid Component definition: " + (String(Ctor))), context);
|
3205 | }
|
3206 | return
|
3207 | }
|
3208 |
|
3209 |
|
3210 | var asyncFactory;
|
3211 | if (isUndef(Ctor.cid)) {
|
3212 | asyncFactory = Ctor;
|
3213 | Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
|
3214 | if (Ctor === undefined) {
|
3215 |
|
3216 |
|
3217 |
|
3218 | return createAsyncPlaceholder(
|
3219 | asyncFactory,
|
3220 | data,
|
3221 | context,
|
3222 | children,
|
3223 | tag
|
3224 | )
|
3225 | }
|
3226 | }
|
3227 |
|
3228 | data = data || {};
|
3229 |
|
3230 |
|
3231 |
|
3232 | resolveConstructorOptions(Ctor);
|
3233 |
|
3234 |
|
3235 | if (isDef(data.model)) {
|
3236 | transformModel(Ctor.options, data);
|
3237 | }
|
3238 |
|
3239 |
|
3240 | var propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
3241 |
|
3242 |
|
3243 | if (isTrue(Ctor.options.functional)) {
|
3244 | return createFunctionalComponent(Ctor, propsData, data, context, children)
|
3245 | }
|
3246 |
|
3247 |
|
3248 |
|
3249 | var listeners = data.on;
|
3250 |
|
3251 |
|
3252 | data.on = data.nativeOn;
|
3253 |
|
3254 | if (isTrue(Ctor.options.abstract)) {
|
3255 |
|
3256 |
|
3257 |
|
3258 |
|
3259 | var slot = data.slot;
|
3260 | data = {};
|
3261 | if (slot) {
|
3262 | data.slot = slot;
|
3263 | }
|
3264 | }
|
3265 |
|
3266 |
|
3267 | installComponentHooks(data);
|
3268 |
|
3269 |
|
3270 | var name = Ctor.options.name || tag;
|
3271 | var vnode = new VNode(
|
3272 | ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
|
3273 | data, undefined, undefined, undefined, context,
|
3274 | { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
|
3275 | asyncFactory
|
3276 | );
|
3277 |
|
3278 | return vnode
|
3279 | }
|
3280 |
|
3281 | function createComponentInstanceForVnode (
|
3282 | // we know it's MountedComponentVNode but flow doesn't
|
3283 | vnode,
|
3284 | // activeInstance in lifecycle state
|
3285 | parent
|
3286 | ) {
|
3287 | var options = {
|
3288 | _isComponent: true,
|
3289 | _parentVnode: vnode,
|
3290 | parent: parent
|
3291 | };
|
3292 |
|
3293 | var inlineTemplate = vnode.data.inlineTemplate;
|
3294 | if (isDef(inlineTemplate)) {
|
3295 | options.render = inlineTemplate.render;
|
3296 | options.staticRenderFns = inlineTemplate.staticRenderFns;
|
3297 | }
|
3298 | return new vnode.componentOptions.Ctor(options)
|
3299 | }
|
3300 |
|
3301 | function installComponentHooks (data) {
|
3302 | var hooks = data.hook || (data.hook = {});
|
3303 | for (var i = 0; i < hooksToMerge.length; i++) {
|
3304 | var key = hooksToMerge[i];
|
3305 | var existing = hooks[key];
|
3306 | var toMerge = componentVNodeHooks[key];
|
3307 | if (existing !== toMerge && !(existing && existing._merged)) {
|
3308 | hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
|
3309 | }
|
3310 | }
|
3311 | }
|
3312 |
|
3313 | function mergeHook$1 (f1, f2) {
|
3314 | var merged = function (a, b) {
|
3315 |
|
3316 | f1(a, b);
|
3317 | f2(a, b);
|
3318 | };
|
3319 | merged._merged = true;
|
3320 | return merged
|
3321 | }
|
3322 |
|
3323 |
|
3324 |
|
3325 | function transformModel (options, data) {
|
3326 | var prop = (options.model && options.model.prop) || 'value';
|
3327 | var event = (options.model && options.model.event) || 'input'
|
3328 | ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
|
3329 | var on = data.on || (data.on = {});
|
3330 | var existing = on[event];
|
3331 | var callback = data.model.callback;
|
3332 | if (isDef(existing)) {
|
3333 | if (
|
3334 | Array.isArray(existing)
|
3335 | ? existing.indexOf(callback) === -1
|
3336 | : existing !== callback
|
3337 | ) {
|
3338 | on[event] = [callback].concat(existing);
|
3339 | }
|
3340 | } else {
|
3341 | on[event] = callback;
|
3342 | }
|
3343 | }
|
3344 |
|
3345 |
|
3346 |
|
3347 | var SIMPLE_NORMALIZE = 1;
|
3348 | var ALWAYS_NORMALIZE = 2;
|
3349 |
|
3350 |
|
3351 |
|
3352 | function createElement (
|
3353 | context,
|
3354 | tag,
|
3355 | data,
|
3356 | children,
|
3357 | normalizationType,
|
3358 | alwaysNormalize
|
3359 | ) {
|
3360 | if (Array.isArray(data) || isPrimitive(data)) {
|
3361 | normalizationType = children;
|
3362 | children = data;
|
3363 | data = undefined;
|
3364 | }
|
3365 | if (isTrue(alwaysNormalize)) {
|
3366 | normalizationType = ALWAYS_NORMALIZE;
|
3367 | }
|
3368 | return _createElement(context, tag, data, children, normalizationType)
|
3369 | }
|
3370 |
|
3371 | function _createElement (
|
3372 | context,
|
3373 | tag,
|
3374 | data,
|
3375 | children,
|
3376 | normalizationType
|
3377 | ) {
|
3378 | if (isDef(data) && isDef((data).__ob__)) {
|
3379 | warn(
|
3380 | "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
|
3381 | 'Always create fresh vnode data objects in each render!',
|
3382 | context
|
3383 | );
|
3384 | return createEmptyVNode()
|
3385 | }
|
3386 |
|
3387 | if (isDef(data) && isDef(data.is)) {
|
3388 | tag = data.is;
|
3389 | }
|
3390 | if (!tag) {
|
3391 |
|
3392 | return createEmptyVNode()
|
3393 | }
|
3394 |
|
3395 | if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
|
3396 | ) {
|
3397 | {
|
3398 | warn(
|
3399 | 'Avoid using non-primitive value as key, ' +
|
3400 | 'use string/number value instead.',
|
3401 | context
|
3402 | );
|
3403 | }
|
3404 | }
|
3405 |
|
3406 | if (Array.isArray(children) &&
|
3407 | typeof children[0] === 'function'
|
3408 | ) {
|
3409 | data = data || {};
|
3410 | data.scopedSlots = { default: children[0] };
|
3411 | children.length = 0;
|
3412 | }
|
3413 | if (normalizationType === ALWAYS_NORMALIZE) {
|
3414 | children = normalizeChildren(children);
|
3415 | } else if (normalizationType === SIMPLE_NORMALIZE) {
|
3416 | children = simpleNormalizeChildren(children);
|
3417 | }
|
3418 | var vnode, ns;
|
3419 | if (typeof tag === 'string') {
|
3420 | var Ctor;
|
3421 | ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
3422 | if (config.isReservedTag(tag)) {
|
3423 |
|
3424 | if (isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') {
|
3425 | warn(
|
3426 | ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
|
3427 | context
|
3428 | );
|
3429 | }
|
3430 | vnode = new VNode(
|
3431 | config.parsePlatformTagName(tag), data, children,
|
3432 | undefined, undefined, context
|
3433 | );
|
3434 | } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
|
3435 |
|
3436 | vnode = createComponent(Ctor, data, context, children, tag);
|
3437 | } else {
|
3438 |
|
3439 |
|
3440 |
|
3441 | vnode = new VNode(
|
3442 | tag, data, children,
|
3443 | undefined, undefined, context
|
3444 | );
|
3445 | }
|
3446 | } else {
|
3447 |
|
3448 | vnode = createComponent(tag, data, context, children);
|
3449 | }
|
3450 | if (Array.isArray(vnode)) {
|
3451 | return vnode
|
3452 | } else if (isDef(vnode)) {
|
3453 | if (isDef(ns)) { applyNS(vnode, ns); }
|
3454 | if (isDef(data)) { registerDeepBindings(data); }
|
3455 | return vnode
|
3456 | } else {
|
3457 | return createEmptyVNode()
|
3458 | }
|
3459 | }
|
3460 |
|
3461 | function applyNS (vnode, ns, force) {
|
3462 | vnode.ns = ns;
|
3463 | if (vnode.tag === 'foreignObject') {
|
3464 |
|
3465 | ns = undefined;
|
3466 | force = true;
|
3467 | }
|
3468 | if (isDef(vnode.children)) {
|
3469 | for (var i = 0, l = vnode.children.length; i < l; i++) {
|
3470 | var child = vnode.children[i];
|
3471 | if (isDef(child.tag) && (
|
3472 | isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
|
3473 | applyNS(child, ns, force);
|
3474 | }
|
3475 | }
|
3476 | }
|
3477 | }
|
3478 |
|
3479 |
|
3480 |
|
3481 |
|
3482 | function registerDeepBindings (data) {
|
3483 | if (isObject(data.style)) {
|
3484 | traverse(data.style);
|
3485 | }
|
3486 | if (isObject(data.class)) {
|
3487 | traverse(data.class);
|
3488 | }
|
3489 | }
|
3490 |
|
3491 |
|
3492 |
|
3493 | function initRender (vm) {
|
3494 | vm._vnode = null;
|
3495 | vm._staticTrees = null;
|
3496 | var options = vm.$options;
|
3497 | var parentVnode = vm.$vnode = options._parentVnode;
|
3498 | var renderContext = parentVnode && parentVnode.context;
|
3499 | vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
3500 | vm.$scopedSlots = emptyObject;
|
3501 |
|
3502 |
|
3503 |
|
3504 |
|
3505 | vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
3506 |
|
3507 |
|
3508 | vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
|
3509 |
|
3510 |
|
3511 |
|
3512 | var parentData = parentVnode && parentVnode.data;
|
3513 |
|
3514 |
|
3515 | {
|
3516 | defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
|
3517 | !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
|
3518 | }, true);
|
3519 | defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
|
3520 | !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
|
3521 | }, true);
|
3522 | }
|
3523 | }
|
3524 |
|
3525 | var currentRenderingInstance = null;
|
3526 |
|
3527 | function renderMixin (Vue) {
|
3528 |
|
3529 | installRenderHelpers(Vue.prototype);
|
3530 |
|
3531 | Vue.prototype.$nextTick = function (fn) {
|
3532 | return nextTick(fn, this)
|
3533 | };
|
3534 |
|
3535 | Vue.prototype._render = function () {
|
3536 | var vm = this;
|
3537 | var ref = vm.$options;
|
3538 | var render = ref.render;
|
3539 | var _parentVnode = ref._parentVnode;
|
3540 |
|
3541 | if (_parentVnode) {
|
3542 | vm.$scopedSlots = normalizeScopedSlots(
|
3543 | _parentVnode.data.scopedSlots,
|
3544 | vm.$slots,
|
3545 | vm.$scopedSlots
|
3546 | );
|
3547 | }
|
3548 |
|
3549 |
|
3550 |
|
3551 | vm.$vnode = _parentVnode;
|
3552 |
|
3553 | var vnode;
|
3554 | try {
|
3555 |
|
3556 |
|
3557 |
|
3558 | currentRenderingInstance = vm;
|
3559 | vnode = render.call(vm._renderProxy, vm.$createElement);
|
3560 | } catch (e) {
|
3561 | handleError(e, vm, "render");
|
3562 |
|
3563 |
|
3564 |
|
3565 | if (vm.$options.renderError) {
|
3566 | try {
|
3567 | vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
|
3568 | } catch (e) {
|
3569 | handleError(e, vm, "renderError");
|
3570 | vnode = vm._vnode;
|
3571 | }
|
3572 | } else {
|
3573 | vnode = vm._vnode;
|
3574 | }
|
3575 | } finally {
|
3576 | currentRenderingInstance = null;
|
3577 | }
|
3578 |
|
3579 | if (Array.isArray(vnode) && vnode.length === 1) {
|
3580 | vnode = vnode[0];
|
3581 | }
|
3582 |
|
3583 | if (!(vnode instanceof VNode)) {
|
3584 | if (Array.isArray(vnode)) {
|
3585 | warn(
|
3586 | 'Multiple root nodes returned from render function. Render function ' +
|
3587 | 'should return a single root node.',
|
3588 | vm
|
3589 | );
|
3590 | }
|
3591 | vnode = createEmptyVNode();
|
3592 | }
|
3593 |
|
3594 | vnode.parent = _parentVnode;
|
3595 | return vnode
|
3596 | };
|
3597 | }
|
3598 |
|
3599 |
|
3600 |
|
3601 | function ensureCtor (comp, base) {
|
3602 | if (
|
3603 | comp.__esModule ||
|
3604 | (hasSymbol && comp[Symbol.toStringTag] === 'Module')
|
3605 | ) {
|
3606 | comp = comp.default;
|
3607 | }
|
3608 | return isObject(comp)
|
3609 | ? base.extend(comp)
|
3610 | : comp
|
3611 | }
|
3612 |
|
3613 | function createAsyncPlaceholder (
|
3614 | factory,
|
3615 | data,
|
3616 | context,
|
3617 | children,
|
3618 | tag
|
3619 | ) {
|
3620 | var node = createEmptyVNode();
|
3621 | node.asyncFactory = factory;
|
3622 | node.asyncMeta = { data: data, context: context, children: children, tag: tag };
|
3623 | return node
|
3624 | }
|
3625 |
|
3626 | function resolveAsyncComponent (
|
3627 | factory,
|
3628 | baseCtor
|
3629 | ) {
|
3630 | if (isTrue(factory.error) && isDef(factory.errorComp)) {
|
3631 | return factory.errorComp
|
3632 | }
|
3633 |
|
3634 | if (isDef(factory.resolved)) {
|
3635 | return factory.resolved
|
3636 | }
|
3637 |
|
3638 | var owner = currentRenderingInstance;
|
3639 | if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
|
3640 |
|
3641 | factory.owners.push(owner);
|
3642 | }
|
3643 |
|
3644 | if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
3645 | return factory.loadingComp
|
3646 | }
|
3647 |
|
3648 | if (owner && !isDef(factory.owners)) {
|
3649 | var owners = factory.owners = [owner];
|
3650 | var sync = true;
|
3651 | var timerLoading = null;
|
3652 | var timerTimeout = null
|
3653 |
|
3654 | ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
|
3655 |
|
3656 | var forceRender = function (renderCompleted) {
|
3657 | for (var i = 0, l = owners.length; i < l; i++) {
|
3658 | (owners[i]).$forceUpdate();
|
3659 | }
|
3660 |
|
3661 | if (renderCompleted) {
|
3662 | owners.length = 0;
|
3663 | if (timerLoading !== null) {
|
3664 | clearTimeout(timerLoading);
|
3665 | timerLoading = null;
|
3666 | }
|
3667 | if (timerTimeout !== null) {
|
3668 | clearTimeout(timerTimeout);
|
3669 | timerTimeout = null;
|
3670 | }
|
3671 | }
|
3672 | };
|
3673 |
|
3674 | var resolve = once(function (res) {
|
3675 |
|
3676 | factory.resolved = ensureCtor(res, baseCtor);
|
3677 |
|
3678 |
|
3679 | if (!sync) {
|
3680 | forceRender(true);
|
3681 | } else {
|
3682 | owners.length = 0;
|
3683 | }
|
3684 | });
|
3685 |
|
3686 | var reject = once(function (reason) {
|
3687 | warn(
|
3688 | "Failed to resolve async component: " + (String(factory)) +
|
3689 | (reason ? ("\nReason: " + reason) : '')
|
3690 | );
|
3691 | if (isDef(factory.errorComp)) {
|
3692 | factory.error = true;
|
3693 | forceRender(true);
|
3694 | }
|
3695 | });
|
3696 |
|
3697 | var res = factory(resolve, reject);
|
3698 |
|
3699 | if (isObject(res)) {
|
3700 | if (isPromise(res)) {
|
3701 |
|
3702 | if (isUndef(factory.resolved)) {
|
3703 | res.then(resolve, reject);
|
3704 | }
|
3705 | } else if (isPromise(res.component)) {
|
3706 | res.component.then(resolve, reject);
|
3707 |
|
3708 | if (isDef(res.error)) {
|
3709 | factory.errorComp = ensureCtor(res.error, baseCtor);
|
3710 | }
|
3711 |
|
3712 | if (isDef(res.loading)) {
|
3713 | factory.loadingComp = ensureCtor(res.loading, baseCtor);
|
3714 | if (res.delay === 0) {
|
3715 | factory.loading = true;
|
3716 | } else {
|
3717 | timerLoading = setTimeout(function () {
|
3718 | timerLoading = null;
|
3719 | if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
3720 | factory.loading = true;
|
3721 | forceRender(false);
|
3722 | }
|
3723 | }, res.delay || 200);
|
3724 | }
|
3725 | }
|
3726 |
|
3727 | if (isDef(res.timeout)) {
|
3728 | timerTimeout = setTimeout(function () {
|
3729 | timerTimeout = null;
|
3730 | if (isUndef(factory.resolved)) {
|
3731 | reject(
|
3732 | "timeout (" + (res.timeout) + "ms)"
|
3733 | );
|
3734 | }
|
3735 | }, res.timeout);
|
3736 | }
|
3737 | }
|
3738 | }
|
3739 |
|
3740 | sync = false;
|
3741 |
|
3742 | return factory.loading
|
3743 | ? factory.loadingComp
|
3744 | : factory.resolved
|
3745 | }
|
3746 | }
|
3747 |
|
3748 |
|
3749 |
|
3750 | function getFirstComponentChild (children) {
|
3751 | if (Array.isArray(children)) {
|
3752 | for (var i = 0; i < children.length; i++) {
|
3753 | var c = children[i];
|
3754 | if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
|
3755 | return c
|
3756 | }
|
3757 | }
|
3758 | }
|
3759 | }
|
3760 |
|
3761 |
|
3762 |
|
3763 |
|
3764 |
|
3765 | function initEvents (vm) {
|
3766 | vm._events = Object.create(null);
|
3767 | vm._hasHookEvent = false;
|
3768 |
|
3769 | var listeners = vm.$options._parentListeners;
|
3770 | if (listeners) {
|
3771 | updateComponentListeners(vm, listeners);
|
3772 | }
|
3773 | }
|
3774 |
|
3775 | var target;
|
3776 |
|
3777 | function add (event, fn) {
|
3778 | target.$on(event, fn);
|
3779 | }
|
3780 |
|
3781 | function remove$1 (event, fn) {
|
3782 | target.$off(event, fn);
|
3783 | }
|
3784 |
|
3785 | function createOnceHandler (event, fn) {
|
3786 | var _target = target;
|
3787 | return function onceHandler () {
|
3788 | var res = fn.apply(null, arguments);
|
3789 | if (res !== null) {
|
3790 | _target.$off(event, onceHandler);
|
3791 | }
|
3792 | }
|
3793 | }
|
3794 |
|
3795 | function updateComponentListeners (
|
3796 | vm,
|
3797 | listeners,
|
3798 | oldListeners
|
3799 | ) {
|
3800 | target = vm;
|
3801 | updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
|
3802 | target = undefined;
|
3803 | }
|
3804 |
|
3805 | function eventsMixin (Vue) {
|
3806 | var hookRE = /^hook:/;
|
3807 | Vue.prototype.$on = function (event, fn) {
|
3808 | var vm = this;
|
3809 | if (Array.isArray(event)) {
|
3810 | for (var i = 0, l = event.length; i < l; i++) {
|
3811 | vm.$on(event[i], fn);
|
3812 | }
|
3813 | } else {
|
3814 | (vm._events[event] || (vm._events[event] = [])).push(fn);
|
3815 |
|
3816 |
|
3817 | if (hookRE.test(event)) {
|
3818 | vm._hasHookEvent = true;
|
3819 | }
|
3820 | }
|
3821 | return vm
|
3822 | };
|
3823 |
|
3824 | Vue.prototype.$once = function (event, fn) {
|
3825 | var vm = this;
|
3826 | function on () {
|
3827 | vm.$off(event, on);
|
3828 | fn.apply(vm, arguments);
|
3829 | }
|
3830 | on.fn = fn;
|
3831 | vm.$on(event, on);
|
3832 | return vm
|
3833 | };
|
3834 |
|
3835 | Vue.prototype.$off = function (event, fn) {
|
3836 | var vm = this;
|
3837 |
|
3838 | if (!arguments.length) {
|
3839 | vm._events = Object.create(null);
|
3840 | return vm
|
3841 | }
|
3842 |
|
3843 | if (Array.isArray(event)) {
|
3844 | for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
|
3845 | vm.$off(event[i$1], fn);
|
3846 | }
|
3847 | return vm
|
3848 | }
|
3849 |
|
3850 | var cbs = vm._events[event];
|
3851 | if (!cbs) {
|
3852 | return vm
|
3853 | }
|
3854 | if (!fn) {
|
3855 | vm._events[event] = null;
|
3856 | return vm
|
3857 | }
|
3858 |
|
3859 | var cb;
|
3860 | var i = cbs.length;
|
3861 | while (i--) {
|
3862 | cb = cbs[i];
|
3863 | if (cb === fn || cb.fn === fn) {
|
3864 | cbs.splice(i, 1);
|
3865 | break
|
3866 | }
|
3867 | }
|
3868 | return vm
|
3869 | };
|
3870 |
|
3871 | Vue.prototype.$emit = function (event) {
|
3872 | var vm = this;
|
3873 | {
|
3874 | var lowerCaseEvent = event.toLowerCase();
|
3875 | if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
|
3876 | tip(
|
3877 | "Event \"" + lowerCaseEvent + "\" is emitted in component " +
|
3878 | (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
|
3879 | "Note that HTML attributes are case-insensitive and you cannot use " +
|
3880 | "v-on to listen to camelCase events when using in-DOM templates. " +
|
3881 | "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
|
3882 | );
|
3883 | }
|
3884 | }
|
3885 | var cbs = vm._events[event];
|
3886 | if (cbs) {
|
3887 | cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
3888 | var args = toArray(arguments, 1);
|
3889 | var info = "event handler for \"" + event + "\"";
|
3890 | for (var i = 0, l = cbs.length; i < l; i++) {
|
3891 | invokeWithErrorHandling(cbs[i], vm, args, vm, info);
|
3892 | }
|
3893 | }
|
3894 | return vm
|
3895 | };
|
3896 | }
|
3897 |
|
3898 |
|
3899 |
|
3900 | var activeInstance = null;
|
3901 | var isUpdatingChildComponent = false;
|
3902 |
|
3903 | function setActiveInstance(vm) {
|
3904 | var prevActiveInstance = activeInstance;
|
3905 | activeInstance = vm;
|
3906 | return function () {
|
3907 | activeInstance = prevActiveInstance;
|
3908 | }
|
3909 | }
|
3910 |
|
3911 | function initLifecycle (vm) {
|
3912 | var options = vm.$options;
|
3913 |
|
3914 |
|
3915 | var parent = options.parent;
|
3916 | if (parent && !options.abstract) {
|
3917 | while (parent.$options.abstract && parent.$parent) {
|
3918 | parent = parent.$parent;
|
3919 | }
|
3920 | parent.$children.push(vm);
|
3921 | }
|
3922 |
|
3923 | vm.$parent = parent;
|
3924 | vm.$root = parent ? parent.$root : vm;
|
3925 |
|
3926 | vm.$children = [];
|
3927 | vm.$refs = {};
|
3928 |
|
3929 | vm._watcher = null;
|
3930 | vm._inactive = null;
|
3931 | vm._directInactive = false;
|
3932 | vm._isMounted = false;
|
3933 | vm._isDestroyed = false;
|
3934 | vm._isBeingDestroyed = false;
|
3935 | }
|
3936 |
|
3937 | function lifecycleMixin (Vue) {
|
3938 | Vue.prototype._update = function (vnode, hydrating) {
|
3939 | var vm = this;
|
3940 | var prevEl = vm.$el;
|
3941 | var prevVnode = vm._vnode;
|
3942 | var restoreActiveInstance = setActiveInstance(vm);
|
3943 | vm._vnode = vnode;
|
3944 |
|
3945 |
|
3946 | if (!prevVnode) {
|
3947 |
|
3948 | vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false );
|
3949 | } else {
|
3950 |
|
3951 | vm.$el = vm.__patch__(prevVnode, vnode);
|
3952 | }
|
3953 | restoreActiveInstance();
|
3954 |
|
3955 | if (prevEl) {
|
3956 | prevEl.__vue__ = null;
|
3957 | }
|
3958 | if (vm.$el) {
|
3959 | vm.$el.__vue__ = vm;
|
3960 | }
|
3961 |
|
3962 | if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
3963 | vm.$parent.$el = vm.$el;
|
3964 | }
|
3965 |
|
3966 |
|
3967 | };
|
3968 |
|
3969 | Vue.prototype.$forceUpdate = function () {
|
3970 | var vm = this;
|
3971 | if (vm._watcher) {
|
3972 | vm._watcher.update();
|
3973 | }
|
3974 | };
|
3975 |
|
3976 | Vue.prototype.$destroy = function () {
|
3977 | var vm = this;
|
3978 | if (vm._isBeingDestroyed) {
|
3979 | return
|
3980 | }
|
3981 | callHook(vm, 'beforeDestroy');
|
3982 | vm._isBeingDestroyed = true;
|
3983 |
|
3984 | var parent = vm.$parent;
|
3985 | if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
3986 | remove(parent.$children, vm);
|
3987 | }
|
3988 |
|
3989 | if (vm._watcher) {
|
3990 | vm._watcher.teardown();
|
3991 | }
|
3992 | var i = vm._watchers.length;
|
3993 | while (i--) {
|
3994 | vm._watchers[i].teardown();
|
3995 | }
|
3996 |
|
3997 |
|
3998 | if (vm._data.__ob__) {
|
3999 | vm._data.__ob__.vmCount--;
|
4000 | }
|
4001 |
|
4002 | vm._isDestroyed = true;
|
4003 |
|
4004 | vm.__patch__(vm._vnode, null);
|
4005 |
|
4006 | callHook(vm, 'destroyed');
|
4007 |
|
4008 | vm.$off();
|
4009 |
|
4010 | if (vm.$el) {
|
4011 | vm.$el.__vue__ = null;
|
4012 | }
|
4013 |
|
4014 | if (vm.$vnode) {
|
4015 | vm.$vnode.parent = null;
|
4016 | }
|
4017 | };
|
4018 | }
|
4019 |
|
4020 | function mountComponent (
|
4021 | vm,
|
4022 | el,
|
4023 | hydrating
|
4024 | ) {
|
4025 | vm.$el = el;
|
4026 | if (!vm.$options.render) {
|
4027 | vm.$options.render = createEmptyVNode;
|
4028 | {
|
4029 |
|
4030 | if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
4031 | vm.$options.el || el) {
|
4032 | warn(
|
4033 | 'You are using the runtime-only build of Vue where the template ' +
|
4034 | 'compiler is not available. Either pre-compile the templates into ' +
|
4035 | 'render functions, or use the compiler-included build.',
|
4036 | vm
|
4037 | );
|
4038 | } else {
|
4039 | warn(
|
4040 | 'Failed to mount component: template or render function not defined.',
|
4041 | vm
|
4042 | );
|
4043 | }
|
4044 | }
|
4045 | }
|
4046 | callHook(vm, 'beforeMount');
|
4047 |
|
4048 | var updateComponent;
|
4049 |
|
4050 | if (config.performance && mark) {
|
4051 | updateComponent = function () {
|
4052 | var name = vm._name;
|
4053 | var id = vm._uid;
|
4054 | var startTag = "vue-perf-start:" + id;
|
4055 | var endTag = "vue-perf-end:" + id;
|
4056 |
|
4057 | mark(startTag);
|
4058 | var vnode = vm._render();
|
4059 | mark(endTag);
|
4060 | measure(("vue " + name + " render"), startTag, endTag);
|
4061 |
|
4062 | mark(startTag);
|
4063 | vm._update(vnode, hydrating);
|
4064 | mark(endTag);
|
4065 | measure(("vue " + name + " patch"), startTag, endTag);
|
4066 | };
|
4067 | } else {
|
4068 | updateComponent = function () {
|
4069 | vm._update(vm._render(), hydrating);
|
4070 | };
|
4071 | }
|
4072 |
|
4073 |
|
4074 |
|
4075 |
|
4076 | new Watcher(vm, updateComponent, noop, {
|
4077 | before: function before () {
|
4078 | if (vm._isMounted && !vm._isDestroyed) {
|
4079 | callHook(vm, 'beforeUpdate');
|
4080 | }
|
4081 | }
|
4082 | }, true );
|
4083 | hydrating = false;
|
4084 |
|
4085 |
|
4086 |
|
4087 | if (vm.$vnode == null) {
|
4088 | vm._isMounted = true;
|
4089 | callHook(vm, 'mounted');
|
4090 | }
|
4091 | return vm
|
4092 | }
|
4093 |
|
4094 | function updateChildComponent (
|
4095 | vm,
|
4096 | propsData,
|
4097 | listeners,
|
4098 | parentVnode,
|
4099 | renderChildren
|
4100 | ) {
|
4101 | {
|
4102 | isUpdatingChildComponent = true;
|
4103 | }
|
4104 |
|
4105 |
|
4106 |
|
4107 |
|
4108 |
|
4109 |
|
4110 |
|
4111 | var newScopedSlots = parentVnode.data.scopedSlots;
|
4112 | var oldScopedSlots = vm.$scopedSlots;
|
4113 | var hasDynamicScopedSlot = !!(
|
4114 | (newScopedSlots && !newScopedSlots.$stable) ||
|
4115 | (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
4116 | (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
|
4117 | (!newScopedSlots && vm.$scopedSlots.$key)
|
4118 | );
|
4119 |
|
4120 |
|
4121 |
|
4122 |
|
4123 | var needsForceUpdate = !!(
|
4124 | renderChildren ||
|
4125 | vm.$options._renderChildren ||
|
4126 | hasDynamicScopedSlot
|
4127 | );
|
4128 |
|
4129 | vm.$options._parentVnode = parentVnode;
|
4130 | vm.$vnode = parentVnode;
|
4131 |
|
4132 | if (vm._vnode) {
|
4133 | vm._vnode.parent = parentVnode;
|
4134 | }
|
4135 | vm.$options._renderChildren = renderChildren;
|
4136 |
|
4137 |
|
4138 |
|
4139 |
|
4140 | vm.$attrs = parentVnode.data.attrs || emptyObject;
|
4141 | vm.$listeners = listeners || emptyObject;
|
4142 |
|
4143 |
|
4144 | if (propsData && vm.$options.props) {
|
4145 | toggleObserving(false);
|
4146 | var props = vm._props;
|
4147 | var propKeys = vm.$options._propKeys || [];
|
4148 | for (var i = 0; i < propKeys.length; i++) {
|
4149 | var key = propKeys[i];
|
4150 | var propOptions = vm.$options.props;
|
4151 | props[key] = validateProp(key, propOptions, propsData, vm);
|
4152 | }
|
4153 | toggleObserving(true);
|
4154 |
|
4155 | vm.$options.propsData = propsData;
|
4156 | }
|
4157 |
|
4158 |
|
4159 | listeners = listeners || emptyObject;
|
4160 | var oldListeners = vm.$options._parentListeners;
|
4161 | vm.$options._parentListeners = listeners;
|
4162 | updateComponentListeners(vm, listeners, oldListeners);
|
4163 |
|
4164 |
|
4165 | if (needsForceUpdate) {
|
4166 | vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
4167 | vm.$forceUpdate();
|
4168 | }
|
4169 |
|
4170 | {
|
4171 | isUpdatingChildComponent = false;
|
4172 | }
|
4173 | }
|
4174 |
|
4175 | function isInInactiveTree (vm) {
|
4176 | while (vm && (vm = vm.$parent)) {
|
4177 | if (vm._inactive) { return true }
|
4178 | }
|
4179 | return false
|
4180 | }
|
4181 |
|
4182 | function activateChildComponent (vm, direct) {
|
4183 | if (direct) {
|
4184 | vm._directInactive = false;
|
4185 | if (isInInactiveTree(vm)) {
|
4186 | return
|
4187 | }
|
4188 | } else if (vm._directInactive) {
|
4189 | return
|
4190 | }
|
4191 | if (vm._inactive || vm._inactive === null) {
|
4192 | vm._inactive = false;
|
4193 | for (var i = 0; i < vm.$children.length; i++) {
|
4194 | activateChildComponent(vm.$children[i]);
|
4195 | }
|
4196 | callHook(vm, 'activated');
|
4197 | }
|
4198 | }
|
4199 |
|
4200 | function deactivateChildComponent (vm, direct) {
|
4201 | if (direct) {
|
4202 | vm._directInactive = true;
|
4203 | if (isInInactiveTree(vm)) {
|
4204 | return
|
4205 | }
|
4206 | }
|
4207 | if (!vm._inactive) {
|
4208 | vm._inactive = true;
|
4209 | for (var i = 0; i < vm.$children.length; i++) {
|
4210 | deactivateChildComponent(vm.$children[i]);
|
4211 | }
|
4212 | callHook(vm, 'deactivated');
|
4213 | }
|
4214 | }
|
4215 |
|
4216 | function callHook (vm, hook) {
|
4217 |
|
4218 | pushTarget();
|
4219 | var handlers = vm.$options[hook];
|
4220 | var info = hook + " hook";
|
4221 | if (handlers) {
|
4222 | for (var i = 0, j = handlers.length; i < j; i++) {
|
4223 | invokeWithErrorHandling(handlers[i], vm, null, vm, info);
|
4224 | }
|
4225 | }
|
4226 | if (vm._hasHookEvent) {
|
4227 | vm.$emit('hook:' + hook);
|
4228 | }
|
4229 | popTarget();
|
4230 | }
|
4231 |
|
4232 |
|
4233 |
|
4234 | var MAX_UPDATE_COUNT = 100;
|
4235 |
|
4236 | var queue = [];
|
4237 | var activatedChildren = [];
|
4238 | var has = {};
|
4239 | var circular = {};
|
4240 | var waiting = false;
|
4241 | var flushing = false;
|
4242 | var index = 0;
|
4243 |
|
4244 |
|
4245 |
|
4246 |
|
4247 | function resetSchedulerState () {
|
4248 | index = queue.length = activatedChildren.length = 0;
|
4249 | has = {};
|
4250 | {
|
4251 | circular = {};
|
4252 | }
|
4253 | waiting = flushing = false;
|
4254 | }
|
4255 |
|
4256 |
|
4257 |
|
4258 |
|
4259 |
|
4260 |
|
4261 | var currentFlushTimestamp = 0;
|
4262 |
|
4263 |
|
4264 | var getNow = Date.now;
|
4265 |
|
4266 |
|
4267 |
|
4268 |
|
4269 |
|
4270 |
|
4271 |
|
4272 | if (inBrowser && !isIE) {
|
4273 | var performance = window.performance;
|
4274 | if (
|
4275 | performance &&
|
4276 | typeof performance.now === 'function' &&
|
4277 | getNow() > document.createEvent('Event').timeStamp
|
4278 | ) {
|
4279 |
|
4280 |
|
4281 |
|
4282 |
|
4283 | getNow = function () { return performance.now(); };
|
4284 | }
|
4285 | }
|
4286 |
|
4287 |
|
4288 |
|
4289 |
|
4290 | function flushSchedulerQueue () {
|
4291 | currentFlushTimestamp = getNow();
|
4292 | flushing = true;
|
4293 | var watcher, id;
|
4294 |
|
4295 |
|
4296 |
|
4297 |
|
4298 |
|
4299 |
|
4300 |
|
4301 |
|
4302 |
|
4303 | queue.sort(function (a, b) { return a.id - b.id; });
|
4304 |
|
4305 |
|
4306 |
|
4307 | for (index = 0; index < queue.length; index++) {
|
4308 | watcher = queue[index];
|
4309 | if (watcher.before) {
|
4310 | watcher.before();
|
4311 | }
|
4312 | id = watcher.id;
|
4313 | has[id] = null;
|
4314 | watcher.run();
|
4315 |
|
4316 | if (has[id] != null) {
|
4317 | circular[id] = (circular[id] || 0) + 1;
|
4318 | if (circular[id] > MAX_UPDATE_COUNT) {
|
4319 | warn(
|
4320 | 'You may have an infinite update loop ' + (
|
4321 | watcher.user
|
4322 | ? ("in watcher with expression \"" + (watcher.expression) + "\"")
|
4323 | : "in a component render function."
|
4324 | ),
|
4325 | watcher.vm
|
4326 | );
|
4327 | break
|
4328 | }
|
4329 | }
|
4330 | }
|
4331 |
|
4332 |
|
4333 | var activatedQueue = activatedChildren.slice();
|
4334 | var updatedQueue = queue.slice();
|
4335 |
|
4336 | resetSchedulerState();
|
4337 |
|
4338 |
|
4339 | callActivatedHooks(activatedQueue);
|
4340 | callUpdatedHooks(updatedQueue);
|
4341 |
|
4342 |
|
4343 |
|
4344 | if (devtools && config.devtools) {
|
4345 | devtools.emit('flush');
|
4346 | }
|
4347 | }
|
4348 |
|
4349 | function callUpdatedHooks (queue) {
|
4350 | var i = queue.length;
|
4351 | while (i--) {
|
4352 | var watcher = queue[i];
|
4353 | var vm = watcher.vm;
|
4354 | if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
|
4355 | callHook(vm, 'updated');
|
4356 | }
|
4357 | }
|
4358 | }
|
4359 |
|
4360 |
|
4361 |
|
4362 |
|
4363 |
|
4364 | function queueActivatedComponent (vm) {
|
4365 |
|
4366 |
|
4367 | vm._inactive = false;
|
4368 | activatedChildren.push(vm);
|
4369 | }
|
4370 |
|
4371 | function callActivatedHooks (queue) {
|
4372 | for (var i = 0; i < queue.length; i++) {
|
4373 | queue[i]._inactive = true;
|
4374 | activateChildComponent(queue[i], true );
|
4375 | }
|
4376 | }
|
4377 |
|
4378 |
|
4379 |
|
4380 |
|
4381 |
|
4382 |
|
4383 | function queueWatcher (watcher) {
|
4384 | var id = watcher.id;
|
4385 | if (has[id] == null) {
|
4386 | has[id] = true;
|
4387 | if (!flushing) {
|
4388 | queue.push(watcher);
|
4389 | } else {
|
4390 |
|
4391 |
|
4392 | var i = queue.length - 1;
|
4393 | while (i > index && queue[i].id > watcher.id) {
|
4394 | i--;
|
4395 | }
|
4396 | queue.splice(i + 1, 0, watcher);
|
4397 | }
|
4398 |
|
4399 | if (!waiting) {
|
4400 | waiting = true;
|
4401 |
|
4402 | if (!config.async) {
|
4403 | flushSchedulerQueue();
|
4404 | return
|
4405 | }
|
4406 | nextTick(flushSchedulerQueue);
|
4407 | }
|
4408 | }
|
4409 | }
|
4410 |
|
4411 |
|
4412 |
|
4413 |
|
4414 |
|
4415 | var uid$2 = 0;
|
4416 |
|
4417 |
|
4418 |
|
4419 |
|
4420 |
|
4421 |
|
4422 | var Watcher = function Watcher (
|
4423 | vm,
|
4424 | expOrFn,
|
4425 | cb,
|
4426 | options,
|
4427 | isRenderWatcher
|
4428 | ) {
|
4429 | this.vm = vm;
|
4430 | if (isRenderWatcher) {
|
4431 | vm._watcher = this;
|
4432 | }
|
4433 | vm._watchers.push(this);
|
4434 |
|
4435 | if (options) {
|
4436 | this.deep = !!options.deep;
|
4437 | this.user = !!options.user;
|
4438 | this.lazy = !!options.lazy;
|
4439 | this.sync = !!options.sync;
|
4440 | this.before = options.before;
|
4441 | } else {
|
4442 | this.deep = this.user = this.lazy = this.sync = false;
|
4443 | }
|
4444 | this.cb = cb;
|
4445 | this.id = ++uid$2;
|
4446 | this.active = true;
|
4447 | this.dirty = this.lazy;
|
4448 | this.deps = [];
|
4449 | this.newDeps = [];
|
4450 | this.depIds = new _Set();
|
4451 | this.newDepIds = new _Set();
|
4452 | this.expression = expOrFn.toString();
|
4453 |
|
4454 | if (typeof expOrFn === 'function') {
|
4455 | this.getter = expOrFn;
|
4456 | } else {
|
4457 | this.getter = parsePath(expOrFn);
|
4458 | if (!this.getter) {
|
4459 | this.getter = noop;
|
4460 | warn(
|
4461 | "Failed watching path: \"" + expOrFn + "\" " +
|
4462 | 'Watcher only accepts simple dot-delimited paths. ' +
|
4463 | 'For full control, use a function instead.',
|
4464 | vm
|
4465 | );
|
4466 | }
|
4467 | }
|
4468 | this.value = this.lazy
|
4469 | ? undefined
|
4470 | : this.get();
|
4471 | };
|
4472 |
|
4473 |
|
4474 |
|
4475 |
|
4476 | Watcher.prototype.get = function get () {
|
4477 | pushTarget(this);
|
4478 | var value;
|
4479 | var vm = this.vm;
|
4480 | try {
|
4481 | value = this.getter.call(vm, vm);
|
4482 | } catch (e) {
|
4483 | if (this.user) {
|
4484 | handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
|
4485 | } else {
|
4486 | throw e
|
4487 | }
|
4488 | } finally {
|
4489 |
|
4490 |
|
4491 | if (this.deep) {
|
4492 | traverse(value);
|
4493 | }
|
4494 | popTarget();
|
4495 | this.cleanupDeps();
|
4496 | }
|
4497 | return value
|
4498 | };
|
4499 |
|
4500 |
|
4501 |
|
4502 |
|
4503 | Watcher.prototype.addDep = function addDep (dep) {
|
4504 | var id = dep.id;
|
4505 | if (!this.newDepIds.has(id)) {
|
4506 | this.newDepIds.add(id);
|
4507 | this.newDeps.push(dep);
|
4508 | if (!this.depIds.has(id)) {
|
4509 | dep.addSub(this);
|
4510 | }
|
4511 | }
|
4512 | };
|
4513 |
|
4514 |
|
4515 |
|
4516 |
|
4517 | Watcher.prototype.cleanupDeps = function cleanupDeps () {
|
4518 | var i = this.deps.length;
|
4519 | while (i--) {
|
4520 | var dep = this.deps[i];
|
4521 | if (!this.newDepIds.has(dep.id)) {
|
4522 | dep.removeSub(this);
|
4523 | }
|
4524 | }
|
4525 | var tmp = this.depIds;
|
4526 | this.depIds = this.newDepIds;
|
4527 | this.newDepIds = tmp;
|
4528 | this.newDepIds.clear();
|
4529 | tmp = this.deps;
|
4530 | this.deps = this.newDeps;
|
4531 | this.newDeps = tmp;
|
4532 | this.newDeps.length = 0;
|
4533 | };
|
4534 |
|
4535 |
|
4536 |
|
4537 |
|
4538 |
|
4539 | Watcher.prototype.update = function update () {
|
4540 |
|
4541 | if (this.lazy) {
|
4542 | this.dirty = true;
|
4543 | } else if (this.sync) {
|
4544 | this.run();
|
4545 | } else {
|
4546 | queueWatcher(this);
|
4547 | }
|
4548 | };
|
4549 |
|
4550 |
|
4551 |
|
4552 |
|
4553 |
|
4554 | Watcher.prototype.run = function run () {
|
4555 | if (this.active) {
|
4556 | var value = this.get();
|
4557 | if (
|
4558 | value !== this.value ||
|
4559 |
|
4560 |
|
4561 |
|
4562 | isObject(value) ||
|
4563 | this.deep
|
4564 | ) {
|
4565 |
|
4566 | var oldValue = this.value;
|
4567 | this.value = value;
|
4568 | if (this.user) {
|
4569 | var info = "callback for watcher \"" + (this.expression) + "\"";
|
4570 | invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
|
4571 | } else {
|
4572 | this.cb.call(this.vm, value, oldValue);
|
4573 | }
|
4574 | }
|
4575 | }
|
4576 | };
|
4577 |
|
4578 |
|
4579 |
|
4580 |
|
4581 |
|
4582 | Watcher.prototype.evaluate = function evaluate () {
|
4583 | this.value = this.get();
|
4584 | this.dirty = false;
|
4585 | };
|
4586 |
|
4587 |
|
4588 |
|
4589 |
|
4590 | Watcher.prototype.depend = function depend () {
|
4591 | var i = this.deps.length;
|
4592 | while (i--) {
|
4593 | this.deps[i].depend();
|
4594 | }
|
4595 | };
|
4596 |
|
4597 |
|
4598 |
|
4599 |
|
4600 | Watcher.prototype.teardown = function teardown () {
|
4601 | if (this.active) {
|
4602 |
|
4603 |
|
4604 |
|
4605 | if (!this.vm._isBeingDestroyed) {
|
4606 | remove(this.vm._watchers, this);
|
4607 | }
|
4608 | var i = this.deps.length;
|
4609 | while (i--) {
|
4610 | this.deps[i].removeSub(this);
|
4611 | }
|
4612 | this.active = false;
|
4613 | }
|
4614 | };
|
4615 |
|
4616 |
|
4617 |
|
4618 | var sharedPropertyDefinition = {
|
4619 | enumerable: true,
|
4620 | configurable: true,
|
4621 | get: noop,
|
4622 | set: noop
|
4623 | };
|
4624 |
|
4625 | function proxy (target, sourceKey, key) {
|
4626 | sharedPropertyDefinition.get = function proxyGetter () {
|
4627 | return this[sourceKey][key]
|
4628 | };
|
4629 | sharedPropertyDefinition.set = function proxySetter (val) {
|
4630 | this[sourceKey][key] = val;
|
4631 | };
|
4632 | Object.defineProperty(target, key, sharedPropertyDefinition);
|
4633 | }
|
4634 |
|
4635 | function initState (vm) {
|
4636 | vm._watchers = [];
|
4637 | var opts = vm.$options;
|
4638 | if (opts.props) { initProps(vm, opts.props); }
|
4639 | if (opts.methods) { initMethods(vm, opts.methods); }
|
4640 | if (opts.data) {
|
4641 | initData(vm);
|
4642 | } else {
|
4643 | observe(vm._data = {}, true );
|
4644 | }
|
4645 | if (opts.computed) { initComputed(vm, opts.computed); }
|
4646 | if (opts.watch && opts.watch !== nativeWatch) {
|
4647 | initWatch(vm, opts.watch);
|
4648 | }
|
4649 | }
|
4650 |
|
4651 | function initProps (vm, propsOptions) {
|
4652 | var propsData = vm.$options.propsData || {};
|
4653 | var props = vm._props = {};
|
4654 |
|
4655 |
|
4656 | var keys = vm.$options._propKeys = [];
|
4657 | var isRoot = !vm.$parent;
|
4658 |
|
4659 | if (!isRoot) {
|
4660 | toggleObserving(false);
|
4661 | }
|
4662 | var loop = function ( key ) {
|
4663 | keys.push(key);
|
4664 | var value = validateProp(key, propsOptions, propsData, vm);
|
4665 |
|
4666 | {
|
4667 | var hyphenatedKey = hyphenate(key);
|
4668 | if (isReservedAttribute(hyphenatedKey) ||
|
4669 | config.isReservedAttr(hyphenatedKey)) {
|
4670 | warn(
|
4671 | ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
|
4672 | vm
|
4673 | );
|
4674 | }
|
4675 | defineReactive$$1(props, key, value, function () {
|
4676 | if (!isRoot && !isUpdatingChildComponent) {
|
4677 | warn(
|
4678 | "Avoid mutating a prop directly since the value will be " +
|
4679 | "overwritten whenever the parent component re-renders. " +
|
4680 | "Instead, use a data or computed property based on the prop's " +
|
4681 | "value. Prop being mutated: \"" + key + "\"",
|
4682 | vm
|
4683 | );
|
4684 | }
|
4685 | });
|
4686 | }
|
4687 |
|
4688 |
|
4689 |
|
4690 | if (!(key in vm)) {
|
4691 | proxy(vm, "_props", key);
|
4692 | }
|
4693 | };
|
4694 |
|
4695 | for (var key in propsOptions) loop( key );
|
4696 | toggleObserving(true);
|
4697 | }
|
4698 |
|
4699 | function initData (vm) {
|
4700 | var data = vm.$options.data;
|
4701 | data = vm._data = typeof data === 'function'
|
4702 | ? getData(data, vm)
|
4703 | : data || {};
|
4704 | if (!isPlainObject(data)) {
|
4705 | data = {};
|
4706 | warn(
|
4707 | 'data functions should return an object:\n' +
|
4708 | 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
4709 | vm
|
4710 | );
|
4711 | }
|
4712 |
|
4713 | var keys = Object.keys(data);
|
4714 | var props = vm.$options.props;
|
4715 | var methods = vm.$options.methods;
|
4716 | var i = keys.length;
|
4717 | while (i--) {
|
4718 | var key = keys[i];
|
4719 | {
|
4720 | if (methods && hasOwn(methods, key)) {
|
4721 | warn(
|
4722 | ("Method \"" + key + "\" has already been defined as a data property."),
|
4723 | vm
|
4724 | );
|
4725 | }
|
4726 | }
|
4727 | if (props && hasOwn(props, key)) {
|
4728 | warn(
|
4729 | "The data property \"" + key + "\" is already declared as a prop. " +
|
4730 | "Use prop default value instead.",
|
4731 | vm
|
4732 | );
|
4733 | } else if (!isReserved(key)) {
|
4734 | proxy(vm, "_data", key);
|
4735 | }
|
4736 | }
|
4737 |
|
4738 | observe(data, true );
|
4739 | }
|
4740 |
|
4741 | function getData (data, vm) {
|
4742 |
|
4743 | pushTarget();
|
4744 | try {
|
4745 | return data.call(vm, vm)
|
4746 | } catch (e) {
|
4747 | handleError(e, vm, "data()");
|
4748 | return {}
|
4749 | } finally {
|
4750 | popTarget();
|
4751 | }
|
4752 | }
|
4753 |
|
4754 | var computedWatcherOptions = { lazy: true };
|
4755 |
|
4756 | function initComputed (vm, computed) {
|
4757 |
|
4758 | var watchers = vm._computedWatchers = Object.create(null);
|
4759 |
|
4760 | var isSSR = isServerRendering();
|
4761 |
|
4762 | for (var key in computed) {
|
4763 | var userDef = computed[key];
|
4764 | var getter = typeof userDef === 'function' ? userDef : userDef.get;
|
4765 | if (getter == null) {
|
4766 | warn(
|
4767 | ("Getter is missing for computed property \"" + key + "\"."),
|
4768 | vm
|
4769 | );
|
4770 | }
|
4771 |
|
4772 | if (!isSSR) {
|
4773 |
|
4774 | watchers[key] = new Watcher(
|
4775 | vm,
|
4776 | getter || noop,
|
4777 | noop,
|
4778 | computedWatcherOptions
|
4779 | );
|
4780 | }
|
4781 |
|
4782 |
|
4783 |
|
4784 |
|
4785 | if (!(key in vm)) {
|
4786 | defineComputed(vm, key, userDef);
|
4787 | } else {
|
4788 | if (key in vm.$data) {
|
4789 | warn(("The computed property \"" + key + "\" is already defined in data."), vm);
|
4790 | } else if (vm.$options.props && key in vm.$options.props) {
|
4791 | warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
|
4792 | } else if (vm.$options.methods && key in vm.$options.methods) {
|
4793 | warn(("The computed property \"" + key + "\" is already defined as a method."), vm);
|
4794 | }
|
4795 | }
|
4796 | }
|
4797 | }
|
4798 |
|
4799 | function defineComputed (
|
4800 | target,
|
4801 | key,
|
4802 | userDef
|
4803 | ) {
|
4804 | var shouldCache = !isServerRendering();
|
4805 | if (typeof userDef === 'function') {
|
4806 | sharedPropertyDefinition.get = shouldCache
|
4807 | ? createComputedGetter(key)
|
4808 | : createGetterInvoker(userDef);
|
4809 | sharedPropertyDefinition.set = noop;
|
4810 | } else {
|
4811 | sharedPropertyDefinition.get = userDef.get
|
4812 | ? shouldCache && userDef.cache !== false
|
4813 | ? createComputedGetter(key)
|
4814 | : createGetterInvoker(userDef.get)
|
4815 | : noop;
|
4816 | sharedPropertyDefinition.set = userDef.set || noop;
|
4817 | }
|
4818 | if (sharedPropertyDefinition.set === noop) {
|
4819 | sharedPropertyDefinition.set = function () {
|
4820 | warn(
|
4821 | ("Computed property \"" + key + "\" was assigned to but it has no setter."),
|
4822 | this
|
4823 | );
|
4824 | };
|
4825 | }
|
4826 | Object.defineProperty(target, key, sharedPropertyDefinition);
|
4827 | }
|
4828 |
|
4829 | function createComputedGetter (key) {
|
4830 | return function computedGetter () {
|
4831 | var watcher = this._computedWatchers && this._computedWatchers[key];
|
4832 | if (watcher) {
|
4833 | if (watcher.dirty) {
|
4834 | watcher.evaluate();
|
4835 | }
|
4836 | if (Dep.target) {
|
4837 | watcher.depend();
|
4838 | }
|
4839 | return watcher.value
|
4840 | }
|
4841 | }
|
4842 | }
|
4843 |
|
4844 | function createGetterInvoker(fn) {
|
4845 | return function computedGetter () {
|
4846 | return fn.call(this, this)
|
4847 | }
|
4848 | }
|
4849 |
|
4850 | function initMethods (vm, methods) {
|
4851 | var props = vm.$options.props;
|
4852 | for (var key in methods) {
|
4853 | {
|
4854 | if (typeof methods[key] !== 'function') {
|
4855 | warn(
|
4856 | "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
|
4857 | "Did you reference the function correctly?",
|
4858 | vm
|
4859 | );
|
4860 | }
|
4861 | if (props && hasOwn(props, key)) {
|
4862 | warn(
|
4863 | ("Method \"" + key + "\" has already been defined as a prop."),
|
4864 | vm
|
4865 | );
|
4866 | }
|
4867 | if ((key in vm) && isReserved(key)) {
|
4868 | warn(
|
4869 | "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
|
4870 | "Avoid defining component methods that start with _ or $."
|
4871 | );
|
4872 | }
|
4873 | }
|
4874 | vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
|
4875 | }
|
4876 | }
|
4877 |
|
4878 | function initWatch (vm, watch) {
|
4879 | for (var key in watch) {
|
4880 | var handler = watch[key];
|
4881 | if (Array.isArray(handler)) {
|
4882 | for (var i = 0; i < handler.length; i++) {
|
4883 | createWatcher(vm, key, handler[i]);
|
4884 | }
|
4885 | } else {
|
4886 | createWatcher(vm, key, handler);
|
4887 | }
|
4888 | }
|
4889 | }
|
4890 |
|
4891 | function createWatcher (
|
4892 | vm,
|
4893 | expOrFn,
|
4894 | handler,
|
4895 | options
|
4896 | ) {
|
4897 | if (isPlainObject(handler)) {
|
4898 | options = handler;
|
4899 | handler = handler.handler;
|
4900 | }
|
4901 | if (typeof handler === 'string') {
|
4902 | handler = vm[handler];
|
4903 | }
|
4904 | return vm.$watch(expOrFn, handler, options)
|
4905 | }
|
4906 |
|
4907 | function stateMixin (Vue) {
|
4908 |
|
4909 |
|
4910 |
|
4911 | var dataDef = {};
|
4912 | dataDef.get = function () { return this._data };
|
4913 | var propsDef = {};
|
4914 | propsDef.get = function () { return this._props };
|
4915 | {
|
4916 | dataDef.set = function () {
|
4917 | warn(
|
4918 | 'Avoid replacing instance root $data. ' +
|
4919 | 'Use nested data properties instead.',
|
4920 | this
|
4921 | );
|
4922 | };
|
4923 | propsDef.set = function () {
|
4924 | warn("$props is readonly.", this);
|
4925 | };
|
4926 | }
|
4927 | Object.defineProperty(Vue.prototype, '$data', dataDef);
|
4928 | Object.defineProperty(Vue.prototype, '$props', propsDef);
|
4929 |
|
4930 | Vue.prototype.$set = set;
|
4931 | Vue.prototype.$delete = del;
|
4932 |
|
4933 | Vue.prototype.$watch = function (
|
4934 | expOrFn,
|
4935 | cb,
|
4936 | options
|
4937 | ) {
|
4938 | var vm = this;
|
4939 | if (isPlainObject(cb)) {
|
4940 | return createWatcher(vm, expOrFn, cb, options)
|
4941 | }
|
4942 | options = options || {};
|
4943 | options.user = true;
|
4944 | var watcher = new Watcher(vm, expOrFn, cb, options);
|
4945 | if (options.immediate) {
|
4946 | var info = "callback for immediate watcher \"" + (watcher.expression) + "\"";
|
4947 | pushTarget();
|
4948 | invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
|
4949 | popTarget();
|
4950 | }
|
4951 | return function unwatchFn () {
|
4952 | watcher.teardown();
|
4953 | }
|
4954 | };
|
4955 | }
|
4956 |
|
4957 |
|
4958 |
|
4959 | var uid$3 = 0;
|
4960 |
|
4961 | function initMixin (Vue) {
|
4962 | Vue.prototype._init = function (options) {
|
4963 | var vm = this;
|
4964 |
|
4965 | vm._uid = uid$3++;
|
4966 |
|
4967 | var startTag, endTag;
|
4968 |
|
4969 | if (config.performance && mark) {
|
4970 | startTag = "vue-perf-start:" + (vm._uid);
|
4971 | endTag = "vue-perf-end:" + (vm._uid);
|
4972 | mark(startTag);
|
4973 | }
|
4974 |
|
4975 |
|
4976 | vm._isVue = true;
|
4977 |
|
4978 | if (options && options._isComponent) {
|
4979 |
|
4980 |
|
4981 |
|
4982 | initInternalComponent(vm, options);
|
4983 | } else {
|
4984 | vm.$options = mergeOptions(
|
4985 | resolveConstructorOptions(vm.constructor),
|
4986 | options || {},
|
4987 | vm
|
4988 | );
|
4989 | }
|
4990 |
|
4991 | {
|
4992 | initProxy(vm);
|
4993 | }
|
4994 |
|
4995 | vm._self = vm;
|
4996 | initLifecycle(vm);
|
4997 | initEvents(vm);
|
4998 | initRender(vm);
|
4999 | callHook(vm, 'beforeCreate');
|
5000 | initInjections(vm);
|
5001 | initState(vm);
|
5002 | initProvide(vm);
|
5003 | callHook(vm, 'created');
|
5004 |
|
5005 |
|
5006 | if (config.performance && mark) {
|
5007 | vm._name = formatComponentName(vm, false);
|
5008 | mark(endTag);
|
5009 | measure(("vue " + (vm._name) + " init"), startTag, endTag);
|
5010 | }
|
5011 |
|
5012 | if (vm.$options.el) {
|
5013 | vm.$mount(vm.$options.el);
|
5014 | }
|
5015 | };
|
5016 | }
|
5017 |
|
5018 | function initInternalComponent (vm, options) {
|
5019 | var opts = vm.$options = Object.create(vm.constructor.options);
|
5020 |
|
5021 | var parentVnode = options._parentVnode;
|
5022 | opts.parent = options.parent;
|
5023 | opts._parentVnode = parentVnode;
|
5024 |
|
5025 | var vnodeComponentOptions = parentVnode.componentOptions;
|
5026 | opts.propsData = vnodeComponentOptions.propsData;
|
5027 | opts._parentListeners = vnodeComponentOptions.listeners;
|
5028 | opts._renderChildren = vnodeComponentOptions.children;
|
5029 | opts._componentTag = vnodeComponentOptions.tag;
|
5030 |
|
5031 | if (options.render) {
|
5032 | opts.render = options.render;
|
5033 | opts.staticRenderFns = options.staticRenderFns;
|
5034 | }
|
5035 | }
|
5036 |
|
5037 | function resolveConstructorOptions (Ctor) {
|
5038 | var options = Ctor.options;
|
5039 | if (Ctor.super) {
|
5040 | var superOptions = resolveConstructorOptions(Ctor.super);
|
5041 | var cachedSuperOptions = Ctor.superOptions;
|
5042 | if (superOptions !== cachedSuperOptions) {
|
5043 |
|
5044 |
|
5045 | Ctor.superOptions = superOptions;
|
5046 |
|
5047 | var modifiedOptions = resolveModifiedOptions(Ctor);
|
5048 |
|
5049 | if (modifiedOptions) {
|
5050 | extend(Ctor.extendOptions, modifiedOptions);
|
5051 | }
|
5052 | options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
|
5053 | if (options.name) {
|
5054 | options.components[options.name] = Ctor;
|
5055 | }
|
5056 | }
|
5057 | }
|
5058 | return options
|
5059 | }
|
5060 |
|
5061 | function resolveModifiedOptions (Ctor) {
|
5062 | var modified;
|
5063 | var latest = Ctor.options;
|
5064 | var sealed = Ctor.sealedOptions;
|
5065 | for (var key in latest) {
|
5066 | if (latest[key] !== sealed[key]) {
|
5067 | if (!modified) { modified = {}; }
|
5068 | modified[key] = latest[key];
|
5069 | }
|
5070 | }
|
5071 | return modified
|
5072 | }
|
5073 |
|
5074 | function Vue (options) {
|
5075 | if (!(this instanceof Vue)
|
5076 | ) {
|
5077 | warn('Vue is a constructor and should be called with the `new` keyword');
|
5078 | }
|
5079 | this._init(options);
|
5080 | }
|
5081 |
|
5082 | initMixin(Vue);
|
5083 | stateMixin(Vue);
|
5084 | eventsMixin(Vue);
|
5085 | lifecycleMixin(Vue);
|
5086 | renderMixin(Vue);
|
5087 |
|
5088 |
|
5089 |
|
5090 | function initUse (Vue) {
|
5091 | Vue.use = function (plugin) {
|
5092 | var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
|
5093 | if (installedPlugins.indexOf(plugin) > -1) {
|
5094 | return this
|
5095 | }
|
5096 |
|
5097 |
|
5098 | var args = toArray(arguments, 1);
|
5099 | args.unshift(this);
|
5100 | if (typeof plugin.install === 'function') {
|
5101 | plugin.install.apply(plugin, args);
|
5102 | } else if (typeof plugin === 'function') {
|
5103 | plugin.apply(null, args);
|
5104 | }
|
5105 | installedPlugins.push(plugin);
|
5106 | return this
|
5107 | };
|
5108 | }
|
5109 |
|
5110 |
|
5111 |
|
5112 | function initMixin$1 (Vue) {
|
5113 | Vue.mixin = function (mixin) {
|
5114 | this.options = mergeOptions(this.options, mixin);
|
5115 | return this
|
5116 | };
|
5117 | }
|
5118 |
|
5119 |
|
5120 |
|
5121 | function initExtend (Vue) {
|
5122 | |
5123 |
|
5124 |
|
5125 |
|
5126 |
|
5127 | Vue.cid = 0;
|
5128 | var cid = 1;
|
5129 |
|
5130 | |
5131 |
|
5132 |
|
5133 | Vue.extend = function (extendOptions) {
|
5134 | extendOptions = extendOptions || {};
|
5135 | var Super = this;
|
5136 | var SuperId = Super.cid;
|
5137 | var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
|
5138 | if (cachedCtors[SuperId]) {
|
5139 | return cachedCtors[SuperId]
|
5140 | }
|
5141 |
|
5142 | var name = extendOptions.name || Super.options.name;
|
5143 | if (name) {
|
5144 | validateComponentName(name);
|
5145 | }
|
5146 |
|
5147 | var Sub = function VueComponent (options) {
|
5148 | this._init(options);
|
5149 | };
|
5150 | Sub.prototype = Object.create(Super.prototype);
|
5151 | Sub.prototype.constructor = Sub;
|
5152 | Sub.cid = cid++;
|
5153 | Sub.options = mergeOptions(
|
5154 | Super.options,
|
5155 | extendOptions
|
5156 | );
|
5157 | Sub['super'] = Super;
|
5158 |
|
5159 |
|
5160 |
|
5161 |
|
5162 | if (Sub.options.props) {
|
5163 | initProps$1(Sub);
|
5164 | }
|
5165 | if (Sub.options.computed) {
|
5166 | initComputed$1(Sub);
|
5167 | }
|
5168 |
|
5169 |
|
5170 | Sub.extend = Super.extend;
|
5171 | Sub.mixin = Super.mixin;
|
5172 | Sub.use = Super.use;
|
5173 |
|
5174 |
|
5175 |
|
5176 | ASSET_TYPES.forEach(function (type) {
|
5177 | Sub[type] = Super[type];
|
5178 | });
|
5179 |
|
5180 | if (name) {
|
5181 | Sub.options.components[name] = Sub;
|
5182 | }
|
5183 |
|
5184 |
|
5185 |
|
5186 |
|
5187 | Sub.superOptions = Super.options;
|
5188 | Sub.extendOptions = extendOptions;
|
5189 | Sub.sealedOptions = extend({}, Sub.options);
|
5190 |
|
5191 |
|
5192 | cachedCtors[SuperId] = Sub;
|
5193 | return Sub
|
5194 | };
|
5195 | }
|
5196 |
|
5197 | function initProps$1 (Comp) {
|
5198 | var props = Comp.options.props;
|
5199 | for (var key in props) {
|
5200 | proxy(Comp.prototype, "_props", key);
|
5201 | }
|
5202 | }
|
5203 |
|
5204 | function initComputed$1 (Comp) {
|
5205 | var computed = Comp.options.computed;
|
5206 | for (var key in computed) {
|
5207 | defineComputed(Comp.prototype, key, computed[key]);
|
5208 | }
|
5209 | }
|
5210 |
|
5211 |
|
5212 |
|
5213 | function initAssetRegisters (Vue) {
|
5214 | |
5215 |
|
5216 |
|
5217 | ASSET_TYPES.forEach(function (type) {
|
5218 | Vue[type] = function (
|
5219 | id,
|
5220 | definition
|
5221 | ) {
|
5222 | if (!definition) {
|
5223 | return this.options[type + 's'][id]
|
5224 | } else {
|
5225 |
|
5226 | if (type === 'component') {
|
5227 | validateComponentName(id);
|
5228 | }
|
5229 | if (type === 'component' && isPlainObject(definition)) {
|
5230 | definition.name = definition.name || id;
|
5231 | definition = this.options._base.extend(definition);
|
5232 | }
|
5233 | if (type === 'directive' && typeof definition === 'function') {
|
5234 | definition = { bind: definition, update: definition };
|
5235 | }
|
5236 | this.options[type + 's'][id] = definition;
|
5237 | return definition
|
5238 | }
|
5239 | };
|
5240 | });
|
5241 | }
|
5242 |
|
5243 |
|
5244 |
|
5245 |
|
5246 |
|
5247 |
|
5248 |
|
5249 | function getComponentName (opts) {
|
5250 | return opts && (opts.Ctor.options.name || opts.tag)
|
5251 | }
|
5252 |
|
5253 | function matches (pattern, name) {
|
5254 | if (Array.isArray(pattern)) {
|
5255 | return pattern.indexOf(name) > -1
|
5256 | } else if (typeof pattern === 'string') {
|
5257 | return pattern.split(',').indexOf(name) > -1
|
5258 | } else if (isRegExp(pattern)) {
|
5259 | return pattern.test(name)
|
5260 | }
|
5261 |
|
5262 | return false
|
5263 | }
|
5264 |
|
5265 | function pruneCache (keepAliveInstance, filter) {
|
5266 | var cache = keepAliveInstance.cache;
|
5267 | var keys = keepAliveInstance.keys;
|
5268 | var _vnode = keepAliveInstance._vnode;
|
5269 | for (var key in cache) {
|
5270 | var entry = cache[key];
|
5271 | if (entry) {
|
5272 | var name = entry.name;
|
5273 | if (name && !filter(name)) {
|
5274 | pruneCacheEntry(cache, key, keys, _vnode);
|
5275 | }
|
5276 | }
|
5277 | }
|
5278 | }
|
5279 |
|
5280 | function pruneCacheEntry (
|
5281 | cache,
|
5282 | key,
|
5283 | keys,
|
5284 | current
|
5285 | ) {
|
5286 | var entry = cache[key];
|
5287 | if (entry && (!current || entry.tag !== current.tag)) {
|
5288 | entry.componentInstance.$destroy();
|
5289 | }
|
5290 | cache[key] = null;
|
5291 | remove(keys, key);
|
5292 | }
|
5293 |
|
5294 | var patternTypes = [String, RegExp, Array];
|
5295 |
|
5296 | var KeepAlive = {
|
5297 | name: 'keep-alive',
|
5298 | abstract: true,
|
5299 |
|
5300 | props: {
|
5301 | include: patternTypes,
|
5302 | exclude: patternTypes,
|
5303 | max: [String, Number]
|
5304 | },
|
5305 |
|
5306 | methods: {
|
5307 | cacheVNode: function cacheVNode() {
|
5308 | var ref = this;
|
5309 | var cache = ref.cache;
|
5310 | var keys = ref.keys;
|
5311 | var vnodeToCache = ref.vnodeToCache;
|
5312 | var keyToCache = ref.keyToCache;
|
5313 | if (vnodeToCache) {
|
5314 | var tag = vnodeToCache.tag;
|
5315 | var componentInstance = vnodeToCache.componentInstance;
|
5316 | var componentOptions = vnodeToCache.componentOptions;
|
5317 | cache[keyToCache] = {
|
5318 | name: getComponentName(componentOptions),
|
5319 | tag: tag,
|
5320 | componentInstance: componentInstance,
|
5321 | };
|
5322 | keys.push(keyToCache);
|
5323 |
|
5324 | if (this.max && keys.length > parseInt(this.max)) {
|
5325 | pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
5326 | }
|
5327 | this.vnodeToCache = null;
|
5328 | }
|
5329 | }
|
5330 | },
|
5331 |
|
5332 | created: function created () {
|
5333 | this.cache = Object.create(null);
|
5334 | this.keys = [];
|
5335 | },
|
5336 |
|
5337 | destroyed: function destroyed () {
|
5338 | for (var key in this.cache) {
|
5339 | pruneCacheEntry(this.cache, key, this.keys);
|
5340 | }
|
5341 | },
|
5342 |
|
5343 | mounted: function mounted () {
|
5344 | var this$1 = this;
|
5345 |
|
5346 | this.cacheVNode();
|
5347 | this.$watch('include', function (val) {
|
5348 | pruneCache(this$1, function (name) { return matches(val, name); });
|
5349 | });
|
5350 | this.$watch('exclude', function (val) {
|
5351 | pruneCache(this$1, function (name) { return !matches(val, name); });
|
5352 | });
|
5353 | },
|
5354 |
|
5355 | updated: function updated () {
|
5356 | this.cacheVNode();
|
5357 | },
|
5358 |
|
5359 | render: function render () {
|
5360 | var slot = this.$slots.default;
|
5361 | var vnode = getFirstComponentChild(slot);
|
5362 | var componentOptions = vnode && vnode.componentOptions;
|
5363 | if (componentOptions) {
|
5364 |
|
5365 | var name = getComponentName(componentOptions);
|
5366 | var ref = this;
|
5367 | var include = ref.include;
|
5368 | var exclude = ref.exclude;
|
5369 | if (
|
5370 |
|
5371 | (include && (!name || !matches(include, name))) ||
|
5372 |
|
5373 | (exclude && name && matches(exclude, name))
|
5374 | ) {
|
5375 | return vnode
|
5376 | }
|
5377 |
|
5378 | var ref$1 = this;
|
5379 | var cache = ref$1.cache;
|
5380 | var keys = ref$1.keys;
|
5381 | var key = vnode.key == null
|
5382 |
|
5383 |
|
5384 | ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
|
5385 | : vnode.key;
|
5386 | if (cache[key]) {
|
5387 | vnode.componentInstance = cache[key].componentInstance;
|
5388 |
|
5389 | remove(keys, key);
|
5390 | keys.push(key);
|
5391 | } else {
|
5392 |
|
5393 | this.vnodeToCache = vnode;
|
5394 | this.keyToCache = key;
|
5395 | }
|
5396 |
|
5397 | vnode.data.keepAlive = true;
|
5398 | }
|
5399 | return vnode || (slot && slot[0])
|
5400 | }
|
5401 | };
|
5402 |
|
5403 | var builtInComponents = {
|
5404 | KeepAlive: KeepAlive
|
5405 | };
|
5406 |
|
5407 |
|
5408 |
|
5409 | function initGlobalAPI (Vue) {
|
5410 |
|
5411 | var configDef = {};
|
5412 | configDef.get = function () { return config; };
|
5413 | {
|
5414 | configDef.set = function () {
|
5415 | warn(
|
5416 | 'Do not replace the Vue.config object, set individual fields instead.'
|
5417 | );
|
5418 | };
|
5419 | }
|
5420 | Object.defineProperty(Vue, 'config', configDef);
|
5421 |
|
5422 |
|
5423 |
|
5424 |
|
5425 | Vue.util = {
|
5426 | warn: warn,
|
5427 | extend: extend,
|
5428 | mergeOptions: mergeOptions,
|
5429 | defineReactive: defineReactive$$1
|
5430 | };
|
5431 |
|
5432 | Vue.set = set;
|
5433 | Vue.delete = del;
|
5434 | Vue.nextTick = nextTick;
|
5435 |
|
5436 | // 2.6 explicit observable API
|
5437 | Vue.observable = function (obj) {
|
5438 | observe(obj);
|
5439 | return obj
|
5440 | };
|
5441 |
|
5442 | Vue.options = Object.create(null);
|
5443 | ASSET_TYPES.forEach(function (type) {
|
5444 | Vue.options[type + 's'] = Object.create(null);
|
5445 | });
|
5446 |
|
5447 |
|
5448 |
|
5449 | Vue.options._base = Vue;
|
5450 |
|
5451 | extend(Vue.options.components, builtInComponents);
|
5452 |
|
5453 | initUse(Vue);
|
5454 | initMixin$1(Vue);
|
5455 | initExtend(Vue);
|
5456 | initAssetRegisters(Vue);
|
5457 | }
|
5458 |
|
5459 | initGlobalAPI(Vue);
|
5460 |
|
5461 | Object.defineProperty(Vue.prototype, '$isServer', {
|
5462 | get: isServerRendering
|
5463 | });
|
5464 |
|
5465 | Object.defineProperty(Vue.prototype, '$ssrContext', {
|
5466 | get: function get () {
|
5467 |
|
5468 | return this.$vnode && this.$vnode.ssrContext
|
5469 | }
|
5470 | });
|
5471 |
|
5472 |
|
5473 | Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
5474 | value: FunctionalRenderContext
|
5475 | });
|
5476 |
|
5477 | Vue.version = '2.6.14';
|
5478 |
|
5479 |
|
5480 |
|
5481 |
|
5482 |
|
5483 | var isReservedAttr = makeMap('style,class');
|
5484 |
|
5485 |
|
5486 | var acceptValue = makeMap('input,textarea,option,select,progress');
|
5487 | var mustUseProp = function (tag, type, attr) {
|
5488 | return (
|
5489 | (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
|
5490 | (attr === 'selected' && tag === 'option') ||
|
5491 | (attr === 'checked' && tag === 'input') ||
|
5492 | (attr === 'muted' && tag === 'video')
|
5493 | )
|
5494 | };
|
5495 |
|
5496 | var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
|
5497 |
|
5498 | var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
|
5499 |
|
5500 | var convertEnumeratedValue = function (key, value) {
|
5501 | return isFalsyAttrValue(value) || value === 'false'
|
5502 | ? 'false'
|
5503 |
|
5504 | : key === 'contenteditable' && isValidContentEditableValue(value)
|
5505 | ? value
|
5506 | : 'true'
|
5507 | };
|
5508 |
|
5509 | var isBooleanAttr = makeMap(
|
5510 | 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
|
5511 | 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
5512 | 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
5513 | 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
5514 | 'required,reversed,scoped,seamless,selected,sortable,' +
|
5515 | 'truespeed,typemustmatch,visible'
|
5516 | );
|
5517 |
|
5518 | var xlinkNS = 'http://www.w3.org/1999/xlink';
|
5519 |
|
5520 | var isXlink = function (name) {
|
5521 | return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
|
5522 | };
|
5523 |
|
5524 | var getXlinkProp = function (name) {
|
5525 | return isXlink(name) ? name.slice(6, name.length) : ''
|
5526 | };
|
5527 |
|
5528 | var isFalsyAttrValue = function (val) {
|
5529 | return val == null || val === false
|
5530 | };
|
5531 |
|
5532 |
|
5533 |
|
5534 | function genClassForVnode (vnode) {
|
5535 | var data = vnode.data;
|
5536 | var parentNode = vnode;
|
5537 | var childNode = vnode;
|
5538 | while (isDef(childNode.componentInstance)) {
|
5539 | childNode = childNode.componentInstance._vnode;
|
5540 | if (childNode && childNode.data) {
|
5541 | data = mergeClassData(childNode.data, data);
|
5542 | }
|
5543 | }
|
5544 | while (isDef(parentNode = parentNode.parent)) {
|
5545 | if (parentNode && parentNode.data) {
|
5546 | data = mergeClassData(data, parentNode.data);
|
5547 | }
|
5548 | }
|
5549 | return renderClass(data.staticClass, data.class)
|
5550 | }
|
5551 |
|
5552 | function mergeClassData (child, parent) {
|
5553 | return {
|
5554 | staticClass: concat(child.staticClass, parent.staticClass),
|
5555 | class: isDef(child.class)
|
5556 | ? [child.class, parent.class]
|
5557 | : parent.class
|
5558 | }
|
5559 | }
|
5560 |
|
5561 | function renderClass (
|
5562 | staticClass,
|
5563 | dynamicClass
|
5564 | ) {
|
5565 | if (isDef(staticClass) || isDef(dynamicClass)) {
|
5566 | return concat(staticClass, stringifyClass(dynamicClass))
|
5567 | }
|
5568 |
|
5569 | return ''
|
5570 | }
|
5571 |
|
5572 | function concat (a, b) {
|
5573 | return a ? b ? (a + ' ' + b) : a : (b || '')
|
5574 | }
|
5575 |
|
5576 | function stringifyClass (value) {
|
5577 | if (Array.isArray(value)) {
|
5578 | return stringifyArray(value)
|
5579 | }
|
5580 | if (isObject(value)) {
|
5581 | return stringifyObject(value)
|
5582 | }
|
5583 | if (typeof value === 'string') {
|
5584 | return value
|
5585 | }
|
5586 |
|
5587 | return ''
|
5588 | }
|
5589 |
|
5590 | function stringifyArray (value) {
|
5591 | var res = '';
|
5592 | var stringified;
|
5593 | for (var i = 0, l = value.length; i < l; i++) {
|
5594 | if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
|
5595 | if (res) { res += ' '; }
|
5596 | res += stringified;
|
5597 | }
|
5598 | }
|
5599 | return res
|
5600 | }
|
5601 |
|
5602 | function stringifyObject (value) {
|
5603 | var res = '';
|
5604 | for (var key in value) {
|
5605 | if (value[key]) {
|
5606 | if (res) { res += ' '; }
|
5607 | res += key;
|
5608 | }
|
5609 | }
|
5610 | return res
|
5611 | }
|
5612 |
|
5613 |
|
5614 |
|
5615 | var namespaceMap = {
|
5616 | svg: 'http://www.w3.org/2000/svg',
|
5617 | math: 'http://www.w3.org/1998/Math/MathML'
|
5618 | };
|
5619 |
|
5620 | var isHTMLTag = makeMap(
|
5621 | 'html,body,base,head,link,meta,style,title,' +
|
5622 | 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
|
5623 | 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
|
5624 | 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
|
5625 | 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
|
5626 | 'embed,object,param,source,canvas,script,noscript,del,ins,' +
|
5627 | 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
|
5628 | 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
|
5629 | 'output,progress,select,textarea,' +
|
5630 | 'details,dialog,menu,menuitem,summary,' +
|
5631 | 'content,element,shadow,template,blockquote,iframe,tfoot'
|
5632 | );
|
5633 |
|
5634 |
|
5635 |
|
5636 | var isSVG = makeMap(
|
5637 | 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
5638 | 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
5639 | 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
5640 | true
|
5641 | );
|
5642 |
|
5643 | var isReservedTag = function (tag) {
|
5644 | return isHTMLTag(tag) || isSVG(tag)
|
5645 | };
|
5646 |
|
5647 | function getTagNamespace (tag) {
|
5648 | if (isSVG(tag)) {
|
5649 | return 'svg'
|
5650 | }
|
5651 |
|
5652 |
|
5653 | if (tag === 'math') {
|
5654 | return 'math'
|
5655 | }
|
5656 | }
|
5657 |
|
5658 | var unknownElementCache = Object.create(null);
|
5659 | function isUnknownElement (tag) {
|
5660 |
|
5661 | if (!inBrowser) {
|
5662 | return true
|
5663 | }
|
5664 | if (isReservedTag(tag)) {
|
5665 | return false
|
5666 | }
|
5667 | tag = tag.toLowerCase();
|
5668 |
|
5669 | if (unknownElementCache[tag] != null) {
|
5670 | return unknownElementCache[tag]
|
5671 | }
|
5672 | var el = document.createElement(tag);
|
5673 | if (tag.indexOf('-') > -1) {
|
5674 |
|
5675 | return (unknownElementCache[tag] = (
|
5676 | el.constructor === window.HTMLUnknownElement ||
|
5677 | el.constructor === window.HTMLElement
|
5678 | ))
|
5679 | } else {
|
5680 | return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
|
5681 | }
|
5682 | }
|
5683 |
|
5684 | var isTextInputType = makeMap('text,number,password,search,email,tel,url');
|
5685 |
|
5686 |
|
5687 |
|
5688 |
|
5689 |
|
5690 |
|
5691 | function query (el) {
|
5692 | if (typeof el === 'string') {
|
5693 | var selected = document.querySelector(el);
|
5694 | if (!selected) {
|
5695 | warn(
|
5696 | 'Cannot find element: ' + el
|
5697 | );
|
5698 | return document.createElement('div')
|
5699 | }
|
5700 | return selected
|
5701 | } else {
|
5702 | return el
|
5703 | }
|
5704 | }
|
5705 |
|
5706 |
|
5707 |
|
5708 | function createElement$1 (tagName, vnode) {
|
5709 | var elm = document.createElement(tagName);
|
5710 | if (tagName !== 'select') {
|
5711 | return elm
|
5712 | }
|
5713 |
|
5714 | if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
|
5715 | elm.setAttribute('multiple', 'multiple');
|
5716 | }
|
5717 | return elm
|
5718 | }
|
5719 |
|
5720 | function createElementNS (namespace, tagName) {
|
5721 | return document.createElementNS(namespaceMap[namespace], tagName)
|
5722 | }
|
5723 |
|
5724 | function createTextNode (text) {
|
5725 | return document.createTextNode(text)
|
5726 | }
|
5727 |
|
5728 | function createComment (text) {
|
5729 | return document.createComment(text)
|
5730 | }
|
5731 |
|
5732 | function insertBefore (parentNode, newNode, referenceNode) {
|
5733 | parentNode.insertBefore(newNode, referenceNode);
|
5734 | }
|
5735 |
|
5736 | function removeChild (node, child) {
|
5737 | node.removeChild(child);
|
5738 | }
|
5739 |
|
5740 | function appendChild (node, child) {
|
5741 | node.appendChild(child);
|
5742 | }
|
5743 |
|
5744 | function parentNode (node) {
|
5745 | return node.parentNode
|
5746 | }
|
5747 |
|
5748 | function nextSibling (node) {
|
5749 | return node.nextSibling
|
5750 | }
|
5751 |
|
5752 | function tagName (node) {
|
5753 | return node.tagName
|
5754 | }
|
5755 |
|
5756 | function setTextContent (node, text) {
|
5757 | node.textContent = text;
|
5758 | }
|
5759 |
|
5760 | function setStyleScope (node, scopeId) {
|
5761 | node.setAttribute(scopeId, '');
|
5762 | }
|
5763 |
|
5764 | var nodeOps = Object.freeze({
|
5765 | createElement: createElement$1,
|
5766 | createElementNS: createElementNS,
|
5767 | createTextNode: createTextNode,
|
5768 | createComment: createComment,
|
5769 | insertBefore: insertBefore,
|
5770 | removeChild: removeChild,
|
5771 | appendChild: appendChild,
|
5772 | parentNode: parentNode,
|
5773 | nextSibling: nextSibling,
|
5774 | tagName: tagName,
|
5775 | setTextContent: setTextContent,
|
5776 | setStyleScope: setStyleScope
|
5777 | });
|
5778 |
|
5779 |
|
5780 |
|
5781 | var ref = {
|
5782 | create: function create (_, vnode) {
|
5783 | registerRef(vnode);
|
5784 | },
|
5785 | update: function update (oldVnode, vnode) {
|
5786 | if (oldVnode.data.ref !== vnode.data.ref) {
|
5787 | registerRef(oldVnode, true);
|
5788 | registerRef(vnode);
|
5789 | }
|
5790 | },
|
5791 | destroy: function destroy (vnode) {
|
5792 | registerRef(vnode, true);
|
5793 | }
|
5794 | };
|
5795 |
|
5796 | function registerRef (vnode, isRemoval) {
|
5797 | var key = vnode.data.ref;
|
5798 | if (!isDef(key)) { return }
|
5799 |
|
5800 | var vm = vnode.context;
|
5801 | var ref = vnode.componentInstance || vnode.elm;
|
5802 | var refs = vm.$refs;
|
5803 | if (isRemoval) {
|
5804 | if (Array.isArray(refs[key])) {
|
5805 | remove(refs[key], ref);
|
5806 | } else if (refs[key] === ref) {
|
5807 | refs[key] = undefined;
|
5808 | }
|
5809 | } else {
|
5810 | if (vnode.data.refInFor) {
|
5811 | if (!Array.isArray(refs[key])) {
|
5812 | refs[key] = [ref];
|
5813 | } else if (refs[key].indexOf(ref) < 0) {
|
5814 |
|
5815 | refs[key].push(ref);
|
5816 | }
|
5817 | } else {
|
5818 | refs[key] = ref;
|
5819 | }
|
5820 | }
|
5821 | }
|
5822 |
|
5823 |
|
5824 |
|
5825 |
|
5826 |
|
5827 |
|
5828 |
|
5829 |
|
5830 |
|
5831 |
|
5832 |
|
5833 |
|
5834 |
|
5835 | var emptyNode = new VNode('', {}, []);
|
5836 |
|
5837 | var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
5838 |
|
5839 | function sameVnode (a, b) {
|
5840 | return (
|
5841 | a.key === b.key &&
|
5842 | a.asyncFactory === b.asyncFactory && (
|
5843 | (
|
5844 | a.tag === b.tag &&
|
5845 | a.isComment === b.isComment &&
|
5846 | isDef(a.data) === isDef(b.data) &&
|
5847 | sameInputType(a, b)
|
5848 | ) || (
|
5849 | isTrue(a.isAsyncPlaceholder) &&
|
5850 | isUndef(b.asyncFactory.error)
|
5851 | )
|
5852 | )
|
5853 | )
|
5854 | }
|
5855 |
|
5856 | function sameInputType (a, b) {
|
5857 | if (a.tag !== 'input') { return true }
|
5858 | var i;
|
5859 | var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
|
5860 | var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
|
5861 | return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
|
5862 | }
|
5863 |
|
5864 | function createKeyToOldIdx (children, beginIdx, endIdx) {
|
5865 | var i, key;
|
5866 | var map = {};
|
5867 | for (i = beginIdx; i <= endIdx; ++i) {
|
5868 | key = children[i].key;
|
5869 | if (isDef(key)) { map[key] = i; }
|
5870 | }
|
5871 | return map
|
5872 | }
|
5873 |
|
5874 | function createPatchFunction (backend) {
|
5875 | var i, j;
|
5876 | var cbs = {};
|
5877 |
|
5878 | var modules = backend.modules;
|
5879 | var nodeOps = backend.nodeOps;
|
5880 |
|
5881 | for (i = 0; i < hooks.length; ++i) {
|
5882 | cbs[hooks[i]] = [];
|
5883 | for (j = 0; j < modules.length; ++j) {
|
5884 | if (isDef(modules[j][hooks[i]])) {
|
5885 | cbs[hooks[i]].push(modules[j][hooks[i]]);
|
5886 | }
|
5887 | }
|
5888 | }
|
5889 |
|
5890 | function emptyNodeAt (elm) {
|
5891 | return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
|
5892 | }
|
5893 |
|
5894 | function createRmCb (childElm, listeners) {
|
5895 | function remove$$1 () {
|
5896 | if (--remove$$1.listeners === 0) {
|
5897 | removeNode(childElm);
|
5898 | }
|
5899 | }
|
5900 | remove$$1.listeners = listeners;
|
5901 | return remove$$1
|
5902 | }
|
5903 |
|
5904 | function removeNode (el) {
|
5905 | var parent = nodeOps.parentNode(el);
|
5906 |
|
5907 | if (isDef(parent)) {
|
5908 | nodeOps.removeChild(parent, el);
|
5909 | }
|
5910 | }
|
5911 |
|
5912 | function isUnknownElement$$1 (vnode, inVPre) {
|
5913 | return (
|
5914 | !inVPre &&
|
5915 | !vnode.ns &&
|
5916 | !(
|
5917 | config.ignoredElements.length &&
|
5918 | config.ignoredElements.some(function (ignore) {
|
5919 | return isRegExp(ignore)
|
5920 | ? ignore.test(vnode.tag)
|
5921 | : ignore === vnode.tag
|
5922 | })
|
5923 | ) &&
|
5924 | config.isUnknownElement(vnode.tag)
|
5925 | )
|
5926 | }
|
5927 |
|
5928 | var creatingElmInVPre = 0;
|
5929 |
|
5930 | function createElm (
|
5931 | vnode,
|
5932 | insertedVnodeQueue,
|
5933 | parentElm,
|
5934 | refElm,
|
5935 | nested,
|
5936 | ownerArray,
|
5937 | index
|
5938 | ) {
|
5939 | if (isDef(vnode.elm) && isDef(ownerArray)) {
|
5940 |
|
5941 |
|
5942 |
|
5943 |
|
5944 |
|
5945 | vnode = ownerArray[index] = cloneVNode(vnode);
|
5946 | }
|
5947 |
|
5948 | vnode.isRootInsert = !nested;
|
5949 | if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
|
5950 | return
|
5951 | }
|
5952 |
|
5953 | var data = vnode.data;
|
5954 | var children = vnode.children;
|
5955 | var tag = vnode.tag;
|
5956 | if (isDef(tag)) {
|
5957 | {
|
5958 | if (data && data.pre) {
|
5959 | creatingElmInVPre++;
|
5960 | }
|
5961 | if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
|
5962 | warn(
|
5963 | 'Unknown custom element: <' + tag + '> - did you ' +
|
5964 | 'register the component correctly? For recursive components, ' +
|
5965 | 'make sure to provide the "name" option.',
|
5966 | vnode.context
|
5967 | );
|
5968 | }
|
5969 | }
|
5970 |
|
5971 | vnode.elm = vnode.ns
|
5972 | ? nodeOps.createElementNS(vnode.ns, tag)
|
5973 | : nodeOps.createElement(tag, vnode);
|
5974 | setScope(vnode);
|
5975 |
|
5976 |
|
5977 | {
|
5978 | createChildren(vnode, children, insertedVnodeQueue);
|
5979 | if (isDef(data)) {
|
5980 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
5981 | }
|
5982 | insert(parentElm, vnode.elm, refElm);
|
5983 | }
|
5984 |
|
5985 | if (data && data.pre) {
|
5986 | creatingElmInVPre--;
|
5987 | }
|
5988 | } else if (isTrue(vnode.isComment)) {
|
5989 | vnode.elm = nodeOps.createComment(vnode.text);
|
5990 | insert(parentElm, vnode.elm, refElm);
|
5991 | } else {
|
5992 | vnode.elm = nodeOps.createTextNode(vnode.text);
|
5993 | insert(parentElm, vnode.elm, refElm);
|
5994 | }
|
5995 | }
|
5996 |
|
5997 | function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
5998 | var i = vnode.data;
|
5999 | if (isDef(i)) {
|
6000 | var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
|
6001 | if (isDef(i = i.hook) && isDef(i = i.init)) {
|
6002 | i(vnode, false );
|
6003 | }
|
6004 |
|
6005 |
|
6006 |
|
6007 |
|
6008 | if (isDef(vnode.componentInstance)) {
|
6009 | initComponent(vnode, insertedVnodeQueue);
|
6010 | insert(parentElm, vnode.elm, refElm);
|
6011 | if (isTrue(isReactivated)) {
|
6012 | reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
|
6013 | }
|
6014 | return true
|
6015 | }
|
6016 | }
|
6017 | }
|
6018 |
|
6019 | function initComponent (vnode, insertedVnodeQueue) {
|
6020 | if (isDef(vnode.data.pendingInsert)) {
|
6021 | insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
|
6022 | vnode.data.pendingInsert = null;
|
6023 | }
|
6024 | vnode.elm = vnode.componentInstance.$el;
|
6025 | if (isPatchable(vnode)) {
|
6026 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
6027 | setScope(vnode);
|
6028 | } else {
|
6029 |
|
6030 |
|
6031 | registerRef(vnode);
|
6032 |
|
6033 | insertedVnodeQueue.push(vnode);
|
6034 | }
|
6035 | }
|
6036 |
|
6037 | function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
6038 | var i;
|
6039 |
|
6040 |
|
6041 |
|
6042 |
|
6043 | var innerNode = vnode;
|
6044 | while (innerNode.componentInstance) {
|
6045 | innerNode = innerNode.componentInstance._vnode;
|
6046 | if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
|
6047 | for (i = 0; i < cbs.activate.length; ++i) {
|
6048 | cbs.activate[i](emptyNode, innerNode);
|
6049 | }
|
6050 | insertedVnodeQueue.push(innerNode);
|
6051 | break
|
6052 | }
|
6053 | }
|
6054 |
|
6055 |
|
6056 | insert(parentElm, vnode.elm, refElm);
|
6057 | }
|
6058 |
|
6059 | function insert (parent, elm, ref$$1) {
|
6060 | if (isDef(parent)) {
|
6061 | if (isDef(ref$$1)) {
|
6062 | if (nodeOps.parentNode(ref$$1) === parent) {
|
6063 | nodeOps.insertBefore(parent, elm, ref$$1);
|
6064 | }
|
6065 | } else {
|
6066 | nodeOps.appendChild(parent, elm);
|
6067 | }
|
6068 | }
|
6069 | }
|
6070 |
|
6071 | function createChildren (vnode, children, insertedVnodeQueue) {
|
6072 | if (Array.isArray(children)) {
|
6073 | {
|
6074 | checkDuplicateKeys(children);
|
6075 | }
|
6076 | for (var i = 0; i < children.length; ++i) {
|
6077 | createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
|
6078 | }
|
6079 | } else if (isPrimitive(vnode.text)) {
|
6080 | nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
|
6081 | }
|
6082 | }
|
6083 |
|
6084 | function isPatchable (vnode) {
|
6085 | while (vnode.componentInstance) {
|
6086 | vnode = vnode.componentInstance._vnode;
|
6087 | }
|
6088 | return isDef(vnode.tag)
|
6089 | }
|
6090 |
|
6091 | function invokeCreateHooks (vnode, insertedVnodeQueue) {
|
6092 | for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
6093 | cbs.create[i$1](emptyNode, vnode);
|
6094 | }
|
6095 | i = vnode.data.hook;
|
6096 | if (isDef(i)) {
|
6097 | if (isDef(i.create)) { i.create(emptyNode, vnode); }
|
6098 | if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
|
6099 | }
|
6100 | }
|
6101 |
|
6102 |
|
6103 |
|
6104 |
|
6105 | function setScope (vnode) {
|
6106 | var i;
|
6107 | if (isDef(i = vnode.fnScopeId)) {
|
6108 | nodeOps.setStyleScope(vnode.elm, i);
|
6109 | } else {
|
6110 | var ancestor = vnode;
|
6111 | while (ancestor) {
|
6112 | if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
|
6113 | nodeOps.setStyleScope(vnode.elm, i);
|
6114 | }
|
6115 | ancestor = ancestor.parent;
|
6116 | }
|
6117 | }
|
6118 |
|
6119 | if (isDef(i = activeInstance) &&
|
6120 | i !== vnode.context &&
|
6121 | i !== vnode.fnContext &&
|
6122 | isDef(i = i.$options._scopeId)
|
6123 | ) {
|
6124 | nodeOps.setStyleScope(vnode.elm, i);
|
6125 | }
|
6126 | }
|
6127 |
|
6128 | function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
|
6129 | for (; startIdx <= endIdx; ++startIdx) {
|
6130 | createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
|
6131 | }
|
6132 | }
|
6133 |
|
6134 | function invokeDestroyHook (vnode) {
|
6135 | var i, j;
|
6136 | var data = vnode.data;
|
6137 | if (isDef(data)) {
|
6138 | if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
|
6139 | for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
|
6140 | }
|
6141 | if (isDef(i = vnode.children)) {
|
6142 | for (j = 0; j < vnode.children.length; ++j) {
|
6143 | invokeDestroyHook(vnode.children[j]);
|
6144 | }
|
6145 | }
|
6146 | }
|
6147 |
|
6148 | function removeVnodes (vnodes, startIdx, endIdx) {
|
6149 | for (; startIdx <= endIdx; ++startIdx) {
|
6150 | var ch = vnodes[startIdx];
|
6151 | if (isDef(ch)) {
|
6152 | if (isDef(ch.tag)) {
|
6153 | removeAndInvokeRemoveHook(ch);
|
6154 | invokeDestroyHook(ch);
|
6155 | } else {
|
6156 | removeNode(ch.elm);
|
6157 | }
|
6158 | }
|
6159 | }
|
6160 | }
|
6161 |
|
6162 | function removeAndInvokeRemoveHook (vnode, rm) {
|
6163 | if (isDef(rm) || isDef(vnode.data)) {
|
6164 | var i;
|
6165 | var listeners = cbs.remove.length + 1;
|
6166 | if (isDef(rm)) {
|
6167 |
|
6168 |
|
6169 | rm.listeners += listeners;
|
6170 | } else {
|
6171 |
|
6172 | rm = createRmCb(vnode.elm, listeners);
|
6173 | }
|
6174 |
|
6175 | if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
|
6176 | removeAndInvokeRemoveHook(i, rm);
|
6177 | }
|
6178 | for (i = 0; i < cbs.remove.length; ++i) {
|
6179 | cbs.remove[i](vnode, rm);
|
6180 | }
|
6181 | if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
|
6182 | i(vnode, rm);
|
6183 | } else {
|
6184 | rm();
|
6185 | }
|
6186 | } else {
|
6187 | removeNode(vnode.elm);
|
6188 | }
|
6189 | }
|
6190 |
|
6191 | function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
|
6192 | var oldStartIdx = 0;
|
6193 | var newStartIdx = 0;
|
6194 | var oldEndIdx = oldCh.length - 1;
|
6195 | var oldStartVnode = oldCh[0];
|
6196 | var oldEndVnode = oldCh[oldEndIdx];
|
6197 | var newEndIdx = newCh.length - 1;
|
6198 | var newStartVnode = newCh[0];
|
6199 | var newEndVnode = newCh[newEndIdx];
|
6200 | var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
|
6201 |
|
6202 |
|
6203 |
|
6204 |
|
6205 | var canMove = !removeOnly;
|
6206 |
|
6207 | {
|
6208 | checkDuplicateKeys(newCh);
|
6209 | }
|
6210 |
|
6211 | while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
6212 | if (isUndef(oldStartVnode)) {
|
6213 | oldStartVnode = oldCh[++oldStartIdx];
|
6214 | } else if (isUndef(oldEndVnode)) {
|
6215 | oldEndVnode = oldCh[--oldEndIdx];
|
6216 | } else if (sameVnode(oldStartVnode, newStartVnode)) {
|
6217 | patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6218 | oldStartVnode = oldCh[++oldStartIdx];
|
6219 | newStartVnode = newCh[++newStartIdx];
|
6220 | } else if (sameVnode(oldEndVnode, newEndVnode)) {
|
6221 | patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6222 | oldEndVnode = oldCh[--oldEndIdx];
|
6223 | newEndVnode = newCh[--newEndIdx];
|
6224 | } else if (sameVnode(oldStartVnode, newEndVnode)) {
|
6225 | patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6226 | canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
|
6227 | oldStartVnode = oldCh[++oldStartIdx];
|
6228 | newEndVnode = newCh[--newEndIdx];
|
6229 | } else if (sameVnode(oldEndVnode, newStartVnode)) {
|
6230 | patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6231 | canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
|
6232 | oldEndVnode = oldCh[--oldEndIdx];
|
6233 | newStartVnode = newCh[++newStartIdx];
|
6234 | } else {
|
6235 | if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
|
6236 | idxInOld = isDef(newStartVnode.key)
|
6237 | ? oldKeyToIdx[newStartVnode.key]
|
6238 | : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
|
6239 | if (isUndef(idxInOld)) {
|
6240 | createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6241 | } else {
|
6242 | vnodeToMove = oldCh[idxInOld];
|
6243 | if (sameVnode(vnodeToMove, newStartVnode)) {
|
6244 | patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6245 | oldCh[idxInOld] = undefined;
|
6246 | canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
|
6247 | } else {
|
6248 |
|
6249 | createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6250 | }
|
6251 | }
|
6252 | newStartVnode = newCh[++newStartIdx];
|
6253 | }
|
6254 | }
|
6255 | if (oldStartIdx > oldEndIdx) {
|
6256 | refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
6257 | addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
6258 | } else if (newStartIdx > newEndIdx) {
|
6259 | removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
6260 | }
|
6261 | }
|
6262 |
|
6263 | function checkDuplicateKeys (children) {
|
6264 | var seenKeys = {};
|
6265 | for (var i = 0; i < children.length; i++) {
|
6266 | var vnode = children[i];
|
6267 | var key = vnode.key;
|
6268 | if (isDef(key)) {
|
6269 | if (seenKeys[key]) {
|
6270 | warn(
|
6271 | ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
|
6272 | vnode.context
|
6273 | );
|
6274 | } else {
|
6275 | seenKeys[key] = true;
|
6276 | }
|
6277 | }
|
6278 | }
|
6279 | }
|
6280 |
|
6281 | function findIdxInOld (node, oldCh, start, end) {
|
6282 | for (var i = start; i < end; i++) {
|
6283 | var c = oldCh[i];
|
6284 | if (isDef(c) && sameVnode(node, c)) { return i }
|
6285 | }
|
6286 | }
|
6287 |
|
6288 | function patchVnode (
|
6289 | oldVnode,
|
6290 | vnode,
|
6291 | insertedVnodeQueue,
|
6292 | ownerArray,
|
6293 | index,
|
6294 | removeOnly
|
6295 | ) {
|
6296 | if (oldVnode === vnode) {
|
6297 | return
|
6298 | }
|
6299 |
|
6300 | if (isDef(vnode.elm) && isDef(ownerArray)) {
|
6301 |
|
6302 | vnode = ownerArray[index] = cloneVNode(vnode);
|
6303 | }
|
6304 |
|
6305 | var elm = vnode.elm = oldVnode.elm;
|
6306 |
|
6307 | if (isTrue(oldVnode.isAsyncPlaceholder)) {
|
6308 | if (isDef(vnode.asyncFactory.resolved)) {
|
6309 | hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
|
6310 | } else {
|
6311 | vnode.isAsyncPlaceholder = true;
|
6312 | }
|
6313 | return
|
6314 | }
|
6315 |
|
6316 |
|
6317 |
|
6318 |
|
6319 |
|
6320 | if (isTrue(vnode.isStatic) &&
|
6321 | isTrue(oldVnode.isStatic) &&
|
6322 | vnode.key === oldVnode.key &&
|
6323 | (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
|
6324 | ) {
|
6325 | vnode.componentInstance = oldVnode.componentInstance;
|
6326 | return
|
6327 | }
|
6328 |
|
6329 | var i;
|
6330 | var data = vnode.data;
|
6331 | if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
|
6332 | i(oldVnode, vnode);
|
6333 | }
|
6334 |
|
6335 | var oldCh = oldVnode.children;
|
6336 | var ch = vnode.children;
|
6337 | if (isDef(data) && isPatchable(vnode)) {
|
6338 | for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
|
6339 | if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
|
6340 | }
|
6341 | if (isUndef(vnode.text)) {
|
6342 | if (isDef(oldCh) && isDef(ch)) {
|
6343 | if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
|
6344 | } else if (isDef(ch)) {
|
6345 | {
|
6346 | checkDuplicateKeys(ch);
|
6347 | }
|
6348 | if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
|
6349 | addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
6350 | } else if (isDef(oldCh)) {
|
6351 | removeVnodes(oldCh, 0, oldCh.length - 1);
|
6352 | } else if (isDef(oldVnode.text)) {
|
6353 | nodeOps.setTextContent(elm, '');
|
6354 | }
|
6355 | } else if (oldVnode.text !== vnode.text) {
|
6356 | nodeOps.setTextContent(elm, vnode.text);
|
6357 | }
|
6358 | if (isDef(data)) {
|
6359 | if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
|
6360 | }
|
6361 | }
|
6362 |
|
6363 | function invokeInsertHook (vnode, queue, initial) {
|
6364 |
|
6365 |
|
6366 | if (isTrue(initial) && isDef(vnode.parent)) {
|
6367 | vnode.parent.data.pendingInsert = queue;
|
6368 | } else {
|
6369 | for (var i = 0; i < queue.length; ++i) {
|
6370 | queue[i].data.hook.insert(queue[i]);
|
6371 | }
|
6372 | }
|
6373 | }
|
6374 |
|
6375 | var hydrationBailed = false;
|
6376 |
|
6377 |
|
6378 |
|
6379 |
|
6380 | var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
|
6381 |
|
6382 |
|
6383 | function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
|
6384 | var i;
|
6385 | var tag = vnode.tag;
|
6386 | var data = vnode.data;
|
6387 | var children = vnode.children;
|
6388 | inVPre = inVPre || (data && data.pre);
|
6389 | vnode.elm = elm;
|
6390 |
|
6391 | if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
|
6392 | vnode.isAsyncPlaceholder = true;
|
6393 | return true
|
6394 | }
|
6395 |
|
6396 | {
|
6397 | if (!assertNodeMatch(elm, vnode, inVPre)) {
|
6398 | return false
|
6399 | }
|
6400 | }
|
6401 | if (isDef(data)) {
|
6402 | if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true ); }
|
6403 | if (isDef(i = vnode.componentInstance)) {
|
6404 |
|
6405 | initComponent(vnode, insertedVnodeQueue);
|
6406 | return true
|
6407 | }
|
6408 | }
|
6409 | if (isDef(tag)) {
|
6410 | if (isDef(children)) {
|
6411 |
|
6412 | if (!elm.hasChildNodes()) {
|
6413 | createChildren(vnode, children, insertedVnodeQueue);
|
6414 | } else {
|
6415 |
|
6416 | if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
|
6417 | if (i !== elm.innerHTML) {
|
6418 |
|
6419 | if (typeof console !== 'undefined' &&
|
6420 | !hydrationBailed
|
6421 | ) {
|
6422 | hydrationBailed = true;
|
6423 | console.warn('Parent: ', elm);
|
6424 | console.warn('server innerHTML: ', i);
|
6425 | console.warn('client innerHTML: ', elm.innerHTML);
|
6426 | }
|
6427 | return false
|
6428 | }
|
6429 | } else {
|
6430 |
|
6431 | var childrenMatch = true;
|
6432 | var childNode = elm.firstChild;
|
6433 | for (var i$1 = 0; i$1 < children.length; i$1++) {
|
6434 | if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
|
6435 | childrenMatch = false;
|
6436 | break
|
6437 | }
|
6438 | childNode = childNode.nextSibling;
|
6439 | }
|
6440 |
|
6441 |
|
6442 | if (!childrenMatch || childNode) {
|
6443 |
|
6444 | if (typeof console !== 'undefined' &&
|
6445 | !hydrationBailed
|
6446 | ) {
|
6447 | hydrationBailed = true;
|
6448 | console.warn('Parent: ', elm);
|
6449 | console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
|
6450 | }
|
6451 | return false
|
6452 | }
|
6453 | }
|
6454 | }
|
6455 | }
|
6456 | if (isDef(data)) {
|
6457 | var fullInvoke = false;
|
6458 | for (var key in data) {
|
6459 | if (!isRenderedModule(key)) {
|
6460 | fullInvoke = true;
|
6461 | invokeCreateHooks(vnode, insertedVnodeQueue);
|
6462 | break
|
6463 | }
|
6464 | }
|
6465 | if (!fullInvoke && data['class']) {
|
6466 |
|
6467 | traverse(data['class']);
|
6468 | }
|
6469 | }
|
6470 | } else if (elm.data !== vnode.text) {
|
6471 | elm.data = vnode.text;
|
6472 | }
|
6473 | return true
|
6474 | }
|
6475 |
|
6476 | function assertNodeMatch (node, vnode, inVPre) {
|
6477 | if (isDef(vnode.tag)) {
|
6478 | return vnode.tag.indexOf('vue-component') === 0 || (
|
6479 | !isUnknownElement$$1(vnode, inVPre) &&
|
6480 | vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
|
6481 | )
|
6482 | } else {
|
6483 | return node.nodeType === (vnode.isComment ? 8 : 3)
|
6484 | }
|
6485 | }
|
6486 |
|
6487 | return function patch (oldVnode, vnode, hydrating, removeOnly) {
|
6488 | if (isUndef(vnode)) {
|
6489 | if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
|
6490 | return
|
6491 | }
|
6492 |
|
6493 | var isInitialPatch = false;
|
6494 | var insertedVnodeQueue = [];
|
6495 |
|
6496 | if (isUndef(oldVnode)) {
|
6497 |
|
6498 | isInitialPatch = true;
|
6499 | createElm(vnode, insertedVnodeQueue);
|
6500 | } else {
|
6501 | var isRealElement = isDef(oldVnode.nodeType);
|
6502 | if (!isRealElement && sameVnode(oldVnode, vnode)) {
|
6503 |
|
6504 | patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
|
6505 | } else {
|
6506 | if (isRealElement) {
|
6507 |
|
6508 |
|
6509 |
|
6510 | if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
|
6511 | oldVnode.removeAttribute(SSR_ATTR);
|
6512 | hydrating = true;
|
6513 | }
|
6514 | if (isTrue(hydrating)) {
|
6515 | if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
|
6516 | invokeInsertHook(vnode, insertedVnodeQueue, true);
|
6517 | return oldVnode
|
6518 | } else {
|
6519 | warn(
|
6520 | 'The client-side rendered virtual DOM tree is not matching ' +
|
6521 | 'server-rendered content. This is likely caused by incorrect ' +
|
6522 | 'HTML markup, for example nesting block-level elements inside ' +
|
6523 | '<p>, or missing <tbody>. Bailing hydration and performing ' +
|
6524 | 'full client-side render.'
|
6525 | );
|
6526 | }
|
6527 | }
|
6528 |
|
6529 |
|
6530 | oldVnode = emptyNodeAt(oldVnode);
|
6531 | }
|
6532 |
|
6533 |
|
6534 | var oldElm = oldVnode.elm;
|
6535 | var parentElm = nodeOps.parentNode(oldElm);
|
6536 |
|
6537 |
|
6538 | createElm(
|
6539 | vnode,
|
6540 | insertedVnodeQueue,
|
6541 |
|
6542 |
|
6543 |
|
6544 | oldElm._leaveCb ? null : parentElm,
|
6545 | nodeOps.nextSibling(oldElm)
|
6546 | );
|
6547 |
|
6548 |
|
6549 | if (isDef(vnode.parent)) {
|
6550 | var ancestor = vnode.parent;
|
6551 | var patchable = isPatchable(vnode);
|
6552 | while (ancestor) {
|
6553 | for (var i = 0; i < cbs.destroy.length; ++i) {
|
6554 | cbs.destroy[i](ancestor);
|
6555 | }
|
6556 | ancestor.elm = vnode.elm;
|
6557 | if (patchable) {
|
6558 | for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
6559 | cbs.create[i$1](emptyNode, ancestor);
|
6560 | }
|
6561 |
|
6562 |
|
6563 |
|
6564 | var insert = ancestor.data.hook.insert;
|
6565 | if (insert.merged) {
|
6566 |
|
6567 | for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
|
6568 | insert.fns[i$2]();
|
6569 | }
|
6570 | }
|
6571 | } else {
|
6572 | registerRef(ancestor);
|
6573 | }
|
6574 | ancestor = ancestor.parent;
|
6575 | }
|
6576 | }
|
6577 |
|
6578 |
|
6579 | if (isDef(parentElm)) {
|
6580 | removeVnodes([oldVnode], 0, 0);
|
6581 | } else if (isDef(oldVnode.tag)) {
|
6582 | invokeDestroyHook(oldVnode);
|
6583 | }
|
6584 | }
|
6585 | }
|
6586 |
|
6587 | invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
|
6588 | return vnode.elm
|
6589 | }
|
6590 | }
|
6591 |
|
6592 |
|
6593 |
|
6594 | var directives = {
|
6595 | create: updateDirectives,
|
6596 | update: updateDirectives,
|
6597 | destroy: function unbindDirectives (vnode) {
|
6598 | updateDirectives(vnode, emptyNode);
|
6599 | }
|
6600 | };
|
6601 |
|
6602 | function updateDirectives (oldVnode, vnode) {
|
6603 | if (oldVnode.data.directives || vnode.data.directives) {
|
6604 | _update(oldVnode, vnode);
|
6605 | }
|
6606 | }
|
6607 |
|
6608 | function _update (oldVnode, vnode) {
|
6609 | var isCreate = oldVnode === emptyNode;
|
6610 | var isDestroy = vnode === emptyNode;
|
6611 | var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
|
6612 | var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
|
6613 |
|
6614 | var dirsWithInsert = [];
|
6615 | var dirsWithPostpatch = [];
|
6616 |
|
6617 | var key, oldDir, dir;
|
6618 | for (key in newDirs) {
|
6619 | oldDir = oldDirs[key];
|
6620 | dir = newDirs[key];
|
6621 | if (!oldDir) {
|
6622 |
|
6623 | callHook$1(dir, 'bind', vnode, oldVnode);
|
6624 | if (dir.def && dir.def.inserted) {
|
6625 | dirsWithInsert.push(dir);
|
6626 | }
|
6627 | } else {
|
6628 |
|
6629 | dir.oldValue = oldDir.value;
|
6630 | dir.oldArg = oldDir.arg;
|
6631 | callHook$1(dir, 'update', vnode, oldVnode);
|
6632 | if (dir.def && dir.def.componentUpdated) {
|
6633 | dirsWithPostpatch.push(dir);
|
6634 | }
|
6635 | }
|
6636 | }
|
6637 |
|
6638 | if (dirsWithInsert.length) {
|
6639 | var callInsert = function () {
|
6640 | for (var i = 0; i < dirsWithInsert.length; i++) {
|
6641 | callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
|
6642 | }
|
6643 | };
|
6644 | if (isCreate) {
|
6645 | mergeVNodeHook(vnode, 'insert', callInsert);
|
6646 | } else {
|
6647 | callInsert();
|
6648 | }
|
6649 | }
|
6650 |
|
6651 | if (dirsWithPostpatch.length) {
|
6652 | mergeVNodeHook(vnode, 'postpatch', function () {
|
6653 | for (var i = 0; i < dirsWithPostpatch.length; i++) {
|
6654 | callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
|
6655 | }
|
6656 | });
|
6657 | }
|
6658 |
|
6659 | if (!isCreate) {
|
6660 | for (key in oldDirs) {
|
6661 | if (!newDirs[key]) {
|
6662 |
|
6663 | callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
|
6664 | }
|
6665 | }
|
6666 | }
|
6667 | }
|
6668 |
|
6669 | var emptyModifiers = Object.create(null);
|
6670 |
|
6671 | function normalizeDirectives$1 (
|
6672 | dirs,
|
6673 | vm
|
6674 | ) {
|
6675 | var res = Object.create(null);
|
6676 | if (!dirs) {
|
6677 |
|
6678 | return res
|
6679 | }
|
6680 | var i, dir;
|
6681 | for (i = 0; i < dirs.length; i++) {
|
6682 | dir = dirs[i];
|
6683 | if (!dir.modifiers) {
|
6684 |
|
6685 | dir.modifiers = emptyModifiers;
|
6686 | }
|
6687 | res[getRawDirName(dir)] = dir;
|
6688 | dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
|
6689 | }
|
6690 |
|
6691 | return res
|
6692 | }
|
6693 |
|
6694 | function getRawDirName (dir) {
|
6695 | return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
|
6696 | }
|
6697 |
|
6698 | function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
|
6699 | var fn = dir.def && dir.def[hook];
|
6700 | if (fn) {
|
6701 | try {
|
6702 | fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
|
6703 | } catch (e) {
|
6704 | handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
|
6705 | }
|
6706 | }
|
6707 | }
|
6708 |
|
6709 | var baseModules = [
|
6710 | ref,
|
6711 | directives
|
6712 | ];
|
6713 |
|
6714 |
|
6715 |
|
6716 | function updateAttrs (oldVnode, vnode) {
|
6717 | var opts = vnode.componentOptions;
|
6718 | if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
|
6719 | return
|
6720 | }
|
6721 | if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
|
6722 | return
|
6723 | }
|
6724 | var key, cur, old;
|
6725 | var elm = vnode.elm;
|
6726 | var oldAttrs = oldVnode.data.attrs || {};
|
6727 | var attrs = vnode.data.attrs || {};
|
6728 |
|
6729 | if (isDef(attrs.__ob__)) {
|
6730 | attrs = vnode.data.attrs = extend({}, attrs);
|
6731 | }
|
6732 |
|
6733 | for (key in attrs) {
|
6734 | cur = attrs[key];
|
6735 | old = oldAttrs[key];
|
6736 | if (old !== cur) {
|
6737 | setAttr(elm, key, cur, vnode.data.pre);
|
6738 | }
|
6739 | }
|
6740 |
|
6741 |
|
6742 |
|
6743 | if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
|
6744 | setAttr(elm, 'value', attrs.value);
|
6745 | }
|
6746 | for (key in oldAttrs) {
|
6747 | if (isUndef(attrs[key])) {
|
6748 | if (isXlink(key)) {
|
6749 | elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6750 | } else if (!isEnumeratedAttr(key)) {
|
6751 | elm.removeAttribute(key);
|
6752 | }
|
6753 | }
|
6754 | }
|
6755 | }
|
6756 |
|
6757 | function setAttr (el, key, value, isInPre) {
|
6758 | if (isInPre || el.tagName.indexOf('-') > -1) {
|
6759 | baseSetAttr(el, key, value);
|
6760 | } else if (isBooleanAttr(key)) {
|
6761 |
|
6762 |
|
6763 | if (isFalsyAttrValue(value)) {
|
6764 | el.removeAttribute(key);
|
6765 | } else {
|
6766 |
|
6767 |
|
6768 | value = key === 'allowfullscreen' && el.tagName === 'EMBED'
|
6769 | ? 'true'
|
6770 | : key;
|
6771 | el.setAttribute(key, value);
|
6772 | }
|
6773 | } else if (isEnumeratedAttr(key)) {
|
6774 | el.setAttribute(key, convertEnumeratedValue(key, value));
|
6775 | } else if (isXlink(key)) {
|
6776 | if (isFalsyAttrValue(value)) {
|
6777 | el.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6778 | } else {
|
6779 | el.setAttributeNS(xlinkNS, key, value);
|
6780 | }
|
6781 | } else {
|
6782 | baseSetAttr(el, key, value);
|
6783 | }
|
6784 | }
|
6785 |
|
6786 | function baseSetAttr (el, key, value) {
|
6787 | if (isFalsyAttrValue(value)) {
|
6788 | el.removeAttribute(key);
|
6789 | } else {
|
6790 |
|
6791 |
|
6792 |
|
6793 |
|
6794 | if (
|
6795 | isIE && !isIE9 &&
|
6796 | el.tagName === 'TEXTAREA' &&
|
6797 | key === 'placeholder' && value !== '' && !el.__ieph
|
6798 | ) {
|
6799 | var blocker = function (e) {
|
6800 | e.stopImmediatePropagation();
|
6801 | el.removeEventListener('input', blocker);
|
6802 | };
|
6803 | el.addEventListener('input', blocker);
|
6804 |
|
6805 | el.__ieph = true;
|
6806 | }
|
6807 | el.setAttribute(key, value);
|
6808 | }
|
6809 | }
|
6810 |
|
6811 | var attrs = {
|
6812 | create: updateAttrs,
|
6813 | update: updateAttrs
|
6814 | };
|
6815 |
|
6816 |
|
6817 |
|
6818 | function updateClass (oldVnode, vnode) {
|
6819 | var el = vnode.elm;
|
6820 | var data = vnode.data;
|
6821 | var oldData = oldVnode.data;
|
6822 | if (
|
6823 | isUndef(data.staticClass) &&
|
6824 | isUndef(data.class) && (
|
6825 | isUndef(oldData) || (
|
6826 | isUndef(oldData.staticClass) &&
|
6827 | isUndef(oldData.class)
|
6828 | )
|
6829 | )
|
6830 | ) {
|
6831 | return
|
6832 | }
|
6833 |
|
6834 | var cls = genClassForVnode(vnode);
|
6835 |
|
6836 |
|
6837 | var transitionClass = el._transitionClasses;
|
6838 | if (isDef(transitionClass)) {
|
6839 | cls = concat(cls, stringifyClass(transitionClass));
|
6840 | }
|
6841 |
|
6842 |
|
6843 | if (cls !== el._prevClass) {
|
6844 | el.setAttribute('class', cls);
|
6845 | el._prevClass = cls;
|
6846 | }
|
6847 | }
|
6848 |
|
6849 | var klass = {
|
6850 | create: updateClass,
|
6851 | update: updateClass
|
6852 | };
|
6853 |
|
6854 |
|
6855 |
|
6856 |
|
6857 |
|
6858 |
|
6859 |
|
6860 |
|
6861 |
|
6862 |
|
6863 |
|
6864 | var RANGE_TOKEN = '__r';
|
6865 | var CHECKBOX_RADIO_TOKEN = '__c';
|
6866 |
|
6867 |
|
6868 |
|
6869 |
|
6870 |
|
6871 |
|
6872 |
|
6873 | function normalizeEvents (on) {
|
6874 |
|
6875 | if (isDef(on[RANGE_TOKEN])) {
|
6876 |
|
6877 | var event = isIE ? 'change' : 'input';
|
6878 | on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
|
6879 | delete on[RANGE_TOKEN];
|
6880 | }
|
6881 |
|
6882 |
|
6883 |
|
6884 | if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
|
6885 | on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
|
6886 | delete on[CHECKBOX_RADIO_TOKEN];
|
6887 | }
|
6888 | }
|
6889 |
|
6890 | var target$1;
|
6891 |
|
6892 | function createOnceHandler$1 (event, handler, capture) {
|
6893 | var _target = target$1;
|
6894 | return function onceHandler () {
|
6895 | var res = handler.apply(null, arguments);
|
6896 | if (res !== null) {
|
6897 | remove$2(event, onceHandler, capture, _target);
|
6898 | }
|
6899 | }
|
6900 | }
|
6901 |
|
6902 |
|
6903 |
|
6904 |
|
6905 | var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
|
6906 |
|
6907 | function add$1 (
|
6908 | name,
|
6909 | handler,
|
6910 | capture,
|
6911 | passive
|
6912 | ) {
|
6913 |
|
6914 |
|
6915 |
|
6916 |
|
6917 |
|
6918 |
|
6919 | if (useMicrotaskFix) {
|
6920 | var attachedTimestamp = currentFlushTimestamp;
|
6921 | var original = handler;
|
6922 | handler = original._wrapper = function (e) {
|
6923 | if (
|
6924 |
|
6925 |
|
6926 |
|
6927 | e.target === e.currentTarget ||
|
6928 |
|
6929 | e.timeStamp >= attachedTimestamp ||
|
6930 |
|
6931 |
|
6932 |
|
6933 | e.timeStamp <= 0 ||
|
6934 |
|
6935 |
|
6936 |
|
6937 | e.target.ownerDocument !== document
|
6938 | ) {
|
6939 | return original.apply(this, arguments)
|
6940 | }
|
6941 | };
|
6942 | }
|
6943 | target$1.addEventListener(
|
6944 | name,
|
6945 | handler,
|
6946 | supportsPassive
|
6947 | ? { capture: capture, passive: passive }
|
6948 | : capture
|
6949 | );
|
6950 | }
|
6951 |
|
6952 | function remove$2 (
|
6953 | name,
|
6954 | handler,
|
6955 | capture,
|
6956 | _target
|
6957 | ) {
|
6958 | (_target || target$1).removeEventListener(
|
6959 | name,
|
6960 | handler._wrapper || handler,
|
6961 | capture
|
6962 | );
|
6963 | }
|
6964 |
|
6965 | function updateDOMListeners (oldVnode, vnode) {
|
6966 | if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
|
6967 | return
|
6968 | }
|
6969 | var on = vnode.data.on || {};
|
6970 | var oldOn = oldVnode.data.on || {};
|
6971 | target$1 = vnode.elm;
|
6972 | normalizeEvents(on);
|
6973 | updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
|
6974 | target$1 = undefined;
|
6975 | }
|
6976 |
|
6977 | var events = {
|
6978 | create: updateDOMListeners,
|
6979 | update: updateDOMListeners
|
6980 | };
|
6981 |
|
6982 |
|
6983 |
|
6984 | var svgContainer;
|
6985 |
|
6986 | function updateDOMProps (oldVnode, vnode) {
|
6987 | if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
|
6988 | return
|
6989 | }
|
6990 | var key, cur;
|
6991 | var elm = vnode.elm;
|
6992 | var oldProps = oldVnode.data.domProps || {};
|
6993 | var props = vnode.data.domProps || {};
|
6994 |
|
6995 | if (isDef(props.__ob__)) {
|
6996 | props = vnode.data.domProps = extend({}, props);
|
6997 | }
|
6998 |
|
6999 | for (key in oldProps) {
|
7000 | if (!(key in props)) {
|
7001 | elm[key] = '';
|
7002 | }
|
7003 | }
|
7004 |
|
7005 | for (key in props) {
|
7006 | cur = props[key];
|
7007 |
|
7008 |
|
7009 |
|
7010 | if (key === 'textContent' || key === 'innerHTML') {
|
7011 | if (vnode.children) { vnode.children.length = 0; }
|
7012 | if (cur === oldProps[key]) { continue }
|
7013 |
|
7014 |
|
7015 | if (elm.childNodes.length === 1) {
|
7016 | elm.removeChild(elm.childNodes[0]);
|
7017 | }
|
7018 | }
|
7019 |
|
7020 | if (key === 'value' && elm.tagName !== 'PROGRESS') {
|
7021 |
|
7022 |
|
7023 | elm._value = cur;
|
7024 |
|
7025 | var strCur = isUndef(cur) ? '' : String(cur);
|
7026 | if (shouldUpdateValue(elm, strCur)) {
|
7027 | elm.value = strCur;
|
7028 | }
|
7029 | } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
|
7030 |
|
7031 | svgContainer = svgContainer || document.createElement('div');
|
7032 | svgContainer.innerHTML = "<svg>" + cur + "</svg>";
|
7033 | var svg = svgContainer.firstChild;
|
7034 | while (elm.firstChild) {
|
7035 | elm.removeChild(elm.firstChild);
|
7036 | }
|
7037 | while (svg.firstChild) {
|
7038 | elm.appendChild(svg.firstChild);
|
7039 | }
|
7040 | } else if (
|
7041 |
|
7042 |
|
7043 |
|
7044 |
|
7045 | cur !== oldProps[key]
|
7046 | ) {
|
7047 |
|
7048 |
|
7049 | try {
|
7050 | elm[key] = cur;
|
7051 | } catch (e) {}
|
7052 | }
|
7053 | }
|
7054 | }
|
7055 |
|
7056 |
|
7057 |
|
7058 |
|
7059 | function shouldUpdateValue (elm, checkVal) {
|
7060 | return (!elm.composing && (
|
7061 | elm.tagName === 'OPTION' ||
|
7062 | isNotInFocusAndDirty(elm, checkVal) ||
|
7063 | isDirtyWithModifiers(elm, checkVal)
|
7064 | ))
|
7065 | }
|
7066 |
|
7067 | function isNotInFocusAndDirty (elm, checkVal) {
|
7068 |
|
7069 |
|
7070 | var notInFocus = true;
|
7071 |
|
7072 |
|
7073 | try { notInFocus = document.activeElement !== elm; } catch (e) {}
|
7074 | return notInFocus && elm.value !== checkVal
|
7075 | }
|
7076 |
|
7077 | function isDirtyWithModifiers (elm, newVal) {
|
7078 | var value = elm.value;
|
7079 | var modifiers = elm._vModifiers;
|
7080 | if (isDef(modifiers)) {
|
7081 | if (modifiers.number) {
|
7082 | return toNumber(value) !== toNumber(newVal)
|
7083 | }
|
7084 | if (modifiers.trim) {
|
7085 | return value.trim() !== newVal.trim()
|
7086 | }
|
7087 | }
|
7088 | return value !== newVal
|
7089 | }
|
7090 |
|
7091 | var domProps = {
|
7092 | create: updateDOMProps,
|
7093 | update: updateDOMProps
|
7094 | };
|
7095 |
|
7096 |
|
7097 |
|
7098 | var parseStyleText = cached(function (cssText) {
|
7099 | var res = {};
|
7100 | var listDelimiter = /;(?![^(]*\))/g;
|
7101 | var propertyDelimiter = /:(.+)/;
|
7102 | cssText.split(listDelimiter).forEach(function (item) {
|
7103 | if (item) {
|
7104 | var tmp = item.split(propertyDelimiter);
|
7105 | tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
|
7106 | }
|
7107 | });
|
7108 | return res
|
7109 | });
|
7110 |
|
7111 |
|
7112 | function normalizeStyleData (data) {
|
7113 | var style = normalizeStyleBinding(data.style);
|
7114 |
|
7115 |
|
7116 | return data.staticStyle
|
7117 | ? extend(data.staticStyle, style)
|
7118 | : style
|
7119 | }
|
7120 |
|
7121 |
|
7122 | function normalizeStyleBinding (bindingStyle) {
|
7123 | if (Array.isArray(bindingStyle)) {
|
7124 | return toObject(bindingStyle)
|
7125 | }
|
7126 | if (typeof bindingStyle === 'string') {
|
7127 | return parseStyleText(bindingStyle)
|
7128 | }
|
7129 | return bindingStyle
|
7130 | }
|
7131 |
|
7132 |
|
7133 |
|
7134 |
|
7135 |
|
7136 | function getStyle (vnode, checkChild) {
|
7137 | var res = {};
|
7138 | var styleData;
|
7139 |
|
7140 | if (checkChild) {
|
7141 | var childNode = vnode;
|
7142 | while (childNode.componentInstance) {
|
7143 | childNode = childNode.componentInstance._vnode;
|
7144 | if (
|
7145 | childNode && childNode.data &&
|
7146 | (styleData = normalizeStyleData(childNode.data))
|
7147 | ) {
|
7148 | extend(res, styleData);
|
7149 | }
|
7150 | }
|
7151 | }
|
7152 |
|
7153 | if ((styleData = normalizeStyleData(vnode.data))) {
|
7154 | extend(res, styleData);
|
7155 | }
|
7156 |
|
7157 | var parentNode = vnode;
|
7158 | while ((parentNode = parentNode.parent)) {
|
7159 | if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
|
7160 | extend(res, styleData);
|
7161 | }
|
7162 | }
|
7163 | return res
|
7164 | }
|
7165 |
|
7166 |
|
7167 |
|
7168 | var cssVarRE = /^--/;
|
7169 | var importantRE = /\s*!important$/;
|
7170 | var setProp = function (el, name, val) {
|
7171 |
|
7172 | if (cssVarRE.test(name)) {
|
7173 | el.style.setProperty(name, val);
|
7174 | } else if (importantRE.test(val)) {
|
7175 | el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
|
7176 | } else {
|
7177 | var normalizedName = normalize(name);
|
7178 | if (Array.isArray(val)) {
|
7179 |
|
7180 |
|
7181 |
|
7182 | for (var i = 0, len = val.length; i < len; i++) {
|
7183 | el.style[normalizedName] = val[i];
|
7184 | }
|
7185 | } else {
|
7186 | el.style[normalizedName] = val;
|
7187 | }
|
7188 | }
|
7189 | };
|
7190 |
|
7191 | var vendorNames = ['Webkit', 'Moz', 'ms'];
|
7192 |
|
7193 | var emptyStyle;
|
7194 | var normalize = cached(function (prop) {
|
7195 | emptyStyle = emptyStyle || document.createElement('div').style;
|
7196 | prop = camelize(prop);
|
7197 | if (prop !== 'filter' && (prop in emptyStyle)) {
|
7198 | return prop
|
7199 | }
|
7200 | var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
|
7201 | for (var i = 0; i < vendorNames.length; i++) {
|
7202 | var name = vendorNames[i] + capName;
|
7203 | if (name in emptyStyle) {
|
7204 | return name
|
7205 | }
|
7206 | }
|
7207 | });
|
7208 |
|
7209 | function updateStyle (oldVnode, vnode) {
|
7210 | var data = vnode.data;
|
7211 | var oldData = oldVnode.data;
|
7212 |
|
7213 | if (isUndef(data.staticStyle) && isUndef(data.style) &&
|
7214 | isUndef(oldData.staticStyle) && isUndef(oldData.style)
|
7215 | ) {
|
7216 | return
|
7217 | }
|
7218 |
|
7219 | var cur, name;
|
7220 | var el = vnode.elm;
|
7221 | var oldStaticStyle = oldData.staticStyle;
|
7222 | var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
|
7223 |
|
7224 |
|
7225 | var oldStyle = oldStaticStyle || oldStyleBinding;
|
7226 |
|
7227 | var style = normalizeStyleBinding(vnode.data.style) || {};
|
7228 |
|
7229 |
|
7230 |
|
7231 |
|
7232 | vnode.data.normalizedStyle = isDef(style.__ob__)
|
7233 | ? extend({}, style)
|
7234 | : style;
|
7235 |
|
7236 | var newStyle = getStyle(vnode, true);
|
7237 |
|
7238 | for (name in oldStyle) {
|
7239 | if (isUndef(newStyle[name])) {
|
7240 | setProp(el, name, '');
|
7241 | }
|
7242 | }
|
7243 | for (name in newStyle) {
|
7244 | cur = newStyle[name];
|
7245 | if (cur !== oldStyle[name]) {
|
7246 |
|
7247 | setProp(el, name, cur == null ? '' : cur);
|
7248 | }
|
7249 | }
|
7250 | }
|
7251 |
|
7252 | var style = {
|
7253 | create: updateStyle,
|
7254 | update: updateStyle
|
7255 | };
|
7256 |
|
7257 |
|
7258 |
|
7259 | var whitespaceRE = /\s+/;
|
7260 |
|
7261 |
|
7262 |
|
7263 |
|
7264 |
|
7265 | function addClass (el, cls) {
|
7266 |
|
7267 | if (!cls || !(cls = cls.trim())) {
|
7268 | return
|
7269 | }
|
7270 |
|
7271 |
|
7272 | if (el.classList) {
|
7273 | if (cls.indexOf(' ') > -1) {
|
7274 | cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
|
7275 | } else {
|
7276 | el.classList.add(cls);
|
7277 | }
|
7278 | } else {
|
7279 | var cur = " " + (el.getAttribute('class') || '') + " ";
|
7280 | if (cur.indexOf(' ' + cls + ' ') < 0) {
|
7281 | el.setAttribute('class', (cur + cls).trim());
|
7282 | }
|
7283 | }
|
7284 | }
|
7285 |
|
7286 |
|
7287 |
|
7288 |
|
7289 |
|
7290 | function removeClass (el, cls) {
|
7291 |
|
7292 | if (!cls || !(cls = cls.trim())) {
|
7293 | return
|
7294 | }
|
7295 |
|
7296 |
|
7297 | if (el.classList) {
|
7298 | if (cls.indexOf(' ') > -1) {
|
7299 | cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
|
7300 | } else {
|
7301 | el.classList.remove(cls);
|
7302 | }
|
7303 | if (!el.classList.length) {
|
7304 | el.removeAttribute('class');
|
7305 | }
|
7306 | } else {
|
7307 | var cur = " " + (el.getAttribute('class') || '') + " ";
|
7308 | var tar = ' ' + cls + ' ';
|
7309 | while (cur.indexOf(tar) >= 0) {
|
7310 | cur = cur.replace(tar, ' ');
|
7311 | }
|
7312 | cur = cur.trim();
|
7313 | if (cur) {
|
7314 | el.setAttribute('class', cur);
|
7315 | } else {
|
7316 | el.removeAttribute('class');
|
7317 | }
|
7318 | }
|
7319 | }
|
7320 |
|
7321 |
|
7322 |
|
7323 | function resolveTransition (def$$1) {
|
7324 | if (!def$$1) {
|
7325 | return
|
7326 | }
|
7327 |
|
7328 | if (typeof def$$1 === 'object') {
|
7329 | var res = {};
|
7330 | if (def$$1.css !== false) {
|
7331 | extend(res, autoCssTransition(def$$1.name || 'v'));
|
7332 | }
|
7333 | extend(res, def$$1);
|
7334 | return res
|
7335 | } else if (typeof def$$1 === 'string') {
|
7336 | return autoCssTransition(def$$1)
|
7337 | }
|
7338 | }
|
7339 |
|
7340 | var autoCssTransition = cached(function (name) {
|
7341 | return {
|
7342 | enterClass: (name + "-enter"),
|
7343 | enterToClass: (name + "-enter-to"),
|
7344 | enterActiveClass: (name + "-enter-active"),
|
7345 | leaveClass: (name + "-leave"),
|
7346 | leaveToClass: (name + "-leave-to"),
|
7347 | leaveActiveClass: (name + "-leave-active")
|
7348 | }
|
7349 | });
|
7350 |
|
7351 | var hasTransition = inBrowser && !isIE9;
|
7352 | var TRANSITION = 'transition';
|
7353 | var ANIMATION = 'animation';
|
7354 |
|
7355 |
|
7356 | var transitionProp = 'transition';
|
7357 | var transitionEndEvent = 'transitionend';
|
7358 | var animationProp = 'animation';
|
7359 | var animationEndEvent = 'animationend';
|
7360 | if (hasTransition) {
|
7361 |
|
7362 | if (window.ontransitionend === undefined &&
|
7363 | window.onwebkittransitionend !== undefined
|
7364 | ) {
|
7365 | transitionProp = 'WebkitTransition';
|
7366 | transitionEndEvent = 'webkitTransitionEnd';
|
7367 | }
|
7368 | if (window.onanimationend === undefined &&
|
7369 | window.onwebkitanimationend !== undefined
|
7370 | ) {
|
7371 | animationProp = 'WebkitAnimation';
|
7372 | animationEndEvent = 'webkitAnimationEnd';
|
7373 | }
|
7374 | }
|
7375 |
|
7376 |
|
7377 | var raf = inBrowser
|
7378 | ? window.requestAnimationFrame
|
7379 | ? window.requestAnimationFrame.bind(window)
|
7380 | : setTimeout
|
7381 | : function (fn) { return fn(); };
|
7382 |
|
7383 | function nextFrame (fn) {
|
7384 | raf(function () {
|
7385 | raf(fn);
|
7386 | });
|
7387 | }
|
7388 |
|
7389 | function addTransitionClass (el, cls) {
|
7390 | var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
|
7391 | if (transitionClasses.indexOf(cls) < 0) {
|
7392 | transitionClasses.push(cls);
|
7393 | addClass(el, cls);
|
7394 | }
|
7395 | }
|
7396 |
|
7397 | function removeTransitionClass (el, cls) {
|
7398 | if (el._transitionClasses) {
|
7399 | remove(el._transitionClasses, cls);
|
7400 | }
|
7401 | removeClass(el, cls);
|
7402 | }
|
7403 |
|
7404 | function whenTransitionEnds (
|
7405 | el,
|
7406 | expectedType,
|
7407 | cb
|
7408 | ) {
|
7409 | var ref = getTransitionInfo(el, expectedType);
|
7410 | var type = ref.type;
|
7411 | var timeout = ref.timeout;
|
7412 | var propCount = ref.propCount;
|
7413 | if (!type) { return cb() }
|
7414 | var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
|
7415 | var ended = 0;
|
7416 | var end = function () {
|
7417 | el.removeEventListener(event, onEnd);
|
7418 | cb();
|
7419 | };
|
7420 | var onEnd = function (e) {
|
7421 | if (e.target === el) {
|
7422 | if (++ended >= propCount) {
|
7423 | end();
|
7424 | }
|
7425 | }
|
7426 | };
|
7427 | setTimeout(function () {
|
7428 | if (ended < propCount) {
|
7429 | end();
|
7430 | }
|
7431 | }, timeout + 1);
|
7432 | el.addEventListener(event, onEnd);
|
7433 | }
|
7434 |
|
7435 | var transformRE = /\b(transform|all)(,|$)/;
|
7436 |
|
7437 | function getTransitionInfo (el, expectedType) {
|
7438 | var styles = window.getComputedStyle(el);
|
7439 |
|
7440 | var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
|
7441 | var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
|
7442 | var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
7443 | var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
|
7444 | var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
|
7445 | var animationTimeout = getTimeout(animationDelays, animationDurations);
|
7446 |
|
7447 | var type;
|
7448 | var timeout = 0;
|
7449 | var propCount = 0;
|
7450 |
|
7451 | if (expectedType === TRANSITION) {
|
7452 | if (transitionTimeout > 0) {
|
7453 | type = TRANSITION;
|
7454 | timeout = transitionTimeout;
|
7455 | propCount = transitionDurations.length;
|
7456 | }
|
7457 | } else if (expectedType === ANIMATION) {
|
7458 | if (animationTimeout > 0) {
|
7459 | type = ANIMATION;
|
7460 | timeout = animationTimeout;
|
7461 | propCount = animationDurations.length;
|
7462 | }
|
7463 | } else {
|
7464 | timeout = Math.max(transitionTimeout, animationTimeout);
|
7465 | type = timeout > 0
|
7466 | ? transitionTimeout > animationTimeout
|
7467 | ? TRANSITION
|
7468 | : ANIMATION
|
7469 | : null;
|
7470 | propCount = type
|
7471 | ? type === TRANSITION
|
7472 | ? transitionDurations.length
|
7473 | : animationDurations.length
|
7474 | : 0;
|
7475 | }
|
7476 | var hasTransform =
|
7477 | type === TRANSITION &&
|
7478 | transformRE.test(styles[transitionProp + 'Property']);
|
7479 | return {
|
7480 | type: type,
|
7481 | timeout: timeout,
|
7482 | propCount: propCount,
|
7483 | hasTransform: hasTransform
|
7484 | }
|
7485 | }
|
7486 |
|
7487 | function getTimeout (delays, durations) {
|
7488 |
|
7489 | while (delays.length < durations.length) {
|
7490 | delays = delays.concat(delays);
|
7491 | }
|
7492 |
|
7493 | return Math.max.apply(null, durations.map(function (d, i) {
|
7494 | return toMs(d) + toMs(delays[i])
|
7495 | }))
|
7496 | }
|
7497 |
|
7498 |
|
7499 |
|
7500 |
|
7501 |
|
7502 | function toMs (s) {
|
7503 | return Number(s.slice(0, -1).replace(',', '.')) * 1000
|
7504 | }
|
7505 |
|
7506 |
|
7507 |
|
7508 | function enter (vnode, toggleDisplay) {
|
7509 | var el = vnode.elm;
|
7510 |
|
7511 |
|
7512 | if (isDef(el._leaveCb)) {
|
7513 | el._leaveCb.cancelled = true;
|
7514 | el._leaveCb();
|
7515 | }
|
7516 |
|
7517 | var data = resolveTransition(vnode.data.transition);
|
7518 | if (isUndef(data)) {
|
7519 | return
|
7520 | }
|
7521 |
|
7522 |
|
7523 | if (isDef(el._enterCb) || el.nodeType !== 1) {
|
7524 | return
|
7525 | }
|
7526 |
|
7527 | var css = data.css;
|
7528 | var type = data.type;
|
7529 | var enterClass = data.enterClass;
|
7530 | var enterToClass = data.enterToClass;
|
7531 | var enterActiveClass = data.enterActiveClass;
|
7532 | var appearClass = data.appearClass;
|
7533 | var appearToClass = data.appearToClass;
|
7534 | var appearActiveClass = data.appearActiveClass;
|
7535 | var beforeEnter = data.beforeEnter;
|
7536 | var enter = data.enter;
|
7537 | var afterEnter = data.afterEnter;
|
7538 | var enterCancelled = data.enterCancelled;
|
7539 | var beforeAppear = data.beforeAppear;
|
7540 | var appear = data.appear;
|
7541 | var afterAppear = data.afterAppear;
|
7542 | var appearCancelled = data.appearCancelled;
|
7543 | var duration = data.duration;
|
7544 |
|
7545 |
|
7546 |
|
7547 |
|
7548 |
|
7549 | var context = activeInstance;
|
7550 | var transitionNode = activeInstance.$vnode;
|
7551 | while (transitionNode && transitionNode.parent) {
|
7552 | context = transitionNode.context;
|
7553 | transitionNode = transitionNode.parent;
|
7554 | }
|
7555 |
|
7556 | var isAppear = !context._isMounted || !vnode.isRootInsert;
|
7557 |
|
7558 | if (isAppear && !appear && appear !== '') {
|
7559 | return
|
7560 | }
|
7561 |
|
7562 | var startClass = isAppear && appearClass
|
7563 | ? appearClass
|
7564 | : enterClass;
|
7565 | var activeClass = isAppear && appearActiveClass
|
7566 | ? appearActiveClass
|
7567 | : enterActiveClass;
|
7568 | var toClass = isAppear && appearToClass
|
7569 | ? appearToClass
|
7570 | : enterToClass;
|
7571 |
|
7572 | var beforeEnterHook = isAppear
|
7573 | ? (beforeAppear || beforeEnter)
|
7574 | : beforeEnter;
|
7575 | var enterHook = isAppear
|
7576 | ? (typeof appear === 'function' ? appear : enter)
|
7577 | : enter;
|
7578 | var afterEnterHook = isAppear
|
7579 | ? (afterAppear || afterEnter)
|
7580 | : afterEnter;
|
7581 | var enterCancelledHook = isAppear
|
7582 | ? (appearCancelled || enterCancelled)
|
7583 | : enterCancelled;
|
7584 |
|
7585 | var explicitEnterDuration = toNumber(
|
7586 | isObject(duration)
|
7587 | ? duration.enter
|
7588 | : duration
|
7589 | );
|
7590 |
|
7591 | if (explicitEnterDuration != null) {
|
7592 | checkDuration(explicitEnterDuration, 'enter', vnode);
|
7593 | }
|
7594 |
|
7595 | var expectsCSS = css !== false && !isIE9;
|
7596 | var userWantsControl = getHookArgumentsLength(enterHook);
|
7597 |
|
7598 | var cb = el._enterCb = once(function () {
|
7599 | if (expectsCSS) {
|
7600 | removeTransitionClass(el, toClass);
|
7601 | removeTransitionClass(el, activeClass);
|
7602 | }
|
7603 | if (cb.cancelled) {
|
7604 | if (expectsCSS) {
|
7605 | removeTransitionClass(el, startClass);
|
7606 | }
|
7607 | enterCancelledHook && enterCancelledHook(el);
|
7608 | } else {
|
7609 | afterEnterHook && afterEnterHook(el);
|
7610 | }
|
7611 | el._enterCb = null;
|
7612 | });
|
7613 |
|
7614 | if (!vnode.data.show) {
|
7615 |
|
7616 | mergeVNodeHook(vnode, 'insert', function () {
|
7617 | var parent = el.parentNode;
|
7618 | var pendingNode = parent && parent._pending && parent._pending[vnode.key];
|
7619 | if (pendingNode &&
|
7620 | pendingNode.tag === vnode.tag &&
|
7621 | pendingNode.elm._leaveCb
|
7622 | ) {
|
7623 | pendingNode.elm._leaveCb();
|
7624 | }
|
7625 | enterHook && enterHook(el, cb);
|
7626 | });
|
7627 | }
|
7628 |
|
7629 |
|
7630 | beforeEnterHook && beforeEnterHook(el);
|
7631 | if (expectsCSS) {
|
7632 | addTransitionClass(el, startClass);
|
7633 | addTransitionClass(el, activeClass);
|
7634 | nextFrame(function () {
|
7635 | removeTransitionClass(el, startClass);
|
7636 | if (!cb.cancelled) {
|
7637 | addTransitionClass(el, toClass);
|
7638 | if (!userWantsControl) {
|
7639 | if (isValidDuration(explicitEnterDuration)) {
|
7640 | setTimeout(cb, explicitEnterDuration);
|
7641 | } else {
|
7642 | whenTransitionEnds(el, type, cb);
|
7643 | }
|
7644 | }
|
7645 | }
|
7646 | });
|
7647 | }
|
7648 |
|
7649 | if (vnode.data.show) {
|
7650 | toggleDisplay && toggleDisplay();
|
7651 | enterHook && enterHook(el, cb);
|
7652 | }
|
7653 |
|
7654 | if (!expectsCSS && !userWantsControl) {
|
7655 | cb();
|
7656 | }
|
7657 | }
|
7658 |
|
7659 | function leave (vnode, rm) {
|
7660 | var el = vnode.elm;
|
7661 |
|
7662 |
|
7663 | if (isDef(el._enterCb)) {
|
7664 | el._enterCb.cancelled = true;
|
7665 | el._enterCb();
|
7666 | }
|
7667 |
|
7668 | var data = resolveTransition(vnode.data.transition);
|
7669 | if (isUndef(data) || el.nodeType !== 1) {
|
7670 | return rm()
|
7671 | }
|
7672 |
|
7673 |
|
7674 | if (isDef(el._leaveCb)) {
|
7675 | return
|
7676 | }
|
7677 |
|
7678 | var css = data.css;
|
7679 | var type = data.type;
|
7680 | var leaveClass = data.leaveClass;
|
7681 | var leaveToClass = data.leaveToClass;
|
7682 | var leaveActiveClass = data.leaveActiveClass;
|
7683 | var beforeLeave = data.beforeLeave;
|
7684 | var leave = data.leave;
|
7685 | var afterLeave = data.afterLeave;
|
7686 | var leaveCancelled = data.leaveCancelled;
|
7687 | var delayLeave = data.delayLeave;
|
7688 | var duration = data.duration;
|
7689 |
|
7690 | var expectsCSS = css !== false && !isIE9;
|
7691 | var userWantsControl = getHookArgumentsLength(leave);
|
7692 |
|
7693 | var explicitLeaveDuration = toNumber(
|
7694 | isObject(duration)
|
7695 | ? duration.leave
|
7696 | : duration
|
7697 | );
|
7698 |
|
7699 | if (isDef(explicitLeaveDuration)) {
|
7700 | checkDuration(explicitLeaveDuration, 'leave', vnode);
|
7701 | }
|
7702 |
|
7703 | var cb = el._leaveCb = once(function () {
|
7704 | if (el.parentNode && el.parentNode._pending) {
|
7705 | el.parentNode._pending[vnode.key] = null;
|
7706 | }
|
7707 | if (expectsCSS) {
|
7708 | removeTransitionClass(el, leaveToClass);
|
7709 | removeTransitionClass(el, leaveActiveClass);
|
7710 | }
|
7711 | if (cb.cancelled) {
|
7712 | if (expectsCSS) {
|
7713 | removeTransitionClass(el, leaveClass);
|
7714 | }
|
7715 | leaveCancelled && leaveCancelled(el);
|
7716 | } else {
|
7717 | rm();
|
7718 | afterLeave && afterLeave(el);
|
7719 | }
|
7720 | el._leaveCb = null;
|
7721 | });
|
7722 |
|
7723 | if (delayLeave) {
|
7724 | delayLeave(performLeave);
|
7725 | } else {
|
7726 | performLeave();
|
7727 | }
|
7728 |
|
7729 | function performLeave () {
|
7730 |
|
7731 | if (cb.cancelled) {
|
7732 | return
|
7733 | }
|
7734 |
|
7735 | if (!vnode.data.show && el.parentNode) {
|
7736 | (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
|
7737 | }
|
7738 | beforeLeave && beforeLeave(el);
|
7739 | if (expectsCSS) {
|
7740 | addTransitionClass(el, leaveClass);
|
7741 | addTransitionClass(el, leaveActiveClass);
|
7742 | nextFrame(function () {
|
7743 | removeTransitionClass(el, leaveClass);
|
7744 | if (!cb.cancelled) {
|
7745 | addTransitionClass(el, leaveToClass);
|
7746 | if (!userWantsControl) {
|
7747 | if (isValidDuration(explicitLeaveDuration)) {
|
7748 | setTimeout(cb, explicitLeaveDuration);
|
7749 | } else {
|
7750 | whenTransitionEnds(el, type, cb);
|
7751 | }
|
7752 | }
|
7753 | }
|
7754 | });
|
7755 | }
|
7756 | leave && leave(el, cb);
|
7757 | if (!expectsCSS && !userWantsControl) {
|
7758 | cb();
|
7759 | }
|
7760 | }
|
7761 | }
|
7762 |
|
7763 |
|
7764 | function checkDuration (val, name, vnode) {
|
7765 | if (typeof val !== 'number') {
|
7766 | warn(
|
7767 | "<transition> explicit " + name + " duration is not a valid number - " +
|
7768 | "got " + (JSON.stringify(val)) + ".",
|
7769 | vnode.context
|
7770 | );
|
7771 | } else if (isNaN(val)) {
|
7772 | warn(
|
7773 | "<transition> explicit " + name + " duration is NaN - " +
|
7774 | 'the duration expression might be incorrect.',
|
7775 | vnode.context
|
7776 | );
|
7777 | }
|
7778 | }
|
7779 |
|
7780 | function isValidDuration (val) {
|
7781 | return typeof val === 'number' && !isNaN(val)
|
7782 | }
|
7783 |
|
7784 |
|
7785 |
|
7786 |
|
7787 |
|
7788 |
|
7789 |
|
7790 | function getHookArgumentsLength (fn) {
|
7791 | if (isUndef(fn)) {
|
7792 | return false
|
7793 | }
|
7794 | var invokerFns = fn.fns;
|
7795 | if (isDef(invokerFns)) {
|
7796 |
|
7797 | return getHookArgumentsLength(
|
7798 | Array.isArray(invokerFns)
|
7799 | ? invokerFns[0]
|
7800 | : invokerFns
|
7801 | )
|
7802 | } else {
|
7803 | return (fn._length || fn.length) > 1
|
7804 | }
|
7805 | }
|
7806 |
|
7807 | function _enter (_, vnode) {
|
7808 | if (vnode.data.show !== true) {
|
7809 | enter(vnode);
|
7810 | }
|
7811 | }
|
7812 |
|
7813 | var transition = inBrowser ? {
|
7814 | create: _enter,
|
7815 | activate: _enter,
|
7816 | remove: function remove$$1 (vnode, rm) {
|
7817 |
|
7818 | if (vnode.data.show !== true) {
|
7819 | leave(vnode, rm);
|
7820 | } else {
|
7821 | rm();
|
7822 | }
|
7823 | }
|
7824 | } : {};
|
7825 |
|
7826 | var platformModules = [
|
7827 | attrs,
|
7828 | klass,
|
7829 | events,
|
7830 | domProps,
|
7831 | style,
|
7832 | transition
|
7833 | ];
|
7834 |
|
7835 |
|
7836 |
|
7837 |
|
7838 |
|
7839 | var modules = platformModules.concat(baseModules);
|
7840 |
|
7841 | var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
|
7842 |
|
7843 |
|
7844 |
|
7845 |
|
7846 |
|
7847 |
|
7848 |
|
7849 | if (isIE9) {
|
7850 |
|
7851 | document.addEventListener('selectionchange', function () {
|
7852 | var el = document.activeElement;
|
7853 | if (el && el.vmodel) {
|
7854 | trigger(el, 'input');
|
7855 | }
|
7856 | });
|
7857 | }
|
7858 |
|
7859 | var directive = {
|
7860 | inserted: function inserted (el, binding, vnode, oldVnode) {
|
7861 | if (vnode.tag === 'select') {
|
7862 |
|
7863 | if (oldVnode.elm && !oldVnode.elm._vOptions) {
|
7864 | mergeVNodeHook(vnode, 'postpatch', function () {
|
7865 | directive.componentUpdated(el, binding, vnode);
|
7866 | });
|
7867 | } else {
|
7868 | setSelected(el, binding, vnode.context);
|
7869 | }
|
7870 | el._vOptions = [].map.call(el.options, getValue);
|
7871 | } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
|
7872 | el._vModifiers = binding.modifiers;
|
7873 | if (!binding.modifiers.lazy) {
|
7874 | el.addEventListener('compositionstart', onCompositionStart);
|
7875 | el.addEventListener('compositionend', onCompositionEnd);
|
7876 |
|
7877 |
|
7878 |
|
7879 |
|
7880 | el.addEventListener('change', onCompositionEnd);
|
7881 |
|
7882 | if (isIE9) {
|
7883 | el.vmodel = true;
|
7884 | }
|
7885 | }
|
7886 | }
|
7887 | },
|
7888 |
|
7889 | componentUpdated: function componentUpdated (el, binding, vnode) {
|
7890 | if (vnode.tag === 'select') {
|
7891 | setSelected(el, binding, vnode.context);
|
7892 |
|
7893 |
|
7894 |
|
7895 |
|
7896 | var prevOptions = el._vOptions;
|
7897 | var curOptions = el._vOptions = [].map.call(el.options, getValue);
|
7898 | if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
|
7899 |
|
7900 |
|
7901 | var needReset = el.multiple
|
7902 | ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
|
7903 | : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
|
7904 | if (needReset) {
|
7905 | trigger(el, 'change');
|
7906 | }
|
7907 | }
|
7908 | }
|
7909 | }
|
7910 | };
|
7911 |
|
7912 | function setSelected (el, binding, vm) {
|
7913 | actuallySetSelected(el, binding, vm);
|
7914 |
|
7915 | if (isIE || isEdge) {
|
7916 | setTimeout(function () {
|
7917 | actuallySetSelected(el, binding, vm);
|
7918 | }, 0);
|
7919 | }
|
7920 | }
|
7921 |
|
7922 | function actuallySetSelected (el, binding, vm) {
|
7923 | var value = binding.value;
|
7924 | var isMultiple = el.multiple;
|
7925 | if (isMultiple && !Array.isArray(value)) {
|
7926 | warn(
|
7927 | "<select multiple v-model=\"" + (binding.expression) + "\"> " +
|
7928 | "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
|
7929 | vm
|
7930 | );
|
7931 | return
|
7932 | }
|
7933 | var selected, option;
|
7934 | for (var i = 0, l = el.options.length; i < l; i++) {
|
7935 | option = el.options[i];
|
7936 | if (isMultiple) {
|
7937 | selected = looseIndexOf(value, getValue(option)) > -1;
|
7938 | if (option.selected !== selected) {
|
7939 | option.selected = selected;
|
7940 | }
|
7941 | } else {
|
7942 | if (looseEqual(getValue(option), value)) {
|
7943 | if (el.selectedIndex !== i) {
|
7944 | el.selectedIndex = i;
|
7945 | }
|
7946 | return
|
7947 | }
|
7948 | }
|
7949 | }
|
7950 | if (!isMultiple) {
|
7951 | el.selectedIndex = -1;
|
7952 | }
|
7953 | }
|
7954 |
|
7955 | function hasNoMatchingOption (value, options) {
|
7956 | return options.every(function (o) { return !looseEqual(o, value); })
|
7957 | }
|
7958 |
|
7959 | function getValue (option) {
|
7960 | return '_value' in option
|
7961 | ? option._value
|
7962 | : option.value
|
7963 | }
|
7964 |
|
7965 | function onCompositionStart (e) {
|
7966 | e.target.composing = true;
|
7967 | }
|
7968 |
|
7969 | function onCompositionEnd (e) {
|
7970 |
|
7971 | if (!e.target.composing) { return }
|
7972 | e.target.composing = false;
|
7973 | trigger(e.target, 'input');
|
7974 | }
|
7975 |
|
7976 | function trigger (el, type) {
|
7977 | var e = document.createEvent('HTMLEvents');
|
7978 | e.initEvent(type, true, true);
|
7979 | el.dispatchEvent(e);
|
7980 | }
|
7981 |
|
7982 |
|
7983 |
|
7984 |
|
7985 | function locateNode (vnode) {
|
7986 | return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
|
7987 | ? locateNode(vnode.componentInstance._vnode)
|
7988 | : vnode
|
7989 | }
|
7990 |
|
7991 | var show = {
|
7992 | bind: function bind (el, ref, vnode) {
|
7993 | var value = ref.value;
|
7994 |
|
7995 | vnode = locateNode(vnode);
|
7996 | var transition$$1 = vnode.data && vnode.data.transition;
|
7997 | var originalDisplay = el.__vOriginalDisplay =
|
7998 | el.style.display === 'none' ? '' : el.style.display;
|
7999 | if (value && transition$$1) {
|
8000 | vnode.data.show = true;
|
8001 | enter(vnode, function () {
|
8002 | el.style.display = originalDisplay;
|
8003 | });
|
8004 | } else {
|
8005 | el.style.display = value ? originalDisplay : 'none';
|
8006 | }
|
8007 | },
|
8008 |
|
8009 | update: function update (el, ref, vnode) {
|
8010 | var value = ref.value;
|
8011 | var oldValue = ref.oldValue;
|
8012 |
|
8013 |
|
8014 | if (!value === !oldValue) { return }
|
8015 | vnode = locateNode(vnode);
|
8016 | var transition$$1 = vnode.data && vnode.data.transition;
|
8017 | if (transition$$1) {
|
8018 | vnode.data.show = true;
|
8019 | if (value) {
|
8020 | enter(vnode, function () {
|
8021 | el.style.display = el.__vOriginalDisplay;
|
8022 | });
|
8023 | } else {
|
8024 | leave(vnode, function () {
|
8025 | el.style.display = 'none';
|
8026 | });
|
8027 | }
|
8028 | } else {
|
8029 | el.style.display = value ? el.__vOriginalDisplay : 'none';
|
8030 | }
|
8031 | },
|
8032 |
|
8033 | unbind: function unbind (
|
8034 | el,
|
8035 | binding,
|
8036 | vnode,
|
8037 | oldVnode,
|
8038 | isDestroy
|
8039 | ) {
|
8040 | if (!isDestroy) {
|
8041 | el.style.display = el.__vOriginalDisplay;
|
8042 | }
|
8043 | }
|
8044 | };
|
8045 |
|
8046 | var platformDirectives = {
|
8047 | model: directive,
|
8048 | show: show
|
8049 | };
|
8050 |
|
8051 |
|
8052 |
|
8053 | var transitionProps = {
|
8054 | name: String,
|
8055 | appear: Boolean,
|
8056 | css: Boolean,
|
8057 | mode: String,
|
8058 | type: String,
|
8059 | enterClass: String,
|
8060 | leaveClass: String,
|
8061 | enterToClass: String,
|
8062 | leaveToClass: String,
|
8063 | enterActiveClass: String,
|
8064 | leaveActiveClass: String,
|
8065 | appearClass: String,
|
8066 | appearActiveClass: String,
|
8067 | appearToClass: String,
|
8068 | duration: [Number, String, Object]
|
8069 | };
|
8070 |
|
8071 |
|
8072 |
|
8073 | function getRealChild (vnode) {
|
8074 | var compOptions = vnode && vnode.componentOptions;
|
8075 | if (compOptions && compOptions.Ctor.options.abstract) {
|
8076 | return getRealChild(getFirstComponentChild(compOptions.children))
|
8077 | } else {
|
8078 | return vnode
|
8079 | }
|
8080 | }
|
8081 |
|
8082 | function extractTransitionData (comp) {
|
8083 | var data = {};
|
8084 | var options = comp.$options;
|
8085 |
|
8086 | for (var key in options.propsData) {
|
8087 | data[key] = comp[key];
|
8088 | }
|
8089 |
|
8090 |
|
8091 | var listeners = options._parentListeners;
|
8092 | for (var key$1 in listeners) {
|
8093 | data[camelize(key$1)] = listeners[key$1];
|
8094 | }
|
8095 | return data
|
8096 | }
|
8097 |
|
8098 | function placeholder (h, rawChild) {
|
8099 | if (/\d-keep-alive$/.test(rawChild.tag)) {
|
8100 | return h('keep-alive', {
|
8101 | props: rawChild.componentOptions.propsData
|
8102 | })
|
8103 | }
|
8104 | }
|
8105 |
|
8106 | function hasParentTransition (vnode) {
|
8107 | while ((vnode = vnode.parent)) {
|
8108 | if (vnode.data.transition) {
|
8109 | return true
|
8110 | }
|
8111 | }
|
8112 | }
|
8113 |
|
8114 | function isSameChild (child, oldChild) {
|
8115 | return oldChild.key === child.key && oldChild.tag === child.tag
|
8116 | }
|
8117 |
|
8118 | var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
|
8119 |
|
8120 | var isVShowDirective = function (d) { return d.name === 'show'; };
|
8121 |
|
8122 | var Transition = {
|
8123 | name: 'transition',
|
8124 | props: transitionProps,
|
8125 | abstract: true,
|
8126 |
|
8127 | render: function render (h) {
|
8128 | var this$1 = this;
|
8129 |
|
8130 | var children = this.$slots.default;
|
8131 | if (!children) {
|
8132 | return
|
8133 | }
|
8134 |
|
8135 |
|
8136 | children = children.filter(isNotTextNode);
|
8137 |
|
8138 | if (!children.length) {
|
8139 | return
|
8140 | }
|
8141 |
|
8142 |
|
8143 | if (children.length > 1) {
|
8144 | warn(
|
8145 | '<transition> can only be used on a single element. Use ' +
|
8146 | '<transition-group> for lists.',
|
8147 | this.$parent
|
8148 | );
|
8149 | }
|
8150 |
|
8151 | var mode = this.mode;
|
8152 |
|
8153 |
|
8154 | if (mode && mode !== 'in-out' && mode !== 'out-in'
|
8155 | ) {
|
8156 | warn(
|
8157 | 'invalid <transition> mode: ' + mode,
|
8158 | this.$parent
|
8159 | );
|
8160 | }
|
8161 |
|
8162 | var rawChild = children[0];
|
8163 |
|
8164 |
|
8165 |
|
8166 | if (hasParentTransition(this.$vnode)) {
|
8167 | return rawChild
|
8168 | }
|
8169 |
|
8170 |
|
8171 |
|
8172 | var child = getRealChild(rawChild);
|
8173 |
|
8174 | if (!child) {
|
8175 | return rawChild
|
8176 | }
|
8177 |
|
8178 | if (this._leaving) {
|
8179 | return placeholder(h, rawChild)
|
8180 | }
|
8181 |
|
8182 |
|
8183 |
|
8184 |
|
8185 | var id = "__transition-" + (this._uid) + "-";
|
8186 | child.key = child.key == null
|
8187 | ? child.isComment
|
8188 | ? id + 'comment'
|
8189 | : id + child.tag
|
8190 | : isPrimitive(child.key)
|
8191 | ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
|
8192 | : child.key;
|
8193 |
|
8194 | var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
|
8195 | var oldRawChild = this._vnode;
|
8196 | var oldChild = getRealChild(oldRawChild);
|
8197 |
|
8198 |
|
8199 |
|
8200 | if (child.data.directives && child.data.directives.some(isVShowDirective)) {
|
8201 | child.data.show = true;
|
8202 | }
|
8203 |
|
8204 | if (
|
8205 | oldChild &&
|
8206 | oldChild.data &&
|
8207 | !isSameChild(child, oldChild) &&
|
8208 | !isAsyncPlaceholder(oldChild) &&
|
8209 |
|
8210 | !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
|
8211 | ) {
|
8212 |
|
8213 |
|
8214 | var oldData = oldChild.data.transition = extend({}, data);
|
8215 |
|
8216 | if (mode === 'out-in') {
|
8217 |
|
8218 | this._leaving = true;
|
8219 | mergeVNodeHook(oldData, 'afterLeave', function () {
|
8220 | this$1._leaving = false;
|
8221 | this$1.$forceUpdate();
|
8222 | });
|
8223 | return placeholder(h, rawChild)
|
8224 | } else if (mode === 'in-out') {
|
8225 | if (isAsyncPlaceholder(child)) {
|
8226 | return oldRawChild
|
8227 | }
|
8228 | var delayedLeave;
|
8229 | var performLeave = function () { delayedLeave(); };
|
8230 | mergeVNodeHook(data, 'afterEnter', performLeave);
|
8231 | mergeVNodeHook(data, 'enterCancelled', performLeave);
|
8232 | mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
|
8233 | }
|
8234 | }
|
8235 |
|
8236 | return rawChild
|
8237 | }
|
8238 | };
|
8239 |
|
8240 |
|
8241 |
|
8242 | var props = extend({
|
8243 | tag: String,
|
8244 | moveClass: String
|
8245 | }, transitionProps);
|
8246 |
|
8247 | delete props.mode;
|
8248 |
|
8249 | var TransitionGroup = {
|
8250 | props: props,
|
8251 |
|
8252 | beforeMount: function beforeMount () {
|
8253 | var this$1 = this;
|
8254 |
|
8255 | var update = this._update;
|
8256 | this._update = function (vnode, hydrating) {
|
8257 | var restoreActiveInstance = setActiveInstance(this$1);
|
8258 |
|
8259 | this$1.__patch__(
|
8260 | this$1._vnode,
|
8261 | this$1.kept,
|
8262 | false,
|
8263 | true
|
8264 | );
|
8265 | this$1._vnode = this$1.kept;
|
8266 | restoreActiveInstance();
|
8267 | update.call(this$1, vnode, hydrating);
|
8268 | };
|
8269 | },
|
8270 |
|
8271 | render: function render (h) {
|
8272 | var tag = this.tag || this.$vnode.data.tag || 'span';
|
8273 | var map = Object.create(null);
|
8274 | var prevChildren = this.prevChildren = this.children;
|
8275 | var rawChildren = this.$slots.default || [];
|
8276 | var children = this.children = [];
|
8277 | var transitionData = extractTransitionData(this);
|
8278 |
|
8279 | for (var i = 0; i < rawChildren.length; i++) {
|
8280 | var c = rawChildren[i];
|
8281 | if (c.tag) {
|
8282 | if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
|
8283 | children.push(c);
|
8284 | map[c.key] = c
|
8285 | ;(c.data || (c.data = {})).transition = transitionData;
|
8286 | } else {
|
8287 | var opts = c.componentOptions;
|
8288 | var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
|
8289 | warn(("<transition-group> children must be keyed: <" + name + ">"));
|
8290 | }
|
8291 | }
|
8292 | }
|
8293 |
|
8294 | if (prevChildren) {
|
8295 | var kept = [];
|
8296 | var removed = [];
|
8297 | for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
|
8298 | var c$1 = prevChildren[i$1];
|
8299 | c$1.data.transition = transitionData;
|
8300 | c$1.data.pos = c$1.elm.getBoundingClientRect();
|
8301 | if (map[c$1.key]) {
|
8302 | kept.push(c$1);
|
8303 | } else {
|
8304 | removed.push(c$1);
|
8305 | }
|
8306 | }
|
8307 | this.kept = h(tag, null, kept);
|
8308 | this.removed = removed;
|
8309 | }
|
8310 |
|
8311 | return h(tag, null, children)
|
8312 | },
|
8313 |
|
8314 | updated: function updated () {
|
8315 | var children = this.prevChildren;
|
8316 | var moveClass = this.moveClass || ((this.name || 'v') + '-move');
|
8317 | if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
|
8318 | return
|
8319 | }
|
8320 |
|
8321 |
|
8322 |
|
8323 | children.forEach(callPendingCbs);
|
8324 | children.forEach(recordPosition);
|
8325 | children.forEach(applyTranslation);
|
8326 |
|
8327 |
|
8328 |
|
8329 |
|
8330 | this._reflow = document.body.offsetHeight;
|
8331 |
|
8332 | children.forEach(function (c) {
|
8333 | if (c.data.moved) {
|
8334 | var el = c.elm;
|
8335 | var s = el.style;
|
8336 | addTransitionClass(el, moveClass);
|
8337 | s.transform = s.WebkitTransform = s.transitionDuration = '';
|
8338 | el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
|
8339 | if (e && e.target !== el) {
|
8340 | return
|
8341 | }
|
8342 | if (!e || /transform$/.test(e.propertyName)) {
|
8343 | el.removeEventListener(transitionEndEvent, cb);
|
8344 | el._moveCb = null;
|
8345 | removeTransitionClass(el, moveClass);
|
8346 | }
|
8347 | });
|
8348 | }
|
8349 | });
|
8350 | },
|
8351 |
|
8352 | methods: {
|
8353 | hasMove: function hasMove (el, moveClass) {
|
8354 |
|
8355 | if (!hasTransition) {
|
8356 | return false
|
8357 | }
|
8358 |
|
8359 | if (this._hasMove) {
|
8360 | return this._hasMove
|
8361 | }
|
8362 |
|
8363 |
|
8364 |
|
8365 |
|
8366 |
|
8367 | var clone = el.cloneNode();
|
8368 | if (el._transitionClasses) {
|
8369 | el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
|
8370 | }
|
8371 | addClass(clone, moveClass);
|
8372 | clone.style.display = 'none';
|
8373 | this.$el.appendChild(clone);
|
8374 | var info = getTransitionInfo(clone);
|
8375 | this.$el.removeChild(clone);
|
8376 | return (this._hasMove = info.hasTransform)
|
8377 | }
|
8378 | }
|
8379 | };
|
8380 |
|
8381 | function callPendingCbs (c) {
|
8382 |
|
8383 | if (c.elm._moveCb) {
|
8384 | c.elm._moveCb();
|
8385 | }
|
8386 |
|
8387 | if (c.elm._enterCb) {
|
8388 | c.elm._enterCb();
|
8389 | }
|
8390 | }
|
8391 |
|
8392 | function recordPosition (c) {
|
8393 | c.data.newPos = c.elm.getBoundingClientRect();
|
8394 | }
|
8395 |
|
8396 | function applyTranslation (c) {
|
8397 | var oldPos = c.data.pos;
|
8398 | var newPos = c.data.newPos;
|
8399 | var dx = oldPos.left - newPos.left;
|
8400 | var dy = oldPos.top - newPos.top;
|
8401 | if (dx || dy) {
|
8402 | c.data.moved = true;
|
8403 | var s = c.elm.style;
|
8404 | s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
|
8405 | s.transitionDuration = '0s';
|
8406 | }
|
8407 | }
|
8408 |
|
8409 | var platformComponents = {
|
8410 | Transition: Transition,
|
8411 | TransitionGroup: TransitionGroup
|
8412 | };
|
8413 |
|
8414 |
|
8415 |
|
8416 |
|
8417 | Vue.config.mustUseProp = mustUseProp;
|
8418 | Vue.config.isReservedTag = isReservedTag;
|
8419 | Vue.config.isReservedAttr = isReservedAttr;
|
8420 | Vue.config.getTagNamespace = getTagNamespace;
|
8421 | Vue.config.isUnknownElement = isUnknownElement;
|
8422 |
|
8423 |
|
8424 | extend(Vue.options.directives, platformDirectives);
|
8425 | extend(Vue.options.components, platformComponents);
|
8426 |
|
8427 |
|
8428 | Vue.prototype.__patch__ = inBrowser ? patch : noop;
|
8429 |
|
8430 |
|
8431 | Vue.prototype.$mount = function (
|
8432 | el,
|
8433 | hydrating
|
8434 | ) {
|
8435 | el = el && inBrowser ? query(el) : undefined;
|
8436 | return mountComponent(this, el, hydrating)
|
8437 | };
|
8438 |
|
8439 |
|
8440 |
|
8441 | if (inBrowser) {
|
8442 | setTimeout(function () {
|
8443 | if (config.devtools) {
|
8444 | if (devtools) {
|
8445 | devtools.emit('init', Vue);
|
8446 | } else {
|
8447 | console[console.info ? 'info' : 'log'](
|
8448 | 'Download the Vue Devtools extension for a better development experience:\n' +
|
8449 | 'https://github.com/vuejs/vue-devtools'
|
8450 | );
|
8451 | }
|
8452 | }
|
8453 | if (config.productionTip !== false &&
|
8454 | typeof console !== 'undefined'
|
8455 | ) {
|
8456 | console[console.info ? 'info' : 'log'](
|
8457 | "You are running Vue in development mode.\n" +
|
8458 | "Make sure to turn on production mode when deploying for production.\n" +
|
8459 | "See more tips at https://vuejs.org/guide/deployment.html"
|
8460 | );
|
8461 | }
|
8462 | }, 0);
|
8463 | }
|
8464 |
|
8465 |
|
8466 |
|
8467 | module.exports = Vue;
|