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