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