vue 2.6.2 → 2.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -5
- package/dist/vue.common.dev.js +2186 -2059
- package/dist/vue.common.prod.js +2 -2
- package/dist/vue.esm.browser.js +2193 -2066
- package/dist/vue.esm.browser.min.js +2 -2
- package/dist/vue.esm.js +2193 -2066
- package/dist/vue.js +2186 -2059
- package/dist/vue.min.js +2 -2
- package/dist/vue.runtime.common.dev.js +2112 -2043
- package/dist/vue.runtime.common.prod.js +2 -2
- package/dist/vue.runtime.esm.js +2135 -2066
- package/dist/vue.runtime.js +2112 -2043
- package/dist/vue.runtime.min.js +2 -2
- package/package.json +1 -1
- package/src/compiler/codegen/events.js +7 -1
- package/src/compiler/codegen/index.js +53 -7
- package/src/compiler/parser/index.js +10 -3
- package/src/core/instance/lifecycle.js +1 -0
- package/src/core/instance/render-helpers/index.js +1 -1
- package/src/core/instance/render-helpers/resolve-scoped-slots.js +22 -0
- package/src/core/instance/render-helpers/resolve-slots.js +0 -17
- package/src/core/instance/render.js +15 -1
- package/src/core/observer/scheduler.js +1 -1
- package/src/core/util/env.js +1 -0
- package/src/core/util/error.js +5 -1
- package/src/core/vdom/create-component.js +1 -1
- package/src/core/vdom/create-functional-component.js +9 -1
- package/src/core/vdom/helpers/normalize-scoped-slots.js +34 -11
- package/src/core/vdom/helpers/resolve-async-component.js +10 -9
- package/src/platforms/web/runtime/modules/events.js +21 -3
- package/types/vue.d.ts +1 -0
package/dist/vue.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vue.js v2.6.
|
|
2
|
+
* Vue.js v2.6.6
|
|
3
3
|
* (c) 2014-2019 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -532,6 +532,7 @@ var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android'
|
|
|
532
532
|
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
|
|
533
533
|
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
|
|
534
534
|
var isPhantomJS = UA && /phantomjs/.test(UA);
|
|
535
|
+
var isFF = UA && UA.match(/firefox\/(\d+)/);
|
|
535
536
|
|
|
536
537
|
// Firefox has a "watch" function on Object.prototype...
|
|
537
538
|
var nativeWatch = ({}).watch;
|
|
@@ -1867,7 +1868,11 @@ function globalHandleError (err, vm, info) {
|
|
|
1867
1868
|
try {
|
|
1868
1869
|
return config.errorHandler.call(null, err, vm, info)
|
|
1869
1870
|
} catch (e) {
|
|
1870
|
-
|
|
1871
|
+
// if the user intentionally throws the original error in the handler,
|
|
1872
|
+
// do not log it twice
|
|
1873
|
+
if (e !== err) {
|
|
1874
|
+
logError(e, null, 'config.errorHandler');
|
|
1875
|
+
}
|
|
1871
1876
|
}
|
|
1872
1877
|
}
|
|
1873
1878
|
logError(err, vm, info);
|
|
@@ -2408,2450 +2413,2496 @@ function normalizeArrayChildren (children, nestedIndex) {
|
|
|
2408
2413
|
|
|
2409
2414
|
/* */
|
|
2410
2415
|
|
|
2411
|
-
function
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2416
|
+
function initProvide (vm) {
|
|
2417
|
+
var provide = vm.$options.provide;
|
|
2418
|
+
if (provide) {
|
|
2419
|
+
vm._provided = typeof provide === 'function'
|
|
2420
|
+
? provide.call(vm)
|
|
2421
|
+
: provide;
|
|
2417
2422
|
}
|
|
2418
|
-
return isObject(comp)
|
|
2419
|
-
? base.extend(comp)
|
|
2420
|
-
: comp
|
|
2421
2423
|
}
|
|
2422
2424
|
|
|
2423
|
-
function
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
) {
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
baseCtor,
|
|
2439
|
-
context
|
|
2440
|
-
) {
|
|
2441
|
-
if (isTrue(factory.error) && isDef(factory.errorComp)) {
|
|
2442
|
-
return factory.errorComp
|
|
2443
|
-
}
|
|
2444
|
-
|
|
2445
|
-
if (isDef(factory.resolved)) {
|
|
2446
|
-
return factory.resolved
|
|
2447
|
-
}
|
|
2448
|
-
|
|
2449
|
-
if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
|
2450
|
-
return factory.loadingComp
|
|
2451
|
-
}
|
|
2452
|
-
|
|
2453
|
-
if (isDef(factory.contexts)) {
|
|
2454
|
-
// already pending
|
|
2455
|
-
factory.contexts.push(context);
|
|
2456
|
-
} else {
|
|
2457
|
-
var contexts = factory.contexts = [context];
|
|
2458
|
-
var sync = true;
|
|
2459
|
-
|
|
2460
|
-
var forceRender = function (renderCompleted) {
|
|
2461
|
-
for (var i = 0, l = contexts.length; i < l; i++) {
|
|
2462
|
-
contexts[i].$forceUpdate();
|
|
2463
|
-
}
|
|
2464
|
-
|
|
2465
|
-
if (renderCompleted) {
|
|
2466
|
-
contexts.length = 0;
|
|
2467
|
-
}
|
|
2468
|
-
};
|
|
2469
|
-
|
|
2470
|
-
var resolve = once(function (res) {
|
|
2471
|
-
// cache resolved
|
|
2472
|
-
factory.resolved = ensureCtor(res, baseCtor);
|
|
2473
|
-
// invoke callbacks only if this is not a synchronous resolve
|
|
2474
|
-
// (async resolves are shimmed as synchronous during SSR)
|
|
2475
|
-
if (!sync) {
|
|
2476
|
-
forceRender(true);
|
|
2425
|
+
function initInjections (vm) {
|
|
2426
|
+
var result = resolveInject(vm.$options.inject, vm);
|
|
2427
|
+
if (result) {
|
|
2428
|
+
toggleObserving(false);
|
|
2429
|
+
Object.keys(result).forEach(function (key) {
|
|
2430
|
+
/* istanbul ignore else */
|
|
2431
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2432
|
+
defineReactive$$1(vm, key, result[key], function () {
|
|
2433
|
+
warn(
|
|
2434
|
+
"Avoid mutating an injected value directly since the changes will be " +
|
|
2435
|
+
"overwritten whenever the provided component re-renders. " +
|
|
2436
|
+
"injection being mutated: \"" + key + "\"",
|
|
2437
|
+
vm
|
|
2438
|
+
);
|
|
2439
|
+
});
|
|
2477
2440
|
} else {
|
|
2478
|
-
|
|
2479
|
-
}
|
|
2480
|
-
});
|
|
2481
|
-
|
|
2482
|
-
var reject = once(function (reason) {
|
|
2483
|
-
process.env.NODE_ENV !== 'production' && warn(
|
|
2484
|
-
"Failed to resolve async component: " + (String(factory)) +
|
|
2485
|
-
(reason ? ("\nReason: " + reason) : '')
|
|
2486
|
-
);
|
|
2487
|
-
if (isDef(factory.errorComp)) {
|
|
2488
|
-
factory.error = true;
|
|
2489
|
-
forceRender(true);
|
|
2441
|
+
defineReactive$$1(vm, key, result[key]);
|
|
2490
2442
|
}
|
|
2491
2443
|
});
|
|
2444
|
+
toggleObserving(true);
|
|
2445
|
+
}
|
|
2446
|
+
}
|
|
2492
2447
|
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
}
|
|
2501
|
-
} else if (isPromise(res.component)) {
|
|
2502
|
-
res.component.then(resolve, reject);
|
|
2503
|
-
|
|
2504
|
-
if (isDef(res.error)) {
|
|
2505
|
-
factory.errorComp = ensureCtor(res.error, baseCtor);
|
|
2506
|
-
}
|
|
2448
|
+
function resolveInject (inject, vm) {
|
|
2449
|
+
if (inject) {
|
|
2450
|
+
// inject is :any because flow is not smart enough to figure out cached
|
|
2451
|
+
var result = Object.create(null);
|
|
2452
|
+
var keys = hasSymbol
|
|
2453
|
+
? Reflect.ownKeys(inject)
|
|
2454
|
+
: Object.keys(inject);
|
|
2507
2455
|
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
}, res.delay || 200);
|
|
2519
|
-
}
|
|
2456
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2457
|
+
var key = keys[i];
|
|
2458
|
+
// #6574 in case the inject object is observed...
|
|
2459
|
+
if (key === '__ob__') { continue }
|
|
2460
|
+
var provideKey = inject[key].from;
|
|
2461
|
+
var source = vm;
|
|
2462
|
+
while (source) {
|
|
2463
|
+
if (source._provided && hasOwn(source._provided, provideKey)) {
|
|
2464
|
+
result[key] = source._provided[provideKey];
|
|
2465
|
+
break
|
|
2520
2466
|
}
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
}, res.timeout);
|
|
2467
|
+
source = source.$parent;
|
|
2468
|
+
}
|
|
2469
|
+
if (!source) {
|
|
2470
|
+
if ('default' in inject[key]) {
|
|
2471
|
+
var provideDefault = inject[key].default;
|
|
2472
|
+
result[key] = typeof provideDefault === 'function'
|
|
2473
|
+
? provideDefault.call(vm)
|
|
2474
|
+
: provideDefault;
|
|
2475
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
2476
|
+
warn(("Injection \"" + key + "\" not found"), vm);
|
|
2532
2477
|
}
|
|
2533
2478
|
}
|
|
2534
2479
|
}
|
|
2535
|
-
|
|
2536
|
-
sync = false;
|
|
2537
|
-
// return in case resolved synchronously
|
|
2538
|
-
return factory.loading
|
|
2539
|
-
? factory.loadingComp
|
|
2540
|
-
: factory.resolved
|
|
2480
|
+
return result
|
|
2541
2481
|
}
|
|
2542
2482
|
}
|
|
2543
2483
|
|
|
2544
2484
|
/* */
|
|
2545
2485
|
|
|
2546
|
-
function isAsyncPlaceholder (node) {
|
|
2547
|
-
return node.isComment && node.asyncFactory
|
|
2548
|
-
}
|
|
2549
2486
|
|
|
2550
|
-
/* */
|
|
2551
2487
|
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2488
|
+
/**
|
|
2489
|
+
* Runtime helper for resolving raw children VNodes into a slot object.
|
|
2490
|
+
*/
|
|
2491
|
+
function resolveSlots (
|
|
2492
|
+
children,
|
|
2493
|
+
context
|
|
2494
|
+
) {
|
|
2495
|
+
if (!children || !children.length) {
|
|
2496
|
+
return {}
|
|
2497
|
+
}
|
|
2498
|
+
var slots = {};
|
|
2499
|
+
for (var i = 0, l = children.length; i < l; i++) {
|
|
2500
|
+
var child = children[i];
|
|
2501
|
+
var data = child.data;
|
|
2502
|
+
// remove slot attribute if the node is resolved as a Vue slot node
|
|
2503
|
+
if (data && data.attrs && data.attrs.slot) {
|
|
2504
|
+
delete data.attrs.slot;
|
|
2505
|
+
}
|
|
2506
|
+
// named slots should only be respected if the vnode was rendered in the
|
|
2507
|
+
// same context.
|
|
2508
|
+
if ((child.context === context || child.fnContext === context) &&
|
|
2509
|
+
data && data.slot != null
|
|
2510
|
+
) {
|
|
2511
|
+
var name = data.slot;
|
|
2512
|
+
var slot = (slots[name] || (slots[name] = []));
|
|
2513
|
+
if (child.tag === 'template') {
|
|
2514
|
+
slot.push.apply(slot, child.children || []);
|
|
2515
|
+
} else {
|
|
2516
|
+
slot.push(child);
|
|
2558
2517
|
}
|
|
2518
|
+
} else {
|
|
2519
|
+
(slots.default || (slots.default = [])).push(child);
|
|
2520
|
+
}
|
|
2521
|
+
}
|
|
2522
|
+
// ignore slots that contains only whitespace
|
|
2523
|
+
for (var name$1 in slots) {
|
|
2524
|
+
if (slots[name$1].every(isWhitespace)) {
|
|
2525
|
+
delete slots[name$1];
|
|
2559
2526
|
}
|
|
2560
2527
|
}
|
|
2528
|
+
return slots
|
|
2561
2529
|
}
|
|
2562
2530
|
|
|
2563
|
-
|
|
2531
|
+
function isWhitespace (node) {
|
|
2532
|
+
return (node.isComment && !node.asyncFactory) || node.text === ' '
|
|
2533
|
+
}
|
|
2564
2534
|
|
|
2565
2535
|
/* */
|
|
2566
2536
|
|
|
2567
|
-
function
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2537
|
+
function normalizeScopedSlots (
|
|
2538
|
+
slots,
|
|
2539
|
+
normalSlots,
|
|
2540
|
+
prevSlots
|
|
2541
|
+
) {
|
|
2542
|
+
var res;
|
|
2543
|
+
if (!slots) {
|
|
2544
|
+
res = {};
|
|
2545
|
+
} else if (slots._normalized) {
|
|
2546
|
+
// fast path 1: child component re-render only, parent did not change
|
|
2547
|
+
return slots._normalized
|
|
2548
|
+
} else if (
|
|
2549
|
+
slots.$stable &&
|
|
2550
|
+
prevSlots &&
|
|
2551
|
+
prevSlots !== emptyObject &&
|
|
2552
|
+
Object.keys(normalSlots).length === 0
|
|
2553
|
+
) {
|
|
2554
|
+
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
|
2555
|
+
// only need to normalize once
|
|
2556
|
+
return prevSlots
|
|
2557
|
+
} else {
|
|
2558
|
+
res = {};
|
|
2559
|
+
for (var key in slots) {
|
|
2560
|
+
if (slots[key] && key[0] !== '$') {
|
|
2561
|
+
res[key] = normalizeScopedSlot(normalSlots, key, slots[key]);
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
// expose normal slots on scopedSlots
|
|
2566
|
+
for (var key$1 in normalSlots) {
|
|
2567
|
+
if (!(key$1 in res)) {
|
|
2568
|
+
res[key$1] = proxyNormalSlot(normalSlots, key$1);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
// avoriaz seems to mock a non-extensible $scopedSlots object
|
|
2572
|
+
// and when that is passed down this would cause an error
|
|
2573
|
+
if (slots && Object.isExtensible(slots)) {
|
|
2574
|
+
(slots)._normalized = res;
|
|
2574
2575
|
}
|
|
2576
|
+
def(res, '$stable', slots ? !!slots.$stable : true);
|
|
2577
|
+
return res
|
|
2575
2578
|
}
|
|
2576
2579
|
|
|
2577
|
-
|
|
2580
|
+
function normalizeScopedSlot(normalSlots, key, fn) {
|
|
2581
|
+
var normalized = function () {
|
|
2582
|
+
var res = arguments.length ? fn.apply(null, arguments) : fn({});
|
|
2583
|
+
res = res && typeof res === 'object' && !Array.isArray(res)
|
|
2584
|
+
? [res] // single vnode
|
|
2585
|
+
: normalizeChildren(res);
|
|
2586
|
+
return res && res.length === 0
|
|
2587
|
+
? undefined
|
|
2588
|
+
: res
|
|
2589
|
+
};
|
|
2590
|
+
// this is a slot using the new v-slot syntax without scope. although it is
|
|
2591
|
+
// compiled as a scoped slot, render fn users would expect it to be present
|
|
2592
|
+
// on this.$slots because the usage is semantically a normal slot.
|
|
2593
|
+
if (fn.proxy) {
|
|
2594
|
+
Object.defineProperty(normalSlots, key, {
|
|
2595
|
+
get: normalized,
|
|
2596
|
+
enumerable: true,
|
|
2597
|
+
configurable: true
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2600
|
+
return normalized
|
|
2601
|
+
}
|
|
2578
2602
|
|
|
2579
|
-
function
|
|
2580
|
-
|
|
2581
|
-
}
|
|
2582
|
-
|
|
2583
|
-
function remove$1 (event, fn) {
|
|
2584
|
-
target.$off(event, fn);
|
|
2603
|
+
function proxyNormalSlot(slots, key) {
|
|
2604
|
+
return function () { return slots[key]; }
|
|
2585
2605
|
}
|
|
2586
2606
|
|
|
2587
|
-
|
|
2588
|
-
var _target = target;
|
|
2589
|
-
return function onceHandler () {
|
|
2590
|
-
var res = fn.apply(null, arguments);
|
|
2591
|
-
if (res !== null) {
|
|
2592
|
-
_target.$off(event, onceHandler);
|
|
2593
|
-
}
|
|
2594
|
-
}
|
|
2595
|
-
}
|
|
2607
|
+
/* */
|
|
2596
2608
|
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2609
|
+
/**
|
|
2610
|
+
* Runtime helper for rendering v-for lists.
|
|
2611
|
+
*/
|
|
2612
|
+
function renderList (
|
|
2613
|
+
val,
|
|
2614
|
+
render
|
|
2601
2615
|
) {
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
function eventsMixin (Vue) {
|
|
2608
|
-
var hookRE = /^hook:/;
|
|
2609
|
-
Vue.prototype.$on = function (event, fn) {
|
|
2610
|
-
var vm = this;
|
|
2611
|
-
if (Array.isArray(event)) {
|
|
2612
|
-
for (var i = 0, l = event.length; i < l; i++) {
|
|
2613
|
-
vm.$on(event[i], fn);
|
|
2614
|
-
}
|
|
2615
|
-
} else {
|
|
2616
|
-
(vm._events[event] || (vm._events[event] = [])).push(fn);
|
|
2617
|
-
// optimize hook:event cost by using a boolean flag marked at registration
|
|
2618
|
-
// instead of a hash lookup
|
|
2619
|
-
if (hookRE.test(event)) {
|
|
2620
|
-
vm._hasHookEvent = true;
|
|
2621
|
-
}
|
|
2622
|
-
}
|
|
2623
|
-
return vm
|
|
2624
|
-
};
|
|
2625
|
-
|
|
2626
|
-
Vue.prototype.$once = function (event, fn) {
|
|
2627
|
-
var vm = this;
|
|
2628
|
-
function on () {
|
|
2629
|
-
vm.$off(event, on);
|
|
2630
|
-
fn.apply(vm, arguments);
|
|
2631
|
-
}
|
|
2632
|
-
on.fn = fn;
|
|
2633
|
-
vm.$on(event, on);
|
|
2634
|
-
return vm
|
|
2635
|
-
};
|
|
2636
|
-
|
|
2637
|
-
Vue.prototype.$off = function (event, fn) {
|
|
2638
|
-
var vm = this;
|
|
2639
|
-
// all
|
|
2640
|
-
if (!arguments.length) {
|
|
2641
|
-
vm._events = Object.create(null);
|
|
2642
|
-
return vm
|
|
2643
|
-
}
|
|
2644
|
-
// array of events
|
|
2645
|
-
if (Array.isArray(event)) {
|
|
2646
|
-
for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
|
|
2647
|
-
vm.$off(event[i$1], fn);
|
|
2648
|
-
}
|
|
2649
|
-
return vm
|
|
2650
|
-
}
|
|
2651
|
-
// specific event
|
|
2652
|
-
var cbs = vm._events[event];
|
|
2653
|
-
if (!cbs) {
|
|
2654
|
-
return vm
|
|
2655
|
-
}
|
|
2656
|
-
if (!fn) {
|
|
2657
|
-
vm._events[event] = null;
|
|
2658
|
-
return vm
|
|
2616
|
+
var ret, i, l, keys, key;
|
|
2617
|
+
if (Array.isArray(val) || typeof val === 'string') {
|
|
2618
|
+
ret = new Array(val.length);
|
|
2619
|
+
for (i = 0, l = val.length; i < l; i++) {
|
|
2620
|
+
ret[i] = render(val[i], i);
|
|
2659
2621
|
}
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
cb = cbs[i];
|
|
2665
|
-
if (cb === fn || cb.fn === fn) {
|
|
2666
|
-
cbs.splice(i, 1);
|
|
2667
|
-
break
|
|
2668
|
-
}
|
|
2622
|
+
} else if (typeof val === 'number') {
|
|
2623
|
+
ret = new Array(val);
|
|
2624
|
+
for (i = 0; i < val; i++) {
|
|
2625
|
+
ret[i] = render(i + 1, i);
|
|
2669
2626
|
}
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
tip(
|
|
2679
|
-
"Event \"" + lowerCaseEvent + "\" is emitted in component " +
|
|
2680
|
-
(formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
|
|
2681
|
-
"Note that HTML attributes are case-insensitive and you cannot use " +
|
|
2682
|
-
"v-on to listen to camelCase events when using in-DOM templates. " +
|
|
2683
|
-
"You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
|
|
2684
|
-
);
|
|
2627
|
+
} else if (isObject(val)) {
|
|
2628
|
+
if (hasSymbol && val[Symbol.iterator]) {
|
|
2629
|
+
ret = [];
|
|
2630
|
+
var iterator = val[Symbol.iterator]();
|
|
2631
|
+
var result = iterator.next();
|
|
2632
|
+
while (!result.done) {
|
|
2633
|
+
ret.push(render(result.value, ret.length));
|
|
2634
|
+
result = iterator.next();
|
|
2685
2635
|
}
|
|
2686
|
-
}
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
for (var i = 0, l = cbs.length; i < l; i++) {
|
|
2693
|
-
invokeWithErrorHandling(cbs[i], vm, args, vm, info);
|
|
2636
|
+
} else {
|
|
2637
|
+
keys = Object.keys(val);
|
|
2638
|
+
ret = new Array(keys.length);
|
|
2639
|
+
for (i = 0, l = keys.length; i < l; i++) {
|
|
2640
|
+
key = keys[i];
|
|
2641
|
+
ret[i] = render(val[key], key, i);
|
|
2694
2642
|
}
|
|
2695
2643
|
}
|
|
2696
|
-
|
|
2697
|
-
|
|
2644
|
+
}
|
|
2645
|
+
if (!isDef(ret)) {
|
|
2646
|
+
ret = [];
|
|
2647
|
+
}
|
|
2648
|
+
(ret)._isVList = true;
|
|
2649
|
+
return ret
|
|
2698
2650
|
}
|
|
2699
2651
|
|
|
2700
2652
|
/* */
|
|
2701
2653
|
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
2654
|
/**
|
|
2705
|
-
* Runtime helper for
|
|
2655
|
+
* Runtime helper for rendering <slot>
|
|
2706
2656
|
*/
|
|
2707
|
-
function
|
|
2708
|
-
|
|
2709
|
-
|
|
2657
|
+
function renderSlot (
|
|
2658
|
+
name,
|
|
2659
|
+
fallback,
|
|
2660
|
+
props,
|
|
2661
|
+
bindObject
|
|
2710
2662
|
) {
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
}
|
|
2722
|
-
// named slots should only be respected if the vnode was rendered in the
|
|
2723
|
-
// same context.
|
|
2724
|
-
if ((child.context === context || child.fnContext === context) &&
|
|
2725
|
-
data && data.slot != null
|
|
2726
|
-
) {
|
|
2727
|
-
var name = data.slot;
|
|
2728
|
-
var slot = (slots[name] || (slots[name] = []));
|
|
2729
|
-
if (child.tag === 'template') {
|
|
2730
|
-
slot.push.apply(slot, child.children || []);
|
|
2731
|
-
} else {
|
|
2732
|
-
slot.push(child);
|
|
2663
|
+
var scopedSlotFn = this.$scopedSlots[name];
|
|
2664
|
+
var nodes;
|
|
2665
|
+
if (scopedSlotFn) { // scoped slot
|
|
2666
|
+
props = props || {};
|
|
2667
|
+
if (bindObject) {
|
|
2668
|
+
if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
|
|
2669
|
+
warn(
|
|
2670
|
+
'slot v-bind without argument expects an Object',
|
|
2671
|
+
this
|
|
2672
|
+
);
|
|
2733
2673
|
}
|
|
2734
|
-
|
|
2735
|
-
(slots.default || (slots.default = [])).push(child);
|
|
2674
|
+
props = extend(extend({}, bindObject), props);
|
|
2736
2675
|
}
|
|
2676
|
+
nodes = scopedSlotFn(props) || fallback;
|
|
2677
|
+
} else {
|
|
2678
|
+
nodes = this.$slots[name] || fallback;
|
|
2737
2679
|
}
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2680
|
+
|
|
2681
|
+
var target = props && props.slot;
|
|
2682
|
+
if (target) {
|
|
2683
|
+
return this.$createElement('template', { slot: target }, nodes)
|
|
2684
|
+
} else {
|
|
2685
|
+
return nodes
|
|
2743
2686
|
}
|
|
2744
|
-
return slots
|
|
2745
2687
|
}
|
|
2746
2688
|
|
|
2747
|
-
|
|
2748
|
-
return (node.isComment && !node.asyncFactory) || node.text === ' '
|
|
2749
|
-
}
|
|
2689
|
+
/* */
|
|
2750
2690
|
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
)
|
|
2756
|
-
res = res || { $stable: !hasDynamicKeys };
|
|
2757
|
-
for (var i = 0; i < fns.length; i++) {
|
|
2758
|
-
var slot = fns[i];
|
|
2759
|
-
if (Array.isArray(slot)) {
|
|
2760
|
-
resolveScopedSlots(slot, hasDynamicKeys, res);
|
|
2761
|
-
} else if (slot) {
|
|
2762
|
-
res[slot.key] = slot.fn;
|
|
2763
|
-
}
|
|
2764
|
-
}
|
|
2765
|
-
return res
|
|
2691
|
+
/**
|
|
2692
|
+
* Runtime helper for resolving filters
|
|
2693
|
+
*/
|
|
2694
|
+
function resolveFilter (id) {
|
|
2695
|
+
return resolveAsset(this.$options, 'filters', id, true) || identity
|
|
2766
2696
|
}
|
|
2767
2697
|
|
|
2768
2698
|
/* */
|
|
2769
2699
|
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
activeInstance = vm;
|
|
2776
|
-
return function () {
|
|
2777
|
-
activeInstance = prevActiveInstance;
|
|
2700
|
+
function isKeyNotMatch (expect, actual) {
|
|
2701
|
+
if (Array.isArray(expect)) {
|
|
2702
|
+
return expect.indexOf(actual) === -1
|
|
2703
|
+
} else {
|
|
2704
|
+
return expect !== actual
|
|
2778
2705
|
}
|
|
2779
2706
|
}
|
|
2780
2707
|
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2708
|
+
/**
|
|
2709
|
+
* Runtime helper for checking keyCodes from config.
|
|
2710
|
+
* exposed as Vue.prototype._k
|
|
2711
|
+
* passing in eventKeyName as last argument separately for backwards compat
|
|
2712
|
+
*/
|
|
2713
|
+
function checkKeyCodes (
|
|
2714
|
+
eventKeyCode,
|
|
2715
|
+
key,
|
|
2716
|
+
builtInKeyCode,
|
|
2717
|
+
eventKeyName,
|
|
2718
|
+
builtInKeyName
|
|
2719
|
+
) {
|
|
2720
|
+
var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
|
|
2721
|
+
if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
|
|
2722
|
+
return isKeyNotMatch(builtInKeyName, eventKeyName)
|
|
2723
|
+
} else if (mappedKeyCode) {
|
|
2724
|
+
return isKeyNotMatch(mappedKeyCode, eventKeyCode)
|
|
2725
|
+
} else if (eventKeyName) {
|
|
2726
|
+
return hyphenate(eventKeyName) !== key
|
|
2791
2727
|
}
|
|
2728
|
+
}
|
|
2792
2729
|
|
|
2793
|
-
|
|
2794
|
-
vm.$root = parent ? parent.$root : vm;
|
|
2730
|
+
/* */
|
|
2795
2731
|
|
|
2796
|
-
|
|
2797
|
-
|
|
2732
|
+
/**
|
|
2733
|
+
* Runtime helper for merging v-bind="object" into a VNode's data.
|
|
2734
|
+
*/
|
|
2735
|
+
function bindObjectProps (
|
|
2736
|
+
data,
|
|
2737
|
+
tag,
|
|
2738
|
+
value,
|
|
2739
|
+
asProp,
|
|
2740
|
+
isSync
|
|
2741
|
+
) {
|
|
2742
|
+
if (value) {
|
|
2743
|
+
if (!isObject(value)) {
|
|
2744
|
+
process.env.NODE_ENV !== 'production' && warn(
|
|
2745
|
+
'v-bind without argument expects an Object or Array value',
|
|
2746
|
+
this
|
|
2747
|
+
);
|
|
2748
|
+
} else {
|
|
2749
|
+
if (Array.isArray(value)) {
|
|
2750
|
+
value = toObject(value);
|
|
2751
|
+
}
|
|
2752
|
+
var hash;
|
|
2753
|
+
var loop = function ( key ) {
|
|
2754
|
+
if (
|
|
2755
|
+
key === 'class' ||
|
|
2756
|
+
key === 'style' ||
|
|
2757
|
+
isReservedAttribute(key)
|
|
2758
|
+
) {
|
|
2759
|
+
hash = data;
|
|
2760
|
+
} else {
|
|
2761
|
+
var type = data.attrs && data.attrs.type;
|
|
2762
|
+
hash = asProp || config.mustUseProp(tag, type, key)
|
|
2763
|
+
? data.domProps || (data.domProps = {})
|
|
2764
|
+
: data.attrs || (data.attrs = {});
|
|
2765
|
+
}
|
|
2766
|
+
var camelizedKey = camelize(key);
|
|
2767
|
+
if (!(key in hash) && !(camelizedKey in hash)) {
|
|
2768
|
+
hash[key] = value[key];
|
|
2798
2769
|
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
}
|
|
2770
|
+
if (isSync) {
|
|
2771
|
+
var on = data.on || (data.on = {});
|
|
2772
|
+
on[("update:" + camelizedKey)] = function ($event) {
|
|
2773
|
+
value[key] = $event;
|
|
2774
|
+
};
|
|
2775
|
+
}
|
|
2776
|
+
}
|
|
2777
|
+
};
|
|
2806
2778
|
|
|
2807
|
-
|
|
2808
|
-
Vue.prototype._update = function (vnode, hydrating) {
|
|
2809
|
-
var vm = this;
|
|
2810
|
-
var prevEl = vm.$el;
|
|
2811
|
-
var prevVnode = vm._vnode;
|
|
2812
|
-
var restoreActiveInstance = setActiveInstance(vm);
|
|
2813
|
-
vm._vnode = vnode;
|
|
2814
|
-
// Vue.prototype.__patch__ is injected in entry points
|
|
2815
|
-
// based on the rendering backend used.
|
|
2816
|
-
if (!prevVnode) {
|
|
2817
|
-
// initial render
|
|
2818
|
-
vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
|
|
2819
|
-
} else {
|
|
2820
|
-
// updates
|
|
2821
|
-
vm.$el = vm.__patch__(prevVnode, vnode);
|
|
2822
|
-
}
|
|
2823
|
-
restoreActiveInstance();
|
|
2824
|
-
// update __vue__ reference
|
|
2825
|
-
if (prevEl) {
|
|
2826
|
-
prevEl.__vue__ = null;
|
|
2827
|
-
}
|
|
2828
|
-
if (vm.$el) {
|
|
2829
|
-
vm.$el.__vue__ = vm;
|
|
2830
|
-
}
|
|
2831
|
-
// if parent is an HOC, update its $el as well
|
|
2832
|
-
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
|
2833
|
-
vm.$parent.$el = vm.$el;
|
|
2779
|
+
for (var key in value) loop( key );
|
|
2834
2780
|
}
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2781
|
+
}
|
|
2782
|
+
return data
|
|
2783
|
+
}
|
|
2838
2784
|
|
|
2839
|
-
|
|
2840
|
-
var vm = this;
|
|
2841
|
-
if (vm._watcher) {
|
|
2842
|
-
vm._watcher.update();
|
|
2843
|
-
}
|
|
2844
|
-
};
|
|
2785
|
+
/* */
|
|
2845
2786
|
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
if (vm._data.__ob__) {
|
|
2869
|
-
vm._data.__ob__.vmCount--;
|
|
2870
|
-
}
|
|
2871
|
-
// call the last hook...
|
|
2872
|
-
vm._isDestroyed = true;
|
|
2873
|
-
// invoke destroy hooks on current rendered tree
|
|
2874
|
-
vm.__patch__(vm._vnode, null);
|
|
2875
|
-
// fire destroyed hook
|
|
2876
|
-
callHook(vm, 'destroyed');
|
|
2877
|
-
// turn off all instance listeners.
|
|
2878
|
-
vm.$off();
|
|
2879
|
-
// remove __vue__ reference
|
|
2880
|
-
if (vm.$el) {
|
|
2881
|
-
vm.$el.__vue__ = null;
|
|
2882
|
-
}
|
|
2883
|
-
// release circular reference (#6759)
|
|
2884
|
-
if (vm.$vnode) {
|
|
2885
|
-
vm.$vnode.parent = null;
|
|
2886
|
-
}
|
|
2887
|
-
};
|
|
2787
|
+
/**
|
|
2788
|
+
* Runtime helper for rendering static trees.
|
|
2789
|
+
*/
|
|
2790
|
+
function renderStatic (
|
|
2791
|
+
index,
|
|
2792
|
+
isInFor
|
|
2793
|
+
) {
|
|
2794
|
+
var cached = this._staticTrees || (this._staticTrees = []);
|
|
2795
|
+
var tree = cached[index];
|
|
2796
|
+
// if has already-rendered static tree and not inside v-for,
|
|
2797
|
+
// we can reuse the same tree.
|
|
2798
|
+
if (tree && !isInFor) {
|
|
2799
|
+
return tree
|
|
2800
|
+
}
|
|
2801
|
+
// otherwise, render a fresh tree.
|
|
2802
|
+
tree = cached[index] = this.$options.staticRenderFns[index].call(
|
|
2803
|
+
this._renderProxy,
|
|
2804
|
+
null,
|
|
2805
|
+
this // for render fns generated for functional component templates
|
|
2806
|
+
);
|
|
2807
|
+
markStatic(tree, ("__static__" + index), false);
|
|
2808
|
+
return tree
|
|
2888
2809
|
}
|
|
2889
2810
|
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2811
|
+
/**
|
|
2812
|
+
* Runtime helper for v-once.
|
|
2813
|
+
* Effectively it means marking the node as static with a unique key.
|
|
2814
|
+
*/
|
|
2815
|
+
function markOnce (
|
|
2816
|
+
tree,
|
|
2817
|
+
index,
|
|
2818
|
+
key
|
|
2894
2819
|
) {
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
);
|
|
2908
|
-
} else {
|
|
2909
|
-
warn(
|
|
2910
|
-
'Failed to mount component: template or render function not defined.',
|
|
2911
|
-
vm
|
|
2912
|
-
);
|
|
2820
|
+
markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
|
|
2821
|
+
return tree
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
function markStatic (
|
|
2825
|
+
tree,
|
|
2826
|
+
key,
|
|
2827
|
+
isOnce
|
|
2828
|
+
) {
|
|
2829
|
+
if (Array.isArray(tree)) {
|
|
2830
|
+
for (var i = 0; i < tree.length; i++) {
|
|
2831
|
+
if (tree[i] && typeof tree[i] !== 'string') {
|
|
2832
|
+
markStaticNode(tree[i], (key + "_" + i), isOnce);
|
|
2913
2833
|
}
|
|
2914
2834
|
}
|
|
2835
|
+
} else {
|
|
2836
|
+
markStaticNode(tree, key, isOnce);
|
|
2915
2837
|
}
|
|
2916
|
-
|
|
2838
|
+
}
|
|
2917
2839
|
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
var id = vm._uid;
|
|
2924
|
-
var startTag = "vue-perf-start:" + id;
|
|
2925
|
-
var endTag = "vue-perf-end:" + id;
|
|
2840
|
+
function markStaticNode (node, key, isOnce) {
|
|
2841
|
+
node.isStatic = true;
|
|
2842
|
+
node.key = key;
|
|
2843
|
+
node.isOnce = isOnce;
|
|
2844
|
+
}
|
|
2926
2845
|
|
|
2927
|
-
|
|
2928
|
-
var vnode = vm._render();
|
|
2929
|
-
mark(endTag);
|
|
2930
|
-
measure(("vue " + name + " render"), startTag, endTag);
|
|
2846
|
+
/* */
|
|
2931
2847
|
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2848
|
+
function bindObjectListeners (data, value) {
|
|
2849
|
+
if (value) {
|
|
2850
|
+
if (!isPlainObject(value)) {
|
|
2851
|
+
process.env.NODE_ENV !== 'production' && warn(
|
|
2852
|
+
'v-on without argument expects an Object value',
|
|
2853
|
+
this
|
|
2854
|
+
);
|
|
2855
|
+
} else {
|
|
2856
|
+
var on = data.on = data.on ? extend({}, data.on) : {};
|
|
2857
|
+
for (var key in value) {
|
|
2858
|
+
var existing = on[key];
|
|
2859
|
+
var ours = value[key];
|
|
2860
|
+
on[key] = existing ? [].concat(existing, ours) : ours;
|
|
2861
|
+
}
|
|
2862
|
+
}
|
|
2941
2863
|
}
|
|
2864
|
+
return data
|
|
2865
|
+
}
|
|
2942
2866
|
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2867
|
+
/* */
|
|
2868
|
+
|
|
2869
|
+
function resolveScopedSlots (
|
|
2870
|
+
fns, // see flow/vnode
|
|
2871
|
+
hasDynamicKeys,
|
|
2872
|
+
res
|
|
2873
|
+
) {
|
|
2874
|
+
res = res || { $stable: !hasDynamicKeys };
|
|
2875
|
+
for (var i = 0; i < fns.length; i++) {
|
|
2876
|
+
var slot = fns[i];
|
|
2877
|
+
if (Array.isArray(slot)) {
|
|
2878
|
+
resolveScopedSlots(slot, hasDynamicKeys, res);
|
|
2879
|
+
} else if (slot) {
|
|
2880
|
+
// marker for reverse proxying v-slot without scope on this.$slots
|
|
2881
|
+
if (slot.proxy) {
|
|
2882
|
+
slot.fn.proxy = true;
|
|
2950
2883
|
}
|
|
2884
|
+
res[slot.key] = slot.fn;
|
|
2951
2885
|
}
|
|
2952
|
-
}
|
|
2953
|
-
|
|
2886
|
+
}
|
|
2887
|
+
return res
|
|
2888
|
+
}
|
|
2954
2889
|
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2890
|
+
/* */
|
|
2891
|
+
|
|
2892
|
+
function bindDynamicKeys (baseObj, values) {
|
|
2893
|
+
for (var i = 0; i < values.length; i += 2) {
|
|
2894
|
+
var key = values[i];
|
|
2895
|
+
if (typeof key === 'string' && key) {
|
|
2896
|
+
baseObj[values[i]] = values[i + 1];
|
|
2897
|
+
} else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
|
|
2898
|
+
// null is a speical value for explicitly removing a binding
|
|
2899
|
+
warn(
|
|
2900
|
+
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
|
2901
|
+
this
|
|
2902
|
+
);
|
|
2903
|
+
}
|
|
2960
2904
|
}
|
|
2961
|
-
return
|
|
2905
|
+
return baseObj
|
|
2962
2906
|
}
|
|
2963
2907
|
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2908
|
+
// helper to dynamically append modifier runtime markers to event names.
|
|
2909
|
+
// ensure only append when value is already string, otherwise it will be cast
|
|
2910
|
+
// to string and cause the type check to miss.
|
|
2911
|
+
function prependModifier (value, symbol) {
|
|
2912
|
+
return typeof value === 'string' ? symbol + value : value
|
|
2913
|
+
}
|
|
2914
|
+
|
|
2915
|
+
/* */
|
|
2916
|
+
|
|
2917
|
+
function installRenderHelpers (target) {
|
|
2918
|
+
target._o = markOnce;
|
|
2919
|
+
target._n = toNumber;
|
|
2920
|
+
target._s = toString;
|
|
2921
|
+
target._l = renderList;
|
|
2922
|
+
target._t = renderSlot;
|
|
2923
|
+
target._q = looseEqual;
|
|
2924
|
+
target._i = looseIndexOf;
|
|
2925
|
+
target._m = renderStatic;
|
|
2926
|
+
target._f = resolveFilter;
|
|
2927
|
+
target._k = checkKeyCodes;
|
|
2928
|
+
target._b = bindObjectProps;
|
|
2929
|
+
target._v = createTextVNode;
|
|
2930
|
+
target._e = createEmptyVNode;
|
|
2931
|
+
target._u = resolveScopedSlots;
|
|
2932
|
+
target._g = bindObjectListeners;
|
|
2933
|
+
target._d = bindDynamicKeys;
|
|
2934
|
+
target._p = prependModifier;
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
/* */
|
|
2938
|
+
|
|
2939
|
+
function FunctionalRenderContext (
|
|
2940
|
+
data,
|
|
2941
|
+
props,
|
|
2942
|
+
children,
|
|
2943
|
+
parent,
|
|
2944
|
+
Ctor
|
|
2970
2945
|
) {
|
|
2971
|
-
|
|
2972
|
-
|
|
2946
|
+
var this$1 = this;
|
|
2947
|
+
|
|
2948
|
+
var options = Ctor.options;
|
|
2949
|
+
// ensure the createElement function in functional components
|
|
2950
|
+
// gets a unique context - this is necessary for correct named slot check
|
|
2951
|
+
var contextVm;
|
|
2952
|
+
if (hasOwn(parent, '_uid')) {
|
|
2953
|
+
contextVm = Object.create(parent);
|
|
2954
|
+
// $flow-disable-line
|
|
2955
|
+
contextVm._original = parent;
|
|
2956
|
+
} else {
|
|
2957
|
+
// the context vm passed in is a functional context as well.
|
|
2958
|
+
// in this case we want to make sure we are able to get a hold to the
|
|
2959
|
+
// real context instance.
|
|
2960
|
+
contextVm = parent;
|
|
2961
|
+
// $flow-disable-line
|
|
2962
|
+
parent = parent._original;
|
|
2973
2963
|
}
|
|
2964
|
+
var isCompiled = isTrue(options._compiled);
|
|
2965
|
+
var needNormalization = !isCompiled;
|
|
2974
2966
|
|
|
2975
|
-
|
|
2976
|
-
|
|
2967
|
+
this.data = data;
|
|
2968
|
+
this.props = props;
|
|
2969
|
+
this.children = children;
|
|
2970
|
+
this.parent = parent;
|
|
2971
|
+
this.listeners = data.on || emptyObject;
|
|
2972
|
+
this.injections = resolveInject(options.inject, parent);
|
|
2973
|
+
this.slots = function () {
|
|
2974
|
+
if (!this$1.$slots) {
|
|
2975
|
+
normalizeScopedSlots(
|
|
2976
|
+
data.scopedSlots,
|
|
2977
|
+
this$1.$slots = resolveSlots(children, parent)
|
|
2978
|
+
);
|
|
2979
|
+
}
|
|
2980
|
+
return this$1.$slots
|
|
2981
|
+
};
|
|
2977
2982
|
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
);
|
|
2985
|
-
// Any static slot children from the parent may have changed during parent's
|
|
2986
|
-
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
|
2987
|
-
// update is necessary to ensure correctness.
|
|
2988
|
-
var needsForceUpdate = !!(
|
|
2989
|
-
renderChildren || // has new static slots
|
|
2990
|
-
vm.$options._renderChildren || // has old static slots
|
|
2991
|
-
hasDynamicScopedSlot
|
|
2992
|
-
);
|
|
2983
|
+
Object.defineProperty(this, 'scopedSlots', ({
|
|
2984
|
+
enumerable: true,
|
|
2985
|
+
get: function get () {
|
|
2986
|
+
return normalizeScopedSlots(data.scopedSlots, this.slots())
|
|
2987
|
+
}
|
|
2988
|
+
}));
|
|
2993
2989
|
|
|
2994
|
-
|
|
2995
|
-
|
|
2990
|
+
// support for compiled functional template
|
|
2991
|
+
if (isCompiled) {
|
|
2992
|
+
// exposing $options for renderStatic()
|
|
2993
|
+
this.$options = options;
|
|
2994
|
+
// pre-resolve slots for renderSlot()
|
|
2995
|
+
this.$slots = this.slots();
|
|
2996
|
+
this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
|
|
2997
|
+
}
|
|
2996
2998
|
|
|
2997
|
-
if (
|
|
2998
|
-
|
|
2999
|
+
if (options._scopeId) {
|
|
3000
|
+
this._c = function (a, b, c, d) {
|
|
3001
|
+
var vnode = createElement(contextVm, a, b, c, d, needNormalization);
|
|
3002
|
+
if (vnode && !Array.isArray(vnode)) {
|
|
3003
|
+
vnode.fnScopeId = options._scopeId;
|
|
3004
|
+
vnode.fnContext = parent;
|
|
3005
|
+
}
|
|
3006
|
+
return vnode
|
|
3007
|
+
};
|
|
3008
|
+
} else {
|
|
3009
|
+
this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
|
|
2999
3010
|
}
|
|
3000
|
-
|
|
3011
|
+
}
|
|
3001
3012
|
|
|
3002
|
-
|
|
3003
|
-
// these are also reactive so they may trigger child update if the child
|
|
3004
|
-
// used them during render
|
|
3005
|
-
vm.$attrs = parentVnode.data.attrs || emptyObject;
|
|
3006
|
-
vm.$listeners = listeners || emptyObject;
|
|
3013
|
+
installRenderHelpers(FunctionalRenderContext.prototype);
|
|
3007
3014
|
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3015
|
+
function createFunctionalComponent (
|
|
3016
|
+
Ctor,
|
|
3017
|
+
propsData,
|
|
3018
|
+
data,
|
|
3019
|
+
contextVm,
|
|
3020
|
+
children
|
|
3021
|
+
) {
|
|
3022
|
+
var options = Ctor.options;
|
|
3023
|
+
var props = {};
|
|
3024
|
+
var propOptions = options.props;
|
|
3025
|
+
if (isDef(propOptions)) {
|
|
3026
|
+
for (var key in propOptions) {
|
|
3027
|
+
props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
|
3017
3028
|
}
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3029
|
+
} else {
|
|
3030
|
+
if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
|
|
3031
|
+
if (isDef(data.props)) { mergeProps(props, data.props); }
|
|
3021
3032
|
}
|
|
3022
3033
|
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3034
|
+
var renderContext = new FunctionalRenderContext(
|
|
3035
|
+
data,
|
|
3036
|
+
props,
|
|
3037
|
+
children,
|
|
3038
|
+
contextVm,
|
|
3039
|
+
Ctor
|
|
3040
|
+
);
|
|
3028
3041
|
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3042
|
+
var vnode = options.render.call(null, renderContext._c, renderContext);
|
|
3043
|
+
|
|
3044
|
+
if (vnode instanceof VNode) {
|
|
3045
|
+
return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
|
|
3046
|
+
} else if (Array.isArray(vnode)) {
|
|
3047
|
+
var vnodes = normalizeChildren(vnode) || [];
|
|
3048
|
+
var res = new Array(vnodes.length);
|
|
3049
|
+
for (var i = 0; i < vnodes.length; i++) {
|
|
3050
|
+
res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
|
|
3051
|
+
}
|
|
3052
|
+
return res
|
|
3033
3053
|
}
|
|
3054
|
+
}
|
|
3034
3055
|
|
|
3056
|
+
function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
|
|
3057
|
+
// #7817 clone node before setting fnContext, otherwise if the node is reused
|
|
3058
|
+
// (e.g. it was from a cached normal slot) the fnContext causes named slots
|
|
3059
|
+
// that should not be matched to match.
|
|
3060
|
+
var clone = cloneVNode(vnode);
|
|
3061
|
+
clone.fnContext = contextVm;
|
|
3062
|
+
clone.fnOptions = options;
|
|
3035
3063
|
if (process.env.NODE_ENV !== 'production') {
|
|
3036
|
-
|
|
3064
|
+
(clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
|
|
3037
3065
|
}
|
|
3066
|
+
if (data.slot) {
|
|
3067
|
+
(clone.data || (clone.data = {})).slot = data.slot;
|
|
3068
|
+
}
|
|
3069
|
+
return clone
|
|
3038
3070
|
}
|
|
3039
3071
|
|
|
3040
|
-
function
|
|
3041
|
-
|
|
3042
|
-
|
|
3072
|
+
function mergeProps (to, from) {
|
|
3073
|
+
for (var key in from) {
|
|
3074
|
+
to[camelize(key)] = from[key];
|
|
3043
3075
|
}
|
|
3044
|
-
return false
|
|
3045
3076
|
}
|
|
3046
3077
|
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3078
|
+
/* */
|
|
3079
|
+
|
|
3080
|
+
/* */
|
|
3081
|
+
|
|
3082
|
+
/* */
|
|
3083
|
+
|
|
3084
|
+
/* */
|
|
3085
|
+
|
|
3086
|
+
// inline hooks to be invoked on component VNodes during patch
|
|
3087
|
+
var componentVNodeHooks = {
|
|
3088
|
+
init: function init (vnode, hydrating) {
|
|
3089
|
+
if (
|
|
3090
|
+
vnode.componentInstance &&
|
|
3091
|
+
!vnode.componentInstance._isDestroyed &&
|
|
3092
|
+
vnode.data.keepAlive
|
|
3093
|
+
) {
|
|
3094
|
+
// kept-alive components, treat as a patch
|
|
3095
|
+
var mountedNode = vnode; // work around flow
|
|
3096
|
+
componentVNodeHooks.prepatch(mountedNode, mountedNode);
|
|
3097
|
+
} else {
|
|
3098
|
+
var child = vnode.componentInstance = createComponentInstanceForVnode(
|
|
3099
|
+
vnode,
|
|
3100
|
+
activeInstance
|
|
3101
|
+
);
|
|
3102
|
+
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
|
3060
3103
|
}
|
|
3061
|
-
|
|
3062
|
-
}
|
|
3063
|
-
}
|
|
3104
|
+
},
|
|
3064
3105
|
|
|
3065
|
-
function
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3106
|
+
prepatch: function prepatch (oldVnode, vnode) {
|
|
3107
|
+
var options = vnode.componentOptions;
|
|
3108
|
+
var child = vnode.componentInstance = oldVnode.componentInstance;
|
|
3109
|
+
updateChildComponent(
|
|
3110
|
+
child,
|
|
3111
|
+
options.propsData, // updated props
|
|
3112
|
+
options.listeners, // updated listeners
|
|
3113
|
+
vnode, // new parent vnode
|
|
3114
|
+
options.children // new children
|
|
3115
|
+
);
|
|
3116
|
+
},
|
|
3117
|
+
|
|
3118
|
+
insert: function insert (vnode) {
|
|
3119
|
+
var context = vnode.context;
|
|
3120
|
+
var componentInstance = vnode.componentInstance;
|
|
3121
|
+
if (!componentInstance._isMounted) {
|
|
3122
|
+
componentInstance._isMounted = true;
|
|
3123
|
+
callHook(componentInstance, 'mounted');
|
|
3070
3124
|
}
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3125
|
+
if (vnode.data.keepAlive) {
|
|
3126
|
+
if (context._isMounted) {
|
|
3127
|
+
// vue-router#1212
|
|
3128
|
+
// During updates, a kept-alive component's child components may
|
|
3129
|
+
// change, so directly walking the tree here may call activated hooks
|
|
3130
|
+
// on incorrect children. Instead we push them into a queue which will
|
|
3131
|
+
// be processed after the whole patch process ended.
|
|
3132
|
+
queueActivatedComponent(componentInstance);
|
|
3133
|
+
} else {
|
|
3134
|
+
activateChildComponent(componentInstance, true /* direct */);
|
|
3135
|
+
}
|
|
3076
3136
|
}
|
|
3077
|
-
|
|
3078
|
-
}
|
|
3079
|
-
}
|
|
3137
|
+
},
|
|
3080
3138
|
|
|
3081
|
-
function
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3139
|
+
destroy: function destroy (vnode) {
|
|
3140
|
+
var componentInstance = vnode.componentInstance;
|
|
3141
|
+
if (!componentInstance._isDestroyed) {
|
|
3142
|
+
if (!vnode.data.keepAlive) {
|
|
3143
|
+
componentInstance.$destroy();
|
|
3144
|
+
} else {
|
|
3145
|
+
deactivateChildComponent(componentInstance, true /* direct */);
|
|
3146
|
+
}
|
|
3089
3147
|
}
|
|
3090
3148
|
}
|
|
3091
|
-
|
|
3092
|
-
vm.$emit('hook:' + hook);
|
|
3093
|
-
}
|
|
3094
|
-
popTarget();
|
|
3095
|
-
}
|
|
3149
|
+
};
|
|
3096
3150
|
|
|
3097
|
-
|
|
3151
|
+
var hooksToMerge = Object.keys(componentVNodeHooks);
|
|
3098
3152
|
|
|
3099
|
-
|
|
3153
|
+
function createComponent (
|
|
3154
|
+
Ctor,
|
|
3155
|
+
data,
|
|
3156
|
+
context,
|
|
3157
|
+
children,
|
|
3158
|
+
tag
|
|
3159
|
+
) {
|
|
3160
|
+
if (isUndef(Ctor)) {
|
|
3161
|
+
return
|
|
3162
|
+
}
|
|
3100
3163
|
|
|
3101
|
-
var
|
|
3102
|
-
var activatedChildren = [];
|
|
3103
|
-
var has = {};
|
|
3104
|
-
var circular = {};
|
|
3105
|
-
var waiting = false;
|
|
3106
|
-
var flushing = false;
|
|
3107
|
-
var index = 0;
|
|
3164
|
+
var baseCtor = context.$options._base;
|
|
3108
3165
|
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
function resetSchedulerState () {
|
|
3113
|
-
index = queue.length = activatedChildren.length = 0;
|
|
3114
|
-
has = {};
|
|
3115
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3116
|
-
circular = {};
|
|
3166
|
+
// plain options object: turn it into a constructor
|
|
3167
|
+
if (isObject(Ctor)) {
|
|
3168
|
+
Ctor = baseCtor.extend(Ctor);
|
|
3117
3169
|
}
|
|
3118
|
-
waiting = flushing = false;
|
|
3119
|
-
}
|
|
3120
3170
|
|
|
3121
|
-
//
|
|
3122
|
-
//
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3171
|
+
// if at this stage it's not a constructor or an async component factory,
|
|
3172
|
+
// reject.
|
|
3173
|
+
if (typeof Ctor !== 'function') {
|
|
3174
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3175
|
+
warn(("Invalid Component definition: " + (String(Ctor))), context);
|
|
3176
|
+
}
|
|
3177
|
+
return
|
|
3178
|
+
}
|
|
3127
3179
|
|
|
3128
|
-
//
|
|
3129
|
-
var
|
|
3180
|
+
// async component
|
|
3181
|
+
var asyncFactory;
|
|
3182
|
+
if (isUndef(Ctor.cid)) {
|
|
3183
|
+
asyncFactory = Ctor;
|
|
3184
|
+
Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
|
|
3185
|
+
if (Ctor === undefined) {
|
|
3186
|
+
// return a placeholder node for async component, which is rendered
|
|
3187
|
+
// as a comment node but preserves all the raw information for the node.
|
|
3188
|
+
// the information will be used for async server-rendering and hydration.
|
|
3189
|
+
return createAsyncPlaceholder(
|
|
3190
|
+
asyncFactory,
|
|
3191
|
+
data,
|
|
3192
|
+
context,
|
|
3193
|
+
children,
|
|
3194
|
+
tag
|
|
3195
|
+
)
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3130
3198
|
|
|
3131
|
-
|
|
3132
|
-
// timestamp can either be hi-res ( relative to poge load) or low-res
|
|
3133
|
-
// (relative to UNIX epoch), so in order to compare time we have to use the
|
|
3134
|
-
// same timestamp type when saving the flush timestamp.
|
|
3135
|
-
if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
|
|
3136
|
-
// if the low-res timestamp which is bigger than the event timestamp
|
|
3137
|
-
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,
|
|
3138
|
-
// and we need to use the hi-res version for event listeners as well.
|
|
3139
|
-
getNow = function () { return performance.now(); };
|
|
3140
|
-
}
|
|
3199
|
+
data = data || {};
|
|
3141
3200
|
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
function flushSchedulerQueue () {
|
|
3146
|
-
currentFlushTimestamp = getNow();
|
|
3147
|
-
flushing = true;
|
|
3148
|
-
var watcher, id;
|
|
3201
|
+
// resolve constructor options in case global mixins are applied after
|
|
3202
|
+
// component constructor creation
|
|
3203
|
+
resolveConstructorOptions(Ctor);
|
|
3149
3204
|
|
|
3150
|
-
//
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
// 2. A component's user watchers are run before its render watcher (because
|
|
3155
|
-
// user watchers are created before the render watcher)
|
|
3156
|
-
// 3. If a component is destroyed during a parent component's watcher run,
|
|
3157
|
-
// its watchers can be skipped.
|
|
3158
|
-
queue.sort(function (a, b) { return a.id - b.id; });
|
|
3205
|
+
// transform component v-model data into props & events
|
|
3206
|
+
if (isDef(data.model)) {
|
|
3207
|
+
transformModel(Ctor.options, data);
|
|
3208
|
+
}
|
|
3159
3209
|
|
|
3160
|
-
//
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3210
|
+
// extract props
|
|
3211
|
+
var propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
|
3212
|
+
|
|
3213
|
+
// functional component
|
|
3214
|
+
if (isTrue(Ctor.options.functional)) {
|
|
3215
|
+
return createFunctionalComponent(Ctor, propsData, data, context, children)
|
|
3216
|
+
}
|
|
3217
|
+
|
|
3218
|
+
// extract listeners, since these needs to be treated as
|
|
3219
|
+
// child component listeners instead of DOM listeners
|
|
3220
|
+
var listeners = data.on;
|
|
3221
|
+
// replace with listeners with .native modifier
|
|
3222
|
+
// so it gets processed during parent component patch.
|
|
3223
|
+
data.on = data.nativeOn;
|
|
3224
|
+
|
|
3225
|
+
if (isTrue(Ctor.options.abstract)) {
|
|
3226
|
+
// abstract components do not keep anything
|
|
3227
|
+
// other than props & listeners & slot
|
|
3228
|
+
|
|
3229
|
+
// work around flow
|
|
3230
|
+
var slot = data.slot;
|
|
3231
|
+
data = {};
|
|
3232
|
+
if (slot) {
|
|
3233
|
+
data.slot = slot;
|
|
3184
3234
|
}
|
|
3185
3235
|
}
|
|
3186
3236
|
|
|
3187
|
-
//
|
|
3188
|
-
|
|
3189
|
-
var updatedQueue = queue.slice();
|
|
3237
|
+
// install component management hooks onto the placeholder node
|
|
3238
|
+
installComponentHooks(data);
|
|
3190
3239
|
|
|
3191
|
-
|
|
3240
|
+
// return a placeholder vnode
|
|
3241
|
+
var name = Ctor.options.name || tag;
|
|
3242
|
+
var vnode = new VNode(
|
|
3243
|
+
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
|
|
3244
|
+
data, undefined, undefined, undefined, context,
|
|
3245
|
+
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
|
|
3246
|
+
asyncFactory
|
|
3247
|
+
);
|
|
3192
3248
|
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
callUpdatedHooks(updatedQueue);
|
|
3249
|
+
return vnode
|
|
3250
|
+
}
|
|
3196
3251
|
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3252
|
+
function createComponentInstanceForVnode (
|
|
3253
|
+
vnode, // we know it's MountedComponentVNode but flow doesn't
|
|
3254
|
+
parent // activeInstance in lifecycle state
|
|
3255
|
+
) {
|
|
3256
|
+
var options = {
|
|
3257
|
+
_isComponent: true,
|
|
3258
|
+
_parentVnode: vnode,
|
|
3259
|
+
parent: parent
|
|
3260
|
+
};
|
|
3261
|
+
// check inline-template render functions
|
|
3262
|
+
var inlineTemplate = vnode.data.inlineTemplate;
|
|
3263
|
+
if (isDef(inlineTemplate)) {
|
|
3264
|
+
options.render = inlineTemplate.render;
|
|
3265
|
+
options.staticRenderFns = inlineTemplate.staticRenderFns;
|
|
3201
3266
|
}
|
|
3267
|
+
return new vnode.componentOptions.Ctor(options)
|
|
3202
3268
|
}
|
|
3203
3269
|
|
|
3204
|
-
function
|
|
3205
|
-
var
|
|
3206
|
-
|
|
3207
|
-
var
|
|
3208
|
-
var
|
|
3209
|
-
|
|
3210
|
-
|
|
3270
|
+
function installComponentHooks (data) {
|
|
3271
|
+
var hooks = data.hook || (data.hook = {});
|
|
3272
|
+
for (var i = 0; i < hooksToMerge.length; i++) {
|
|
3273
|
+
var key = hooksToMerge[i];
|
|
3274
|
+
var existing = hooks[key];
|
|
3275
|
+
var toMerge = componentVNodeHooks[key];
|
|
3276
|
+
if (existing !== toMerge && !(existing && existing._merged)) {
|
|
3277
|
+
hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
|
|
3211
3278
|
}
|
|
3212
3279
|
}
|
|
3213
3280
|
}
|
|
3214
3281
|
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
activatedChildren.push(vm);
|
|
3224
|
-
}
|
|
3225
|
-
|
|
3226
|
-
function callActivatedHooks (queue) {
|
|
3227
|
-
for (var i = 0; i < queue.length; i++) {
|
|
3228
|
-
queue[i]._inactive = true;
|
|
3229
|
-
activateChildComponent(queue[i], true /* true */);
|
|
3230
|
-
}
|
|
3282
|
+
function mergeHook$1 (f1, f2) {
|
|
3283
|
+
var merged = function (a, b) {
|
|
3284
|
+
// flow complains about extra args which is why we use any
|
|
3285
|
+
f1(a, b);
|
|
3286
|
+
f2(a, b);
|
|
3287
|
+
};
|
|
3288
|
+
merged._merged = true;
|
|
3289
|
+
return merged
|
|
3231
3290
|
}
|
|
3232
3291
|
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
var
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
i--;
|
|
3250
|
-
}
|
|
3251
|
-
queue.splice(i + 1, 0, watcher);
|
|
3252
|
-
}
|
|
3253
|
-
// queue the flush
|
|
3254
|
-
if (!waiting) {
|
|
3255
|
-
waiting = true;
|
|
3256
|
-
|
|
3257
|
-
if (process.env.NODE_ENV !== 'production' && !config.async) {
|
|
3258
|
-
flushSchedulerQueue();
|
|
3259
|
-
return
|
|
3260
|
-
}
|
|
3261
|
-
nextTick(flushSchedulerQueue);
|
|
3292
|
+
// transform component v-model info (value and callback) into
|
|
3293
|
+
// prop and event handler respectively.
|
|
3294
|
+
function transformModel (options, data) {
|
|
3295
|
+
var prop = (options.model && options.model.prop) || 'value';
|
|
3296
|
+
var event = (options.model && options.model.event) || 'input'
|
|
3297
|
+
;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
|
|
3298
|
+
var on = data.on || (data.on = {});
|
|
3299
|
+
var existing = on[event];
|
|
3300
|
+
var callback = data.model.callback;
|
|
3301
|
+
if (isDef(existing)) {
|
|
3302
|
+
if (
|
|
3303
|
+
Array.isArray(existing)
|
|
3304
|
+
? existing.indexOf(callback) === -1
|
|
3305
|
+
: existing !== callback
|
|
3306
|
+
) {
|
|
3307
|
+
on[event] = [callback].concat(existing);
|
|
3262
3308
|
}
|
|
3309
|
+
} else {
|
|
3310
|
+
on[event] = callback;
|
|
3263
3311
|
}
|
|
3264
3312
|
}
|
|
3265
3313
|
|
|
3266
3314
|
/* */
|
|
3267
3315
|
|
|
3316
|
+
var SIMPLE_NORMALIZE = 1;
|
|
3317
|
+
var ALWAYS_NORMALIZE = 2;
|
|
3268
3318
|
|
|
3319
|
+
// wrapper function for providing a more flexible interface
|
|
3320
|
+
// without getting yelled at by flow
|
|
3321
|
+
function createElement (
|
|
3322
|
+
context,
|
|
3323
|
+
tag,
|
|
3324
|
+
data,
|
|
3325
|
+
children,
|
|
3326
|
+
normalizationType,
|
|
3327
|
+
alwaysNormalize
|
|
3328
|
+
) {
|
|
3329
|
+
if (Array.isArray(data) || isPrimitive(data)) {
|
|
3330
|
+
normalizationType = children;
|
|
3331
|
+
children = data;
|
|
3332
|
+
data = undefined;
|
|
3333
|
+
}
|
|
3334
|
+
if (isTrue(alwaysNormalize)) {
|
|
3335
|
+
normalizationType = ALWAYS_NORMALIZE;
|
|
3336
|
+
}
|
|
3337
|
+
return _createElement(context, tag, data, children, normalizationType)
|
|
3338
|
+
}
|
|
3269
3339
|
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
*/
|
|
3277
|
-
var Watcher = function Watcher (
|
|
3278
|
-
vm,
|
|
3279
|
-
expOrFn,
|
|
3280
|
-
cb,
|
|
3281
|
-
options,
|
|
3282
|
-
isRenderWatcher
|
|
3340
|
+
function _createElement (
|
|
3341
|
+
context,
|
|
3342
|
+
tag,
|
|
3343
|
+
data,
|
|
3344
|
+
children,
|
|
3345
|
+
normalizationType
|
|
3283
3346
|
) {
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3347
|
+
if (isDef(data) && isDef((data).__ob__)) {
|
|
3348
|
+
process.env.NODE_ENV !== 'production' && warn(
|
|
3349
|
+
"Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
|
|
3350
|
+
'Always create fresh vnode data objects in each render!',
|
|
3351
|
+
context
|
|
3352
|
+
);
|
|
3353
|
+
return createEmptyVNode()
|
|
3287
3354
|
}
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
this.deep = !!options.deep;
|
|
3292
|
-
this.user = !!options.user;
|
|
3293
|
-
this.lazy = !!options.lazy;
|
|
3294
|
-
this.sync = !!options.sync;
|
|
3295
|
-
this.before = options.before;
|
|
3296
|
-
} else {
|
|
3297
|
-
this.deep = this.user = this.lazy = this.sync = false;
|
|
3355
|
+
// object syntax in v-bind
|
|
3356
|
+
if (isDef(data) && isDef(data.is)) {
|
|
3357
|
+
tag = data.is;
|
|
3298
3358
|
}
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
this.getter = expOrFn;
|
|
3313
|
-
} else {
|
|
3314
|
-
this.getter = parsePath(expOrFn);
|
|
3315
|
-
if (!this.getter) {
|
|
3316
|
-
this.getter = noop;
|
|
3317
|
-
process.env.NODE_ENV !== 'production' && warn(
|
|
3318
|
-
"Failed watching path: \"" + expOrFn + "\" " +
|
|
3319
|
-
'Watcher only accepts simple dot-delimited paths. ' +
|
|
3320
|
-
'For full control, use a function instead.',
|
|
3321
|
-
vm
|
|
3359
|
+
if (!tag) {
|
|
3360
|
+
// in case of component :is set to falsy value
|
|
3361
|
+
return createEmptyVNode()
|
|
3362
|
+
}
|
|
3363
|
+
// warn against non-primitive key
|
|
3364
|
+
if (process.env.NODE_ENV !== 'production' &&
|
|
3365
|
+
isDef(data) && isDef(data.key) && !isPrimitive(data.key)
|
|
3366
|
+
) {
|
|
3367
|
+
{
|
|
3368
|
+
warn(
|
|
3369
|
+
'Avoid using non-primitive value as key, ' +
|
|
3370
|
+
'use string/number value instead.',
|
|
3371
|
+
context
|
|
3322
3372
|
);
|
|
3323
3373
|
}
|
|
3324
3374
|
}
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3375
|
+
// support single function children as default scoped slot
|
|
3376
|
+
if (Array.isArray(children) &&
|
|
3377
|
+
typeof children[0] === 'function'
|
|
3378
|
+
) {
|
|
3379
|
+
data = data || {};
|
|
3380
|
+
data.scopedSlots = { default: children[0] };
|
|
3381
|
+
children.length = 0;
|
|
3382
|
+
}
|
|
3383
|
+
if (normalizationType === ALWAYS_NORMALIZE) {
|
|
3384
|
+
children = normalizeChildren(children);
|
|
3385
|
+
} else if (normalizationType === SIMPLE_NORMALIZE) {
|
|
3386
|
+
children = simpleNormalizeChildren(children);
|
|
3387
|
+
}
|
|
3388
|
+
var vnode, ns;
|
|
3389
|
+
if (typeof tag === 'string') {
|
|
3390
|
+
var Ctor;
|
|
3391
|
+
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
|
3392
|
+
if (config.isReservedTag(tag)) {
|
|
3393
|
+
// platform built-in elements
|
|
3394
|
+
vnode = new VNode(
|
|
3395
|
+
config.parsePlatformTagName(tag), data, children,
|
|
3396
|
+
undefined, undefined, context
|
|
3397
|
+
);
|
|
3398
|
+
} else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
|
|
3399
|
+
// component
|
|
3400
|
+
vnode = createComponent(Ctor, data, context, children, tag);
|
|
3342
3401
|
} else {
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3402
|
+
// unknown or unlisted namespaced elements
|
|
3403
|
+
// check at runtime because it may get assigned a namespace when its
|
|
3404
|
+
// parent normalizes children
|
|
3405
|
+
vnode = new VNode(
|
|
3406
|
+
tag, data, children,
|
|
3407
|
+
undefined, undefined, context
|
|
3408
|
+
);
|
|
3350
3409
|
}
|
|
3351
|
-
|
|
3352
|
-
|
|
3410
|
+
} else {
|
|
3411
|
+
// direct component options / constructor
|
|
3412
|
+
vnode = createComponent(tag, data, context, children);
|
|
3353
3413
|
}
|
|
3354
|
-
|
|
3355
|
-
|
|
3414
|
+
if (Array.isArray(vnode)) {
|
|
3415
|
+
return vnode
|
|
3416
|
+
} else if (isDef(vnode)) {
|
|
3417
|
+
if (isDef(ns)) { applyNS(vnode, ns); }
|
|
3418
|
+
if (isDef(data)) { registerDeepBindings(data); }
|
|
3419
|
+
return vnode
|
|
3420
|
+
} else {
|
|
3421
|
+
return createEmptyVNode()
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3356
3424
|
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3425
|
+
function applyNS (vnode, ns, force) {
|
|
3426
|
+
vnode.ns = ns;
|
|
3427
|
+
if (vnode.tag === 'foreignObject') {
|
|
3428
|
+
// use default namespace inside foreignObject
|
|
3429
|
+
ns = undefined;
|
|
3430
|
+
force = true;
|
|
3431
|
+
}
|
|
3432
|
+
if (isDef(vnode.children)) {
|
|
3433
|
+
for (var i = 0, l = vnode.children.length; i < l; i++) {
|
|
3434
|
+
var child = vnode.children[i];
|
|
3435
|
+
if (isDef(child.tag) && (
|
|
3436
|
+
isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
|
|
3437
|
+
applyNS(child, ns, force);
|
|
3438
|
+
}
|
|
3367
3439
|
}
|
|
3368
3440
|
}
|
|
3369
|
-
}
|
|
3441
|
+
}
|
|
3370
3442
|
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
var dep = this.deps[i];
|
|
3378
|
-
if (!this.newDepIds.has(dep.id)) {
|
|
3379
|
-
dep.removeSub(this);
|
|
3380
|
-
}
|
|
3443
|
+
// ref #5318
|
|
3444
|
+
// necessary to ensure parent re-render when deep bindings like :style and
|
|
3445
|
+
// :class are used on slot nodes
|
|
3446
|
+
function registerDeepBindings (data) {
|
|
3447
|
+
if (isObject(data.style)) {
|
|
3448
|
+
traverse(data.style);
|
|
3381
3449
|
}
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3450
|
+
if (isObject(data.class)) {
|
|
3451
|
+
traverse(data.class);
|
|
3452
|
+
}
|
|
3453
|
+
}
|
|
3454
|
+
|
|
3455
|
+
/* */
|
|
3456
|
+
|
|
3457
|
+
function initRender (vm) {
|
|
3458
|
+
vm._vnode = null; // the root of the child tree
|
|
3459
|
+
vm._staticTrees = null; // v-once cached trees
|
|
3460
|
+
var options = vm.$options;
|
|
3461
|
+
var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
|
|
3462
|
+
var renderContext = parentVnode && parentVnode.context;
|
|
3463
|
+
vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
|
3464
|
+
vm.$scopedSlots = emptyObject;
|
|
3465
|
+
// bind the createElement fn to this instance
|
|
3466
|
+
// so that we get proper render context inside it.
|
|
3467
|
+
// args order: tag, data, children, normalizationType, alwaysNormalize
|
|
3468
|
+
// internal version is used by render functions compiled from templates
|
|
3469
|
+
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
|
3470
|
+
// normalization is always applied for the public version, used in
|
|
3471
|
+
// user-written render functions.
|
|
3472
|
+
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
|
|
3473
|
+
|
|
3474
|
+
// $attrs & $listeners are exposed for easier HOC creation.
|
|
3475
|
+
// they need to be reactive so that HOCs using them are always updated
|
|
3476
|
+
var parentData = parentVnode && parentVnode.data;
|
|
3391
3477
|
|
|
3392
|
-
/**
|
|
3393
|
-
* Subscriber interface.
|
|
3394
|
-
* Will be called when a dependency changes.
|
|
3395
|
-
*/
|
|
3396
|
-
Watcher.prototype.update = function update () {
|
|
3397
3478
|
/* istanbul ignore else */
|
|
3398
|
-
if (
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3479
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3480
|
+
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
|
|
3481
|
+
!isUpdatingChildComponent && warn("$attrs is readonly.", vm);
|
|
3482
|
+
}, true);
|
|
3483
|
+
defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
|
|
3484
|
+
!isUpdatingChildComponent && warn("$listeners is readonly.", vm);
|
|
3485
|
+
}, true);
|
|
3402
3486
|
} else {
|
|
3403
|
-
|
|
3487
|
+
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);
|
|
3488
|
+
defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true);
|
|
3404
3489
|
}
|
|
3405
|
-
}
|
|
3490
|
+
}
|
|
3406
3491
|
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3492
|
+
var currentRenderingInstance = null;
|
|
3493
|
+
|
|
3494
|
+
function renderMixin (Vue) {
|
|
3495
|
+
// install runtime convenience helpers
|
|
3496
|
+
installRenderHelpers(Vue.prototype);
|
|
3497
|
+
|
|
3498
|
+
Vue.prototype.$nextTick = function (fn) {
|
|
3499
|
+
return nextTick(fn, this)
|
|
3500
|
+
};
|
|
3501
|
+
|
|
3502
|
+
Vue.prototype._render = function () {
|
|
3503
|
+
var vm = this;
|
|
3504
|
+
var ref = vm.$options;
|
|
3505
|
+
var render = ref.render;
|
|
3506
|
+
var _parentVnode = ref._parentVnode;
|
|
3507
|
+
|
|
3508
|
+
if (_parentVnode) {
|
|
3509
|
+
vm.$scopedSlots = normalizeScopedSlots(
|
|
3510
|
+
_parentVnode.data.scopedSlots,
|
|
3511
|
+
vm.$slots,
|
|
3512
|
+
vm.$scopedSlots
|
|
3513
|
+
);
|
|
3514
|
+
}
|
|
3515
|
+
|
|
3516
|
+
// set parent vnode. this allows render functions to have access
|
|
3517
|
+
// to the data on the placeholder node.
|
|
3518
|
+
vm.$vnode = _parentVnode;
|
|
3519
|
+
// render self
|
|
3520
|
+
var vnode;
|
|
3521
|
+
try {
|
|
3522
|
+
// There's no need to maintain a stack becaues all render fns are called
|
|
3523
|
+
// separately from one another. Nested component's render fns are called
|
|
3524
|
+
// when parent component is patched.
|
|
3525
|
+
currentRenderingInstance = vm;
|
|
3526
|
+
vnode = render.call(vm._renderProxy, vm.$createElement);
|
|
3527
|
+
} catch (e) {
|
|
3528
|
+
handleError(e, vm, "render");
|
|
3529
|
+
// return error render result,
|
|
3530
|
+
// or previous vnode to prevent render error causing blank component
|
|
3531
|
+
/* istanbul ignore else */
|
|
3532
|
+
if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) {
|
|
3426
3533
|
try {
|
|
3427
|
-
|
|
3534
|
+
vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
|
|
3428
3535
|
} catch (e) {
|
|
3429
|
-
handleError(e,
|
|
3536
|
+
handleError(e, vm, "renderError");
|
|
3537
|
+
vnode = vm._vnode;
|
|
3430
3538
|
}
|
|
3431
3539
|
} else {
|
|
3432
|
-
|
|
3540
|
+
vnode = vm._vnode;
|
|
3433
3541
|
}
|
|
3542
|
+
} finally {
|
|
3543
|
+
currentRenderingInstance = null;
|
|
3434
3544
|
}
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
/**
|
|
3439
|
-
* Evaluate the value of the watcher.
|
|
3440
|
-
* This only gets called for lazy watchers.
|
|
3441
|
-
*/
|
|
3442
|
-
Watcher.prototype.evaluate = function evaluate () {
|
|
3443
|
-
this.value = this.get();
|
|
3444
|
-
this.dirty = false;
|
|
3445
|
-
};
|
|
3446
|
-
|
|
3447
|
-
/**
|
|
3448
|
-
* Depend on all deps collected by this watcher.
|
|
3449
|
-
*/
|
|
3450
|
-
Watcher.prototype.depend = function depend () {
|
|
3451
|
-
var i = this.deps.length;
|
|
3452
|
-
while (i--) {
|
|
3453
|
-
this.deps[i].depend();
|
|
3454
|
-
}
|
|
3455
|
-
};
|
|
3456
|
-
|
|
3457
|
-
/**
|
|
3458
|
-
* Remove self from all dependencies' subscriber list.
|
|
3459
|
-
*/
|
|
3460
|
-
Watcher.prototype.teardown = function teardown () {
|
|
3461
|
-
if (this.active) {
|
|
3462
|
-
// remove self from vm's watcher list
|
|
3463
|
-
// this is a somewhat expensive operation so we skip it
|
|
3464
|
-
// if the vm is being destroyed.
|
|
3465
|
-
if (!this.vm._isBeingDestroyed) {
|
|
3466
|
-
remove(this.vm._watchers, this);
|
|
3545
|
+
// if the returned array contains only a single node, allow it
|
|
3546
|
+
if (Array.isArray(vnode) && vnode.length === 1) {
|
|
3547
|
+
vnode = vnode[0];
|
|
3467
3548
|
}
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3549
|
+
// return empty vnode in case the render function errored out
|
|
3550
|
+
if (!(vnode instanceof VNode)) {
|
|
3551
|
+
if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
|
|
3552
|
+
warn(
|
|
3553
|
+
'Multiple root nodes returned from render function. Render function ' +
|
|
3554
|
+
'should return a single root node.',
|
|
3555
|
+
vm
|
|
3556
|
+
);
|
|
3557
|
+
}
|
|
3558
|
+
vnode = createEmptyVNode();
|
|
3471
3559
|
}
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3560
|
+
// set parent
|
|
3561
|
+
vnode.parent = _parentVnode;
|
|
3562
|
+
return vnode
|
|
3563
|
+
};
|
|
3564
|
+
}
|
|
3475
3565
|
|
|
3476
3566
|
/* */
|
|
3477
3567
|
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3568
|
+
function ensureCtor (comp, base) {
|
|
3569
|
+
if (
|
|
3570
|
+
comp.__esModule ||
|
|
3571
|
+
(hasSymbol && comp[Symbol.toStringTag] === 'Module')
|
|
3572
|
+
) {
|
|
3573
|
+
comp = comp.default;
|
|
3574
|
+
}
|
|
3575
|
+
return isObject(comp)
|
|
3576
|
+
? base.extend(comp)
|
|
3577
|
+
: comp
|
|
3578
|
+
}
|
|
3484
3579
|
|
|
3485
|
-
function
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3580
|
+
function createAsyncPlaceholder (
|
|
3581
|
+
factory,
|
|
3582
|
+
data,
|
|
3583
|
+
context,
|
|
3584
|
+
children,
|
|
3585
|
+
tag
|
|
3586
|
+
) {
|
|
3587
|
+
var node = createEmptyVNode();
|
|
3588
|
+
node.asyncFactory = factory;
|
|
3589
|
+
node.asyncMeta = { data: data, context: context, children: children, tag: tag };
|
|
3590
|
+
return node
|
|
3493
3591
|
}
|
|
3494
3592
|
|
|
3495
|
-
function
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
if (
|
|
3500
|
-
|
|
3501
|
-
initData(vm);
|
|
3502
|
-
} else {
|
|
3503
|
-
observe(vm._data = {}, true /* asRootData */);
|
|
3593
|
+
function resolveAsyncComponent (
|
|
3594
|
+
factory,
|
|
3595
|
+
baseCtor
|
|
3596
|
+
) {
|
|
3597
|
+
if (isTrue(factory.error) && isDef(factory.errorComp)) {
|
|
3598
|
+
return factory.errorComp
|
|
3504
3599
|
}
|
|
3505
|
-
|
|
3506
|
-
if (
|
|
3507
|
-
|
|
3600
|
+
|
|
3601
|
+
if (isDef(factory.resolved)) {
|
|
3602
|
+
return factory.resolved
|
|
3508
3603
|
}
|
|
3509
|
-
}
|
|
3510
3604
|
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
var props = vm._props = {};
|
|
3514
|
-
// cache prop keys so that future props updates can iterate using Array
|
|
3515
|
-
// instead of dynamic object key enumeration.
|
|
3516
|
-
var keys = vm.$options._propKeys = [];
|
|
3517
|
-
var isRoot = !vm.$parent;
|
|
3518
|
-
// root instance props should be converted
|
|
3519
|
-
if (!isRoot) {
|
|
3520
|
-
toggleObserving(false);
|
|
3605
|
+
if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
|
3606
|
+
return factory.loadingComp
|
|
3521
3607
|
}
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
);
|
|
3608
|
+
|
|
3609
|
+
var owner = currentRenderingInstance;
|
|
3610
|
+
if (isDef(factory.owners)) {
|
|
3611
|
+
// already pending
|
|
3612
|
+
factory.owners.push(owner);
|
|
3613
|
+
} else {
|
|
3614
|
+
var owners = factory.owners = [owner];
|
|
3615
|
+
var sync = true;
|
|
3616
|
+
|
|
3617
|
+
var forceRender = function (renderCompleted) {
|
|
3618
|
+
for (var i = 0, l = owners.length; i < l; i++) {
|
|
3619
|
+
(owners[i]).$forceUpdate();
|
|
3534
3620
|
}
|
|
3535
|
-
defineReactive$$1(props, key, value, function () {
|
|
3536
|
-
if (!isRoot && !isUpdatingChildComponent) {
|
|
3537
|
-
warn(
|
|
3538
|
-
"Avoid mutating a prop directly since the value will be " +
|
|
3539
|
-
"overwritten whenever the parent component re-renders. " +
|
|
3540
|
-
"Instead, use a data or computed property based on the prop's " +
|
|
3541
|
-
"value. Prop being mutated: \"" + key + "\"",
|
|
3542
|
-
vm
|
|
3543
|
-
);
|
|
3544
|
-
}
|
|
3545
|
-
});
|
|
3546
|
-
} else {
|
|
3547
|
-
defineReactive$$1(props, key, value);
|
|
3548
|
-
}
|
|
3549
|
-
// static props are already proxied on the component's prototype
|
|
3550
|
-
// during Vue.extend(). We only need to proxy props defined at
|
|
3551
|
-
// instantiation here.
|
|
3552
|
-
if (!(key in vm)) {
|
|
3553
|
-
proxy(vm, "_props", key);
|
|
3554
|
-
}
|
|
3555
|
-
};
|
|
3556
3621
|
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
}
|
|
3622
|
+
if (renderCompleted) {
|
|
3623
|
+
owners.length = 0;
|
|
3624
|
+
}
|
|
3625
|
+
};
|
|
3560
3626
|
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
|
3571
|
-
vm
|
|
3572
|
-
);
|
|
3573
|
-
}
|
|
3574
|
-
// proxy data on instance
|
|
3575
|
-
var keys = Object.keys(data);
|
|
3576
|
-
var props = vm.$options.props;
|
|
3577
|
-
var methods = vm.$options.methods;
|
|
3578
|
-
var i = keys.length;
|
|
3579
|
-
while (i--) {
|
|
3580
|
-
var key = keys[i];
|
|
3581
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3582
|
-
if (methods && hasOwn(methods, key)) {
|
|
3583
|
-
warn(
|
|
3584
|
-
("Method \"" + key + "\" has already been defined as a data property."),
|
|
3585
|
-
vm
|
|
3586
|
-
);
|
|
3627
|
+
var resolve = once(function (res) {
|
|
3628
|
+
// cache resolved
|
|
3629
|
+
factory.resolved = ensureCtor(res, baseCtor);
|
|
3630
|
+
// invoke callbacks only if this is not a synchronous resolve
|
|
3631
|
+
// (async resolves are shimmed as synchronous during SSR)
|
|
3632
|
+
if (!sync) {
|
|
3633
|
+
forceRender(true);
|
|
3634
|
+
} else {
|
|
3635
|
+
owners.length = 0;
|
|
3587
3636
|
}
|
|
3588
|
-
}
|
|
3589
|
-
|
|
3637
|
+
});
|
|
3638
|
+
|
|
3639
|
+
var reject = once(function (reason) {
|
|
3590
3640
|
process.env.NODE_ENV !== 'production' && warn(
|
|
3591
|
-
"
|
|
3592
|
-
"
|
|
3593
|
-
vm
|
|
3641
|
+
"Failed to resolve async component: " + (String(factory)) +
|
|
3642
|
+
(reason ? ("\nReason: " + reason) : '')
|
|
3594
3643
|
);
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
observe(data, true /* asRootData */);
|
|
3601
|
-
}
|
|
3602
|
-
|
|
3603
|
-
function getData (data, vm) {
|
|
3604
|
-
// #7573 disable dep collection when invoking data getters
|
|
3605
|
-
pushTarget();
|
|
3606
|
-
try {
|
|
3607
|
-
return data.call(vm, vm)
|
|
3608
|
-
} catch (e) {
|
|
3609
|
-
handleError(e, vm, "data()");
|
|
3610
|
-
return {}
|
|
3611
|
-
} finally {
|
|
3612
|
-
popTarget();
|
|
3613
|
-
}
|
|
3614
|
-
}
|
|
3615
|
-
|
|
3616
|
-
var computedWatcherOptions = { lazy: true };
|
|
3644
|
+
if (isDef(factory.errorComp)) {
|
|
3645
|
+
factory.error = true;
|
|
3646
|
+
forceRender(true);
|
|
3647
|
+
}
|
|
3648
|
+
});
|
|
3617
3649
|
|
|
3618
|
-
|
|
3619
|
-
// $flow-disable-line
|
|
3620
|
-
var watchers = vm._computedWatchers = Object.create(null);
|
|
3621
|
-
// computed properties are just getters during SSR
|
|
3622
|
-
var isSSR = isServerRendering();
|
|
3650
|
+
var res = factory(resolve, reject);
|
|
3623
3651
|
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
}
|
|
3652
|
+
if (isObject(res)) {
|
|
3653
|
+
if (isPromise(res)) {
|
|
3654
|
+
// () => Promise
|
|
3655
|
+
if (isUndef(factory.resolved)) {
|
|
3656
|
+
res.then(resolve, reject);
|
|
3657
|
+
}
|
|
3658
|
+
} else if (isPromise(res.component)) {
|
|
3659
|
+
res.component.then(resolve, reject);
|
|
3633
3660
|
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
vm,
|
|
3638
|
-
getter || noop,
|
|
3639
|
-
noop,
|
|
3640
|
-
computedWatcherOptions
|
|
3641
|
-
);
|
|
3642
|
-
}
|
|
3661
|
+
if (isDef(res.error)) {
|
|
3662
|
+
factory.errorComp = ensureCtor(res.error, baseCtor);
|
|
3663
|
+
}
|
|
3643
3664
|
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3665
|
+
if (isDef(res.loading)) {
|
|
3666
|
+
factory.loadingComp = ensureCtor(res.loading, baseCtor);
|
|
3667
|
+
if (res.delay === 0) {
|
|
3668
|
+
factory.loading = true;
|
|
3669
|
+
} else {
|
|
3670
|
+
setTimeout(function () {
|
|
3671
|
+
if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
|
3672
|
+
factory.loading = true;
|
|
3673
|
+
forceRender(false);
|
|
3674
|
+
}
|
|
3675
|
+
}, res.delay || 200);
|
|
3676
|
+
}
|
|
3677
|
+
}
|
|
3678
|
+
|
|
3679
|
+
if (isDef(res.timeout)) {
|
|
3680
|
+
setTimeout(function () {
|
|
3681
|
+
if (isUndef(factory.resolved)) {
|
|
3682
|
+
reject(
|
|
3683
|
+
process.env.NODE_ENV !== 'production'
|
|
3684
|
+
? ("timeout (" + (res.timeout) + "ms)")
|
|
3685
|
+
: null
|
|
3686
|
+
);
|
|
3687
|
+
}
|
|
3688
|
+
}, res.timeout);
|
|
3689
|
+
}
|
|
3654
3690
|
}
|
|
3655
3691
|
}
|
|
3692
|
+
|
|
3693
|
+
sync = false;
|
|
3694
|
+
// return in case resolved synchronously
|
|
3695
|
+
return factory.loading
|
|
3696
|
+
? factory.loadingComp
|
|
3697
|
+
: factory.resolved
|
|
3656
3698
|
}
|
|
3657
3699
|
}
|
|
3658
3700
|
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
) {
|
|
3664
|
-
var shouldCache = !isServerRendering();
|
|
3665
|
-
if (typeof userDef === 'function') {
|
|
3666
|
-
sharedPropertyDefinition.get = shouldCache
|
|
3667
|
-
? createComputedGetter(key)
|
|
3668
|
-
: createGetterInvoker(userDef);
|
|
3669
|
-
sharedPropertyDefinition.set = noop;
|
|
3670
|
-
} else {
|
|
3671
|
-
sharedPropertyDefinition.get = userDef.get
|
|
3672
|
-
? shouldCache && userDef.cache !== false
|
|
3673
|
-
? createComputedGetter(key)
|
|
3674
|
-
: createGetterInvoker(userDef.get)
|
|
3675
|
-
: noop;
|
|
3676
|
-
sharedPropertyDefinition.set = userDef.set || noop;
|
|
3677
|
-
}
|
|
3678
|
-
if (process.env.NODE_ENV !== 'production' &&
|
|
3679
|
-
sharedPropertyDefinition.set === noop) {
|
|
3680
|
-
sharedPropertyDefinition.set = function () {
|
|
3681
|
-
warn(
|
|
3682
|
-
("Computed property \"" + key + "\" was assigned to but it has no setter."),
|
|
3683
|
-
this
|
|
3684
|
-
);
|
|
3685
|
-
};
|
|
3686
|
-
}
|
|
3687
|
-
Object.defineProperty(target, key, sharedPropertyDefinition);
|
|
3701
|
+
/* */
|
|
3702
|
+
|
|
3703
|
+
function isAsyncPlaceholder (node) {
|
|
3704
|
+
return node.isComment && node.asyncFactory
|
|
3688
3705
|
}
|
|
3689
3706
|
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
watcher.depend();
|
|
3707
|
+
/* */
|
|
3708
|
+
|
|
3709
|
+
function getFirstComponentChild (children) {
|
|
3710
|
+
if (Array.isArray(children)) {
|
|
3711
|
+
for (var i = 0; i < children.length; i++) {
|
|
3712
|
+
var c = children[i];
|
|
3713
|
+
if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
|
|
3714
|
+
return c
|
|
3699
3715
|
}
|
|
3700
|
-
return watcher.value
|
|
3701
3716
|
}
|
|
3702
3717
|
}
|
|
3703
3718
|
}
|
|
3704
3719
|
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3720
|
+
/* */
|
|
3721
|
+
|
|
3722
|
+
/* */
|
|
3723
|
+
|
|
3724
|
+
function initEvents (vm) {
|
|
3725
|
+
vm._events = Object.create(null);
|
|
3726
|
+
vm._hasHookEvent = false;
|
|
3727
|
+
// init parent attached events
|
|
3728
|
+
var listeners = vm.$options._parentListeners;
|
|
3729
|
+
if (listeners) {
|
|
3730
|
+
updateComponentListeners(vm, listeners);
|
|
3708
3731
|
}
|
|
3709
3732
|
}
|
|
3710
3733
|
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
if (typeof methods[key] !== 'function') {
|
|
3716
|
-
warn(
|
|
3717
|
-
"Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
|
|
3718
|
-
"Did you reference the function correctly?",
|
|
3719
|
-
vm
|
|
3720
|
-
);
|
|
3721
|
-
}
|
|
3722
|
-
if (props && hasOwn(props, key)) {
|
|
3723
|
-
warn(
|
|
3724
|
-
("Method \"" + key + "\" has already been defined as a prop."),
|
|
3725
|
-
vm
|
|
3726
|
-
);
|
|
3727
|
-
}
|
|
3728
|
-
if ((key in vm) && isReserved(key)) {
|
|
3729
|
-
warn(
|
|
3730
|
-
"Method \"" + key + "\" conflicts with an existing Vue instance method. " +
|
|
3731
|
-
"Avoid defining component methods that start with _ or $."
|
|
3732
|
-
);
|
|
3733
|
-
}
|
|
3734
|
-
}
|
|
3735
|
-
vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
|
|
3736
|
-
}
|
|
3734
|
+
var target;
|
|
3735
|
+
|
|
3736
|
+
function add (event, fn) {
|
|
3737
|
+
target.$on(event, fn);
|
|
3737
3738
|
}
|
|
3738
3739
|
|
|
3739
|
-
function
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3740
|
+
function remove$1 (event, fn) {
|
|
3741
|
+
target.$off(event, fn);
|
|
3742
|
+
}
|
|
3743
|
+
|
|
3744
|
+
function createOnceHandler (event, fn) {
|
|
3745
|
+
var _target = target;
|
|
3746
|
+
return function onceHandler () {
|
|
3747
|
+
var res = fn.apply(null, arguments);
|
|
3748
|
+
if (res !== null) {
|
|
3749
|
+
_target.$off(event, onceHandler);
|
|
3748
3750
|
}
|
|
3749
3751
|
}
|
|
3750
3752
|
}
|
|
3751
3753
|
|
|
3752
|
-
function
|
|
3754
|
+
function updateComponentListeners (
|
|
3753
3755
|
vm,
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
options
|
|
3756
|
+
listeners,
|
|
3757
|
+
oldListeners
|
|
3757
3758
|
) {
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
}
|
|
3762
|
-
if (typeof handler === 'string') {
|
|
3763
|
-
handler = vm[handler];
|
|
3764
|
-
}
|
|
3765
|
-
return vm.$watch(expOrFn, handler, options)
|
|
3759
|
+
target = vm;
|
|
3760
|
+
updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
|
|
3761
|
+
target = undefined;
|
|
3766
3762
|
}
|
|
3767
3763
|
|
|
3768
|
-
function
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
}
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
};
|
|
3787
|
-
}
|
|
3788
|
-
Object.defineProperty(Vue.prototype, '$data', dataDef);
|
|
3789
|
-
Object.defineProperty(Vue.prototype, '$props', propsDef);
|
|
3764
|
+
function eventsMixin (Vue) {
|
|
3765
|
+
var hookRE = /^hook:/;
|
|
3766
|
+
Vue.prototype.$on = function (event, fn) {
|
|
3767
|
+
var vm = this;
|
|
3768
|
+
if (Array.isArray(event)) {
|
|
3769
|
+
for (var i = 0, l = event.length; i < l; i++) {
|
|
3770
|
+
vm.$on(event[i], fn);
|
|
3771
|
+
}
|
|
3772
|
+
} else {
|
|
3773
|
+
(vm._events[event] || (vm._events[event] = [])).push(fn);
|
|
3774
|
+
// optimize hook:event cost by using a boolean flag marked at registration
|
|
3775
|
+
// instead of a hash lookup
|
|
3776
|
+
if (hookRE.test(event)) {
|
|
3777
|
+
vm._hasHookEvent = true;
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
return vm
|
|
3781
|
+
};
|
|
3790
3782
|
|
|
3791
|
-
Vue.prototype.$
|
|
3792
|
-
|
|
3783
|
+
Vue.prototype.$once = function (event, fn) {
|
|
3784
|
+
var vm = this;
|
|
3785
|
+
function on () {
|
|
3786
|
+
vm.$off(event, on);
|
|
3787
|
+
fn.apply(vm, arguments);
|
|
3788
|
+
}
|
|
3789
|
+
on.fn = fn;
|
|
3790
|
+
vm.$on(event, on);
|
|
3791
|
+
return vm
|
|
3792
|
+
};
|
|
3793
3793
|
|
|
3794
|
-
Vue.prototype.$
|
|
3795
|
-
expOrFn,
|
|
3796
|
-
cb,
|
|
3797
|
-
options
|
|
3798
|
-
) {
|
|
3794
|
+
Vue.prototype.$off = function (event, fn) {
|
|
3799
3795
|
var vm = this;
|
|
3800
|
-
|
|
3801
|
-
|
|
3796
|
+
// all
|
|
3797
|
+
if (!arguments.length) {
|
|
3798
|
+
vm._events = Object.create(null);
|
|
3799
|
+
return vm
|
|
3802
3800
|
}
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3801
|
+
// array of events
|
|
3802
|
+
if (Array.isArray(event)) {
|
|
3803
|
+
for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
|
|
3804
|
+
vm.$off(event[i$1], fn);
|
|
3805
|
+
}
|
|
3806
|
+
return vm
|
|
3807
|
+
}
|
|
3808
|
+
// specific event
|
|
3809
|
+
var cbs = vm._events[event];
|
|
3810
|
+
if (!cbs) {
|
|
3811
|
+
return vm
|
|
3812
|
+
}
|
|
3813
|
+
if (!fn) {
|
|
3814
|
+
vm._events[event] = null;
|
|
3815
|
+
return vm
|
|
3816
|
+
}
|
|
3817
|
+
// specific handler
|
|
3818
|
+
var cb;
|
|
3819
|
+
var i = cbs.length;
|
|
3820
|
+
while (i--) {
|
|
3821
|
+
cb = cbs[i];
|
|
3822
|
+
if (cb === fn || cb.fn === fn) {
|
|
3823
|
+
cbs.splice(i, 1);
|
|
3824
|
+
break
|
|
3825
|
+
}
|
|
3826
|
+
}
|
|
3827
|
+
return vm
|
|
3828
|
+
};
|
|
3829
|
+
|
|
3830
|
+
Vue.prototype.$emit = function (event) {
|
|
3831
|
+
var vm = this;
|
|
3832
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3833
|
+
var lowerCaseEvent = event.toLowerCase();
|
|
3834
|
+
if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
|
|
3835
|
+
tip(
|
|
3836
|
+
"Event \"" + lowerCaseEvent + "\" is emitted in component " +
|
|
3837
|
+
(formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
|
|
3838
|
+
"Note that HTML attributes are case-insensitive and you cannot use " +
|
|
3839
|
+
"v-on to listen to camelCase events when using in-DOM templates. " +
|
|
3840
|
+
"You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
|
|
3841
|
+
);
|
|
3811
3842
|
}
|
|
3812
3843
|
}
|
|
3813
|
-
|
|
3814
|
-
|
|
3844
|
+
var cbs = vm._events[event];
|
|
3845
|
+
if (cbs) {
|
|
3846
|
+
cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
|
3847
|
+
var args = toArray(arguments, 1);
|
|
3848
|
+
var info = "event handler for \"" + event + "\"";
|
|
3849
|
+
for (var i = 0, l = cbs.length; i < l; i++) {
|
|
3850
|
+
invokeWithErrorHandling(cbs[i], vm, args, vm, info);
|
|
3851
|
+
}
|
|
3815
3852
|
}
|
|
3853
|
+
return vm
|
|
3816
3854
|
};
|
|
3817
3855
|
}
|
|
3818
3856
|
|
|
3819
3857
|
/* */
|
|
3820
3858
|
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
if (provide) {
|
|
3824
|
-
vm._provided = typeof provide === 'function'
|
|
3825
|
-
? provide.call(vm)
|
|
3826
|
-
: provide;
|
|
3827
|
-
}
|
|
3828
|
-
}
|
|
3859
|
+
var activeInstance = null;
|
|
3860
|
+
var isUpdatingChildComponent = false;
|
|
3829
3861
|
|
|
3830
|
-
function
|
|
3831
|
-
var
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
/* istanbul ignore else */
|
|
3836
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3837
|
-
defineReactive$$1(vm, key, result[key], function () {
|
|
3838
|
-
warn(
|
|
3839
|
-
"Avoid mutating an injected value directly since the changes will be " +
|
|
3840
|
-
"overwritten whenever the provided component re-renders. " +
|
|
3841
|
-
"injection being mutated: \"" + key + "\"",
|
|
3842
|
-
vm
|
|
3843
|
-
);
|
|
3844
|
-
});
|
|
3845
|
-
} else {
|
|
3846
|
-
defineReactive$$1(vm, key, result[key]);
|
|
3847
|
-
}
|
|
3848
|
-
});
|
|
3849
|
-
toggleObserving(true);
|
|
3862
|
+
function setActiveInstance(vm) {
|
|
3863
|
+
var prevActiveInstance = activeInstance;
|
|
3864
|
+
activeInstance = vm;
|
|
3865
|
+
return function () {
|
|
3866
|
+
activeInstance = prevActiveInstance;
|
|
3850
3867
|
}
|
|
3851
3868
|
}
|
|
3852
3869
|
|
|
3853
|
-
function
|
|
3854
|
-
|
|
3855
|
-
// inject is :any because flow is not smart enough to figure out cached
|
|
3856
|
-
var result = Object.create(null);
|
|
3857
|
-
var keys = hasSymbol
|
|
3858
|
-
? Reflect.ownKeys(inject)
|
|
3859
|
-
: Object.keys(inject);
|
|
3870
|
+
function initLifecycle (vm) {
|
|
3871
|
+
var options = vm.$options;
|
|
3860
3872
|
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
var source = vm;
|
|
3867
|
-
while (source) {
|
|
3868
|
-
if (source._provided && hasOwn(source._provided, provideKey)) {
|
|
3869
|
-
result[key] = source._provided[provideKey];
|
|
3870
|
-
break
|
|
3871
|
-
}
|
|
3872
|
-
source = source.$parent;
|
|
3873
|
-
}
|
|
3874
|
-
if (!source) {
|
|
3875
|
-
if ('default' in inject[key]) {
|
|
3876
|
-
var provideDefault = inject[key].default;
|
|
3877
|
-
result[key] = typeof provideDefault === 'function'
|
|
3878
|
-
? provideDefault.call(vm)
|
|
3879
|
-
: provideDefault;
|
|
3880
|
-
} else if (process.env.NODE_ENV !== 'production') {
|
|
3881
|
-
warn(("Injection \"" + key + "\" not found"), vm);
|
|
3882
|
-
}
|
|
3883
|
-
}
|
|
3873
|
+
// locate first non-abstract parent
|
|
3874
|
+
var parent = options.parent;
|
|
3875
|
+
if (parent && !options.abstract) {
|
|
3876
|
+
while (parent.$options.abstract && parent.$parent) {
|
|
3877
|
+
parent = parent.$parent;
|
|
3884
3878
|
}
|
|
3885
|
-
|
|
3879
|
+
parent.$children.push(vm);
|
|
3886
3880
|
}
|
|
3887
|
-
}
|
|
3888
|
-
|
|
3889
|
-
/* */
|
|
3890
3881
|
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
normalSlots
|
|
3894
|
-
) {
|
|
3895
|
-
var res;
|
|
3896
|
-
if (!slots) {
|
|
3897
|
-
res = {};
|
|
3898
|
-
} else if (slots._normalized) {
|
|
3899
|
-
return slots
|
|
3900
|
-
} else {
|
|
3901
|
-
res = {};
|
|
3902
|
-
for (var key in slots) {
|
|
3903
|
-
if (slots[key] && key[0] !== '$') {
|
|
3904
|
-
res[key] = normalizeScopedSlot(normalSlots, key, slots[key]);
|
|
3905
|
-
}
|
|
3906
|
-
}
|
|
3907
|
-
}
|
|
3908
|
-
// expose normal slots on scopedSlots
|
|
3909
|
-
for (var key$1 in normalSlots) {
|
|
3910
|
-
if (!(key$1 in res)) {
|
|
3911
|
-
res[key$1] = proxyNormalSlot(normalSlots, key$1);
|
|
3912
|
-
}
|
|
3913
|
-
}
|
|
3914
|
-
res._normalized = true;
|
|
3915
|
-
res.$stable = slots ? slots.$stable : true;
|
|
3916
|
-
return res
|
|
3917
|
-
}
|
|
3882
|
+
vm.$parent = parent;
|
|
3883
|
+
vm.$root = parent ? parent.$root : vm;
|
|
3918
3884
|
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
if ( scope === void 0 ) scope = {};
|
|
3885
|
+
vm.$children = [];
|
|
3886
|
+
vm.$refs = {};
|
|
3922
3887
|
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
if (!hasOwn(normalSlots, key)) {
|
|
3930
|
-
Object.defineProperty(normalSlots, key, {
|
|
3931
|
-
get: normalized
|
|
3932
|
-
});
|
|
3933
|
-
}
|
|
3934
|
-
return normalized
|
|
3888
|
+
vm._watcher = null;
|
|
3889
|
+
vm._inactive = null;
|
|
3890
|
+
vm._directInactive = false;
|
|
3891
|
+
vm._isMounted = false;
|
|
3892
|
+
vm._isDestroyed = false;
|
|
3893
|
+
vm._isBeingDestroyed = false;
|
|
3935
3894
|
}
|
|
3936
3895
|
|
|
3937
|
-
function
|
|
3938
|
-
|
|
3939
|
-
|
|
3896
|
+
function lifecycleMixin (Vue) {
|
|
3897
|
+
Vue.prototype._update = function (vnode, hydrating) {
|
|
3898
|
+
var vm = this;
|
|
3899
|
+
var prevEl = vm.$el;
|
|
3900
|
+
var prevVnode = vm._vnode;
|
|
3901
|
+
var restoreActiveInstance = setActiveInstance(vm);
|
|
3902
|
+
vm._vnode = vnode;
|
|
3903
|
+
// Vue.prototype.__patch__ is injected in entry points
|
|
3904
|
+
// based on the rendering backend used.
|
|
3905
|
+
if (!prevVnode) {
|
|
3906
|
+
// initial render
|
|
3907
|
+
vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
|
|
3908
|
+
} else {
|
|
3909
|
+
// updates
|
|
3910
|
+
vm.$el = vm.__patch__(prevVnode, vnode);
|
|
3911
|
+
}
|
|
3912
|
+
restoreActiveInstance();
|
|
3913
|
+
// update __vue__ reference
|
|
3914
|
+
if (prevEl) {
|
|
3915
|
+
prevEl.__vue__ = null;
|
|
3916
|
+
}
|
|
3917
|
+
if (vm.$el) {
|
|
3918
|
+
vm.$el.__vue__ = vm;
|
|
3919
|
+
}
|
|
3920
|
+
// if parent is an HOC, update its $el as well
|
|
3921
|
+
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
|
3922
|
+
vm.$parent.$el = vm.$el;
|
|
3923
|
+
}
|
|
3924
|
+
// updated hook is called by the scheduler to ensure that children are
|
|
3925
|
+
// updated in a parent's updated hook.
|
|
3926
|
+
};
|
|
3940
3927
|
|
|
3941
|
-
|
|
3928
|
+
Vue.prototype.$forceUpdate = function () {
|
|
3929
|
+
var vm = this;
|
|
3930
|
+
if (vm._watcher) {
|
|
3931
|
+
vm._watcher.update();
|
|
3932
|
+
}
|
|
3933
|
+
};
|
|
3942
3934
|
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
val,
|
|
3948
|
-
render
|
|
3949
|
-
) {
|
|
3950
|
-
var ret, i, l, keys, key;
|
|
3951
|
-
if (Array.isArray(val) || typeof val === 'string') {
|
|
3952
|
-
ret = new Array(val.length);
|
|
3953
|
-
for (i = 0, l = val.length; i < l; i++) {
|
|
3954
|
-
ret[i] = render(val[i], i);
|
|
3935
|
+
Vue.prototype.$destroy = function () {
|
|
3936
|
+
var vm = this;
|
|
3937
|
+
if (vm._isBeingDestroyed) {
|
|
3938
|
+
return
|
|
3955
3939
|
}
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3940
|
+
callHook(vm, 'beforeDestroy');
|
|
3941
|
+
vm._isBeingDestroyed = true;
|
|
3942
|
+
// remove self from parent
|
|
3943
|
+
var parent = vm.$parent;
|
|
3944
|
+
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
|
3945
|
+
remove(parent.$children, vm);
|
|
3960
3946
|
}
|
|
3961
|
-
|
|
3962
|
-
if (
|
|
3963
|
-
|
|
3964
|
-
var iterator = val[Symbol.iterator]();
|
|
3965
|
-
var result = iterator.next();
|
|
3966
|
-
while (!result.done) {
|
|
3967
|
-
ret.push(render(result.value, ret.length));
|
|
3968
|
-
result = iterator.next();
|
|
3969
|
-
}
|
|
3970
|
-
} else {
|
|
3971
|
-
keys = Object.keys(val);
|
|
3972
|
-
ret = new Array(keys.length);
|
|
3973
|
-
for (i = 0, l = keys.length; i < l; i++) {
|
|
3974
|
-
key = keys[i];
|
|
3975
|
-
ret[i] = render(val[key], key, i);
|
|
3976
|
-
}
|
|
3947
|
+
// teardown watchers
|
|
3948
|
+
if (vm._watcher) {
|
|
3949
|
+
vm._watcher.teardown();
|
|
3977
3950
|
}
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3951
|
+
var i = vm._watchers.length;
|
|
3952
|
+
while (i--) {
|
|
3953
|
+
vm._watchers[i].teardown();
|
|
3954
|
+
}
|
|
3955
|
+
// remove reference from data ob
|
|
3956
|
+
// frozen object may not have observer.
|
|
3957
|
+
if (vm._data.__ob__) {
|
|
3958
|
+
vm._data.__ob__.vmCount--;
|
|
3959
|
+
}
|
|
3960
|
+
// call the last hook...
|
|
3961
|
+
vm._isDestroyed = true;
|
|
3962
|
+
// invoke destroy hooks on current rendered tree
|
|
3963
|
+
vm.__patch__(vm._vnode, null);
|
|
3964
|
+
// fire destroyed hook
|
|
3965
|
+
callHook(vm, 'destroyed');
|
|
3966
|
+
// turn off all instance listeners.
|
|
3967
|
+
vm.$off();
|
|
3968
|
+
// remove __vue__ reference
|
|
3969
|
+
if (vm.$el) {
|
|
3970
|
+
vm.$el.__vue__ = null;
|
|
3971
|
+
}
|
|
3972
|
+
// release circular reference (#6759)
|
|
3973
|
+
if (vm.$vnode) {
|
|
3974
|
+
vm.$vnode.parent = null;
|
|
3975
|
+
}
|
|
3976
|
+
};
|
|
3984
3977
|
}
|
|
3985
3978
|
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
*/
|
|
3991
|
-
function renderSlot (
|
|
3992
|
-
name,
|
|
3993
|
-
fallback,
|
|
3994
|
-
props,
|
|
3995
|
-
bindObject
|
|
3979
|
+
function mountComponent (
|
|
3980
|
+
vm,
|
|
3981
|
+
el,
|
|
3982
|
+
hydrating
|
|
3996
3983
|
) {
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
if (
|
|
3984
|
+
vm.$el = el;
|
|
3985
|
+
if (!vm.$options.render) {
|
|
3986
|
+
vm.$options.render = createEmptyVNode;
|
|
3987
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3988
|
+
/* istanbul ignore if */
|
|
3989
|
+
if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
|
3990
|
+
vm.$options.el || el) {
|
|
4003
3991
|
warn(
|
|
4004
|
-
'
|
|
4005
|
-
|
|
3992
|
+
'You are using the runtime-only build of Vue where the template ' +
|
|
3993
|
+
'compiler is not available. Either pre-compile the templates into ' +
|
|
3994
|
+
'render functions, or use the compiler-included build.',
|
|
3995
|
+
vm
|
|
3996
|
+
);
|
|
3997
|
+
} else {
|
|
3998
|
+
warn(
|
|
3999
|
+
'Failed to mount component: template or render function not defined.',
|
|
4000
|
+
vm
|
|
4006
4001
|
);
|
|
4007
4002
|
}
|
|
4008
|
-
props = extend(extend({}, bindObject), props);
|
|
4009
4003
|
}
|
|
4010
|
-
nodes = scopedSlotFn(props) || fallback;
|
|
4011
|
-
} else {
|
|
4012
|
-
nodes = this.$slots[name] || fallback;
|
|
4013
4004
|
}
|
|
4005
|
+
callHook(vm, 'beforeMount');
|
|
4014
4006
|
|
|
4015
|
-
var
|
|
4016
|
-
if
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4007
|
+
var updateComponent;
|
|
4008
|
+
/* istanbul ignore if */
|
|
4009
|
+
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
|
|
4010
|
+
updateComponent = function () {
|
|
4011
|
+
var name = vm._name;
|
|
4012
|
+
var id = vm._uid;
|
|
4013
|
+
var startTag = "vue-perf-start:" + id;
|
|
4014
|
+
var endTag = "vue-perf-end:" + id;
|
|
4022
4015
|
|
|
4023
|
-
|
|
4016
|
+
mark(startTag);
|
|
4017
|
+
var vnode = vm._render();
|
|
4018
|
+
mark(endTag);
|
|
4019
|
+
measure(("vue " + name + " render"), startTag, endTag);
|
|
4024
4020
|
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
}
|
|
4021
|
+
mark(startTag);
|
|
4022
|
+
vm._update(vnode, hydrating);
|
|
4023
|
+
mark(endTag);
|
|
4024
|
+
measure(("vue " + name + " patch"), startTag, endTag);
|
|
4025
|
+
};
|
|
4026
|
+
} else {
|
|
4027
|
+
updateComponent = function () {
|
|
4028
|
+
vm._update(vm._render(), hydrating);
|
|
4029
|
+
};
|
|
4030
|
+
}
|
|
4031
4031
|
|
|
4032
|
-
|
|
4032
|
+
// we set this to vm._watcher inside the watcher's constructor
|
|
4033
|
+
// since the watcher's initial patch may call $forceUpdate (e.g. inside child
|
|
4034
|
+
// component's mounted hook), which relies on vm._watcher being already defined
|
|
4035
|
+
new Watcher(vm, updateComponent, noop, {
|
|
4036
|
+
before: function before () {
|
|
4037
|
+
if (vm._isMounted && !vm._isDestroyed) {
|
|
4038
|
+
callHook(vm, 'beforeUpdate');
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
4041
|
+
}, true /* isRenderWatcher */);
|
|
4042
|
+
hydrating = false;
|
|
4033
4043
|
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4044
|
+
// manually mounted instance, call mounted on self
|
|
4045
|
+
// mounted is called for render-created child components in its inserted hook
|
|
4046
|
+
if (vm.$vnode == null) {
|
|
4047
|
+
vm._isMounted = true;
|
|
4048
|
+
callHook(vm, 'mounted');
|
|
4039
4049
|
}
|
|
4050
|
+
return vm
|
|
4040
4051
|
}
|
|
4041
4052
|
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
eventKeyCode,
|
|
4049
|
-
key,
|
|
4050
|
-
builtInKeyCode,
|
|
4051
|
-
eventKeyName,
|
|
4052
|
-
builtInKeyName
|
|
4053
|
+
function updateChildComponent (
|
|
4054
|
+
vm,
|
|
4055
|
+
propsData,
|
|
4056
|
+
listeners,
|
|
4057
|
+
parentVnode,
|
|
4058
|
+
renderChildren
|
|
4053
4059
|
) {
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
return isKeyNotMatch(builtInKeyName, eventKeyName)
|
|
4057
|
-
} else if (mappedKeyCode) {
|
|
4058
|
-
return isKeyNotMatch(mappedKeyCode, eventKeyCode)
|
|
4059
|
-
} else if (eventKeyName) {
|
|
4060
|
-
return hyphenate(eventKeyName) !== key
|
|
4060
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4061
|
+
isUpdatingChildComponent = true;
|
|
4061
4062
|
}
|
|
4062
|
-
}
|
|
4063
4063
|
|
|
4064
|
-
|
|
4064
|
+
// determine whether component has slot children
|
|
4065
|
+
// we need to do this before overwriting $options._renderChildren.
|
|
4065
4066
|
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
asProp,
|
|
4074
|
-
isSync
|
|
4075
|
-
) {
|
|
4076
|
-
if (value) {
|
|
4077
|
-
if (!isObject(value)) {
|
|
4078
|
-
process.env.NODE_ENV !== 'production' && warn(
|
|
4079
|
-
'v-bind without argument expects an Object or Array value',
|
|
4080
|
-
this
|
|
4081
|
-
);
|
|
4082
|
-
} else {
|
|
4083
|
-
if (Array.isArray(value)) {
|
|
4084
|
-
value = toObject(value);
|
|
4085
|
-
}
|
|
4086
|
-
var hash;
|
|
4087
|
-
var loop = function ( key ) {
|
|
4088
|
-
if (
|
|
4089
|
-
key === 'class' ||
|
|
4090
|
-
key === 'style' ||
|
|
4091
|
-
isReservedAttribute(key)
|
|
4092
|
-
) {
|
|
4093
|
-
hash = data;
|
|
4094
|
-
} else {
|
|
4095
|
-
var type = data.attrs && data.attrs.type;
|
|
4096
|
-
hash = asProp || config.mustUseProp(tag, type, key)
|
|
4097
|
-
? data.domProps || (data.domProps = {})
|
|
4098
|
-
: data.attrs || (data.attrs = {});
|
|
4099
|
-
}
|
|
4100
|
-
var camelizedKey = camelize(key);
|
|
4101
|
-
if (!(key in hash) && !(camelizedKey in hash)) {
|
|
4102
|
-
hash[key] = value[key];
|
|
4067
|
+
// check if there are dynamic scopedSlots (hand-written or compiled but with
|
|
4068
|
+
// dynamic slot names). Static scoped slots compiled from template has the
|
|
4069
|
+
// "$stable" marker.
|
|
4070
|
+
var hasDynamicScopedSlot = !!(
|
|
4071
|
+
(parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
|
|
4072
|
+
(vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
|
|
4073
|
+
);
|
|
4103
4074
|
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4075
|
+
// Any static slot children from the parent may have changed during parent's
|
|
4076
|
+
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
|
4077
|
+
// update is necessary to ensure correctness.
|
|
4078
|
+
var needsForceUpdate = !!(
|
|
4079
|
+
renderChildren || // has new static slots
|
|
4080
|
+
vm.$options._renderChildren || // has old static slots
|
|
4081
|
+
hasDynamicScopedSlot
|
|
4082
|
+
);
|
|
4112
4083
|
|
|
4113
|
-
|
|
4114
|
-
|
|
4084
|
+
vm.$options._parentVnode = parentVnode;
|
|
4085
|
+
vm.$vnode = parentVnode; // update vm's placeholder node without re-render
|
|
4086
|
+
|
|
4087
|
+
if (vm._vnode) { // update child tree's parent
|
|
4088
|
+
vm._vnode.parent = parentVnode;
|
|
4115
4089
|
}
|
|
4116
|
-
|
|
4117
|
-
}
|
|
4090
|
+
vm.$options._renderChildren = renderChildren;
|
|
4118
4091
|
|
|
4119
|
-
|
|
4092
|
+
// update $attrs and $listeners hash
|
|
4093
|
+
// these are also reactive so they may trigger child update if the child
|
|
4094
|
+
// used them during render
|
|
4095
|
+
vm.$attrs = parentVnode.data.attrs || emptyObject;
|
|
4096
|
+
vm.$listeners = listeners || emptyObject;
|
|
4120
4097
|
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4098
|
+
// update props
|
|
4099
|
+
if (propsData && vm.$options.props) {
|
|
4100
|
+
toggleObserving(false);
|
|
4101
|
+
var props = vm._props;
|
|
4102
|
+
var propKeys = vm.$options._propKeys || [];
|
|
4103
|
+
for (var i = 0; i < propKeys.length; i++) {
|
|
4104
|
+
var key = propKeys[i];
|
|
4105
|
+
var propOptions = vm.$options.props; // wtf flow?
|
|
4106
|
+
props[key] = validateProp(key, propOptions, propsData, vm);
|
|
4107
|
+
}
|
|
4108
|
+
toggleObserving(true);
|
|
4109
|
+
// keep a copy of raw propsData
|
|
4110
|
+
vm.$options.propsData = propsData;
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
// update listeners
|
|
4114
|
+
listeners = listeners || emptyObject;
|
|
4115
|
+
var oldListeners = vm.$options._parentListeners;
|
|
4116
|
+
vm.$options._parentListeners = listeners;
|
|
4117
|
+
updateComponentListeners(vm, listeners, oldListeners);
|
|
4118
|
+
|
|
4119
|
+
// resolve slots + force update if has children
|
|
4120
|
+
if (needsForceUpdate) {
|
|
4121
|
+
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
|
4122
|
+
vm.$forceUpdate();
|
|
4123
|
+
}
|
|
4124
|
+
|
|
4125
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4126
|
+
isUpdatingChildComponent = false;
|
|
4134
4127
|
}
|
|
4135
|
-
// otherwise, render a fresh tree.
|
|
4136
|
-
tree = cached[index] = this.$options.staticRenderFns[index].call(
|
|
4137
|
-
this._renderProxy,
|
|
4138
|
-
null,
|
|
4139
|
-
this // for render fns generated for functional component templates
|
|
4140
|
-
);
|
|
4141
|
-
markStatic(tree, ("__static__" + index), false);
|
|
4142
|
-
return tree
|
|
4143
4128
|
}
|
|
4144
4129
|
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
tree,
|
|
4151
|
-
index,
|
|
4152
|
-
key
|
|
4153
|
-
) {
|
|
4154
|
-
markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
|
|
4155
|
-
return tree
|
|
4130
|
+
function isInInactiveTree (vm) {
|
|
4131
|
+
while (vm && (vm = vm.$parent)) {
|
|
4132
|
+
if (vm._inactive) { return true }
|
|
4133
|
+
}
|
|
4134
|
+
return false
|
|
4156
4135
|
}
|
|
4157
4136
|
|
|
4158
|
-
function
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
if (Array.isArray(tree)) {
|
|
4164
|
-
for (var i = 0; i < tree.length; i++) {
|
|
4165
|
-
if (tree[i] && typeof tree[i] !== 'string') {
|
|
4166
|
-
markStaticNode(tree[i], (key + "_" + i), isOnce);
|
|
4167
|
-
}
|
|
4137
|
+
function activateChildComponent (vm, direct) {
|
|
4138
|
+
if (direct) {
|
|
4139
|
+
vm._directInactive = false;
|
|
4140
|
+
if (isInInactiveTree(vm)) {
|
|
4141
|
+
return
|
|
4168
4142
|
}
|
|
4169
|
-
} else {
|
|
4170
|
-
|
|
4143
|
+
} else if (vm._directInactive) {
|
|
4144
|
+
return
|
|
4145
|
+
}
|
|
4146
|
+
if (vm._inactive || vm._inactive === null) {
|
|
4147
|
+
vm._inactive = false;
|
|
4148
|
+
for (var i = 0; i < vm.$children.length; i++) {
|
|
4149
|
+
activateChildComponent(vm.$children[i]);
|
|
4150
|
+
}
|
|
4151
|
+
callHook(vm, 'activated');
|
|
4171
4152
|
}
|
|
4172
4153
|
}
|
|
4173
4154
|
|
|
4174
|
-
function
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4155
|
+
function deactivateChildComponent (vm, direct) {
|
|
4156
|
+
if (direct) {
|
|
4157
|
+
vm._directInactive = true;
|
|
4158
|
+
if (isInInactiveTree(vm)) {
|
|
4159
|
+
return
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
if (!vm._inactive) {
|
|
4163
|
+
vm._inactive = true;
|
|
4164
|
+
for (var i = 0; i < vm.$children.length; i++) {
|
|
4165
|
+
deactivateChildComponent(vm.$children[i]);
|
|
4166
|
+
}
|
|
4167
|
+
callHook(vm, 'deactivated');
|
|
4168
|
+
}
|
|
4178
4169
|
}
|
|
4179
4170
|
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
);
|
|
4189
|
-
} else {
|
|
4190
|
-
var on = data.on = data.on ? extend({}, data.on) : {};
|
|
4191
|
-
for (var key in value) {
|
|
4192
|
-
var existing = on[key];
|
|
4193
|
-
var ours = value[key];
|
|
4194
|
-
on[key] = existing ? [].concat(existing, ours) : ours;
|
|
4195
|
-
}
|
|
4171
|
+
function callHook (vm, hook) {
|
|
4172
|
+
// #7573 disable dep collection when invoking lifecycle hooks
|
|
4173
|
+
pushTarget();
|
|
4174
|
+
var handlers = vm.$options[hook];
|
|
4175
|
+
var info = hook + " hook";
|
|
4176
|
+
if (handlers) {
|
|
4177
|
+
for (var i = 0, j = handlers.length; i < j; i++) {
|
|
4178
|
+
invokeWithErrorHandling(handlers[i], vm, null, vm, info);
|
|
4196
4179
|
}
|
|
4197
4180
|
}
|
|
4198
|
-
|
|
4181
|
+
if (vm._hasHookEvent) {
|
|
4182
|
+
vm.$emit('hook:' + hook);
|
|
4183
|
+
}
|
|
4184
|
+
popTarget();
|
|
4199
4185
|
}
|
|
4200
4186
|
|
|
4201
4187
|
/* */
|
|
4202
4188
|
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4189
|
+
var MAX_UPDATE_COUNT = 100;
|
|
4190
|
+
|
|
4191
|
+
var queue = [];
|
|
4192
|
+
var activatedChildren = [];
|
|
4193
|
+
var has = {};
|
|
4194
|
+
var circular = {};
|
|
4195
|
+
var waiting = false;
|
|
4196
|
+
var flushing = false;
|
|
4197
|
+
var index = 0;
|
|
4198
|
+
|
|
4199
|
+
/**
|
|
4200
|
+
* Reset the scheduler's state.
|
|
4201
|
+
*/
|
|
4202
|
+
function resetSchedulerState () {
|
|
4203
|
+
index = queue.length = activatedChildren.length = 0;
|
|
4204
|
+
has = {};
|
|
4205
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4206
|
+
circular = {};
|
|
4215
4207
|
}
|
|
4216
|
-
|
|
4208
|
+
waiting = flushing = false;
|
|
4217
4209
|
}
|
|
4218
4210
|
|
|
4219
|
-
//
|
|
4220
|
-
//
|
|
4221
|
-
//
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4211
|
+
// Async edge case #6566 requires saving the timestamp when event listeners are
|
|
4212
|
+
// attached. However, calling performance.now() has a perf overhead especially
|
|
4213
|
+
// if the page has thousands of event listeners. Instead, we take a timestamp
|
|
4214
|
+
// every time the scheduler flushes and use that for all event listeners
|
|
4215
|
+
// attached during that flush.
|
|
4216
|
+
var currentFlushTimestamp = 0;
|
|
4225
4217
|
|
|
4226
|
-
|
|
4218
|
+
// Async edge case fix requires storing an event listener's attach timestamp.
|
|
4219
|
+
var getNow = Date.now;
|
|
4227
4220
|
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
target._f = resolveFilter;
|
|
4238
|
-
target._k = checkKeyCodes;
|
|
4239
|
-
target._b = bindObjectProps;
|
|
4240
|
-
target._v = createTextVNode;
|
|
4241
|
-
target._e = createEmptyVNode;
|
|
4242
|
-
target._u = resolveScopedSlots;
|
|
4243
|
-
target._g = bindObjectListeners;
|
|
4244
|
-
target._d = bindDynamicKeys;
|
|
4245
|
-
target._p = prependModifier;
|
|
4221
|
+
// Determine what event timestamp the browser is using. Annoyingly, the
|
|
4222
|
+
// timestamp can either be hi-res (relative to page load) or low-res
|
|
4223
|
+
// (relative to UNIX epoch), so in order to compare time we have to use the
|
|
4224
|
+
// same timestamp type when saving the flush timestamp.
|
|
4225
|
+
if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
|
|
4226
|
+
// if the low-res timestamp which is bigger than the event timestamp
|
|
4227
|
+
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,
|
|
4228
|
+
// and we need to use the hi-res version for event listeners as well.
|
|
4229
|
+
getNow = function () { return performance.now(); };
|
|
4246
4230
|
}
|
|
4247
4231
|
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
Ctor
|
|
4256
|
-
) {
|
|
4257
|
-
var options = Ctor.options;
|
|
4258
|
-
// ensure the createElement function in functional components
|
|
4259
|
-
// gets a unique context - this is necessary for correct named slot check
|
|
4260
|
-
var contextVm;
|
|
4261
|
-
if (hasOwn(parent, '_uid')) {
|
|
4262
|
-
contextVm = Object.create(parent);
|
|
4263
|
-
// $flow-disable-line
|
|
4264
|
-
contextVm._original = parent;
|
|
4265
|
-
} else {
|
|
4266
|
-
// the context vm passed in is a functional context as well.
|
|
4267
|
-
// in this case we want to make sure we are able to get a hold to the
|
|
4268
|
-
// real context instance.
|
|
4269
|
-
contextVm = parent;
|
|
4270
|
-
// $flow-disable-line
|
|
4271
|
-
parent = parent._original;
|
|
4272
|
-
}
|
|
4273
|
-
var isCompiled = isTrue(options._compiled);
|
|
4274
|
-
var needNormalization = !isCompiled;
|
|
4232
|
+
/**
|
|
4233
|
+
* Flush both queues and run the watchers.
|
|
4234
|
+
*/
|
|
4235
|
+
function flushSchedulerQueue () {
|
|
4236
|
+
currentFlushTimestamp = getNow();
|
|
4237
|
+
flushing = true;
|
|
4238
|
+
var watcher, id;
|
|
4275
4239
|
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4240
|
+
// Sort queue before flush.
|
|
4241
|
+
// This ensures that:
|
|
4242
|
+
// 1. Components are updated from parent to child. (because parent is always
|
|
4243
|
+
// created before the child)
|
|
4244
|
+
// 2. A component's user watchers are run before its render watcher (because
|
|
4245
|
+
// user watchers are created before the render watcher)
|
|
4246
|
+
// 3. If a component is destroyed during a parent component's watcher run,
|
|
4247
|
+
// its watchers can be skipped.
|
|
4248
|
+
queue.sort(function (a, b) { return a.id - b.id; });
|
|
4283
4249
|
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4250
|
+
// do not cache length because more watchers might be pushed
|
|
4251
|
+
// as we run existing watchers
|
|
4252
|
+
for (index = 0; index < queue.length; index++) {
|
|
4253
|
+
watcher = queue[index];
|
|
4254
|
+
if (watcher.before) {
|
|
4255
|
+
watcher.before();
|
|
4288
4256
|
}
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
vnode.fnContext = parent;
|
|
4257
|
+
id = watcher.id;
|
|
4258
|
+
has[id] = null;
|
|
4259
|
+
watcher.run();
|
|
4260
|
+
// in dev build, check and stop circular updates.
|
|
4261
|
+
if (process.env.NODE_ENV !== 'production' && has[id] != null) {
|
|
4262
|
+
circular[id] = (circular[id] || 0) + 1;
|
|
4263
|
+
if (circular[id] > MAX_UPDATE_COUNT) {
|
|
4264
|
+
warn(
|
|
4265
|
+
'You may have an infinite update loop ' + (
|
|
4266
|
+
watcher.user
|
|
4267
|
+
? ("in watcher with expression \"" + (watcher.expression) + "\"")
|
|
4268
|
+
: "in a component render function."
|
|
4269
|
+
),
|
|
4270
|
+
watcher.vm
|
|
4271
|
+
);
|
|
4272
|
+
break
|
|
4306
4273
|
}
|
|
4307
|
-
|
|
4308
|
-
};
|
|
4309
|
-
} else {
|
|
4310
|
-
this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
|
|
4274
|
+
}
|
|
4311
4275
|
}
|
|
4312
|
-
}
|
|
4313
4276
|
|
|
4314
|
-
|
|
4277
|
+
// keep copies of post queues before resetting state
|
|
4278
|
+
var activatedQueue = activatedChildren.slice();
|
|
4279
|
+
var updatedQueue = queue.slice();
|
|
4315
4280
|
|
|
4316
|
-
|
|
4317
|
-
Ctor,
|
|
4318
|
-
propsData,
|
|
4319
|
-
data,
|
|
4320
|
-
contextVm,
|
|
4321
|
-
children
|
|
4322
|
-
) {
|
|
4323
|
-
var options = Ctor.options;
|
|
4324
|
-
var props = {};
|
|
4325
|
-
var propOptions = options.props;
|
|
4326
|
-
if (isDef(propOptions)) {
|
|
4327
|
-
for (var key in propOptions) {
|
|
4328
|
-
props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
|
4329
|
-
}
|
|
4330
|
-
} else {
|
|
4331
|
-
if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
|
|
4332
|
-
if (isDef(data.props)) { mergeProps(props, data.props); }
|
|
4333
|
-
}
|
|
4281
|
+
resetSchedulerState();
|
|
4334
4282
|
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
children,
|
|
4339
|
-
contextVm,
|
|
4340
|
-
Ctor
|
|
4341
|
-
);
|
|
4283
|
+
// call component updated and activated hooks
|
|
4284
|
+
callActivatedHooks(activatedQueue);
|
|
4285
|
+
callUpdatedHooks(updatedQueue);
|
|
4342
4286
|
|
|
4343
|
-
|
|
4287
|
+
// devtool hook
|
|
4288
|
+
/* istanbul ignore if */
|
|
4289
|
+
if (devtools && config.devtools) {
|
|
4290
|
+
devtools.emit('flush');
|
|
4291
|
+
}
|
|
4292
|
+
}
|
|
4344
4293
|
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
var
|
|
4349
|
-
var
|
|
4350
|
-
|
|
4351
|
-
|
|
4294
|
+
function callUpdatedHooks (queue) {
|
|
4295
|
+
var i = queue.length;
|
|
4296
|
+
while (i--) {
|
|
4297
|
+
var watcher = queue[i];
|
|
4298
|
+
var vm = watcher.vm;
|
|
4299
|
+
if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
|
|
4300
|
+
callHook(vm, 'updated');
|
|
4352
4301
|
}
|
|
4353
|
-
return res
|
|
4354
4302
|
}
|
|
4355
4303
|
}
|
|
4356
4304
|
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4305
|
+
/**
|
|
4306
|
+
* Queue a kept-alive component that was activated during patch.
|
|
4307
|
+
* The queue will be processed after the entire tree has been patched.
|
|
4308
|
+
*/
|
|
4309
|
+
function queueActivatedComponent (vm) {
|
|
4310
|
+
// setting _inactive to false here so that a render function can
|
|
4311
|
+
// rely on checking whether it's in an inactive tree (e.g. router-view)
|
|
4312
|
+
vm._inactive = false;
|
|
4313
|
+
activatedChildren.push(vm);
|
|
4314
|
+
}
|
|
4315
|
+
|
|
4316
|
+
function callActivatedHooks (queue) {
|
|
4317
|
+
for (var i = 0; i < queue.length; i++) {
|
|
4318
|
+
queue[i]._inactive = true;
|
|
4319
|
+
activateChildComponent(queue[i], true /* true */);
|
|
4369
4320
|
}
|
|
4370
|
-
return clone
|
|
4371
4321
|
}
|
|
4372
4322
|
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4323
|
+
/**
|
|
4324
|
+
* Push a watcher into the watcher queue.
|
|
4325
|
+
* Jobs with duplicate IDs will be skipped unless it's
|
|
4326
|
+
* pushed when the queue is being flushed.
|
|
4327
|
+
*/
|
|
4328
|
+
function queueWatcher (watcher) {
|
|
4329
|
+
var id = watcher.id;
|
|
4330
|
+
if (has[id] == null) {
|
|
4331
|
+
has[id] = true;
|
|
4332
|
+
if (!flushing) {
|
|
4333
|
+
queue.push(watcher);
|
|
4334
|
+
} else {
|
|
4335
|
+
// if already flushing, splice the watcher based on its id
|
|
4336
|
+
// if already past its id, it will be run next immediately.
|
|
4337
|
+
var i = queue.length - 1;
|
|
4338
|
+
while (i > index && queue[i].id > watcher.id) {
|
|
4339
|
+
i--;
|
|
4340
|
+
}
|
|
4341
|
+
queue.splice(i + 1, 0, watcher);
|
|
4342
|
+
}
|
|
4343
|
+
// queue the flush
|
|
4344
|
+
if (!waiting) {
|
|
4345
|
+
waiting = true;
|
|
4346
|
+
|
|
4347
|
+
if (process.env.NODE_ENV !== 'production' && !config.async) {
|
|
4348
|
+
flushSchedulerQueue();
|
|
4349
|
+
return
|
|
4350
|
+
}
|
|
4351
|
+
nextTick(flushSchedulerQueue);
|
|
4352
|
+
}
|
|
4376
4353
|
}
|
|
4377
4354
|
}
|
|
4378
4355
|
|
|
4379
4356
|
/* */
|
|
4380
4357
|
|
|
4381
|
-
/* */
|
|
4382
4358
|
|
|
4383
|
-
/* */
|
|
4384
4359
|
|
|
4385
|
-
|
|
4360
|
+
var uid$2 = 0;
|
|
4386
4361
|
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4362
|
+
/**
|
|
4363
|
+
* A watcher parses an expression, collects dependencies,
|
|
4364
|
+
* and fires callback when the expression value changes.
|
|
4365
|
+
* This is used for both the $watch() api and directives.
|
|
4366
|
+
*/
|
|
4367
|
+
var Watcher = function Watcher (
|
|
4368
|
+
vm,
|
|
4369
|
+
expOrFn,
|
|
4370
|
+
cb,
|
|
4371
|
+
options,
|
|
4372
|
+
isRenderWatcher
|
|
4373
|
+
) {
|
|
4374
|
+
this.vm = vm;
|
|
4375
|
+
if (isRenderWatcher) {
|
|
4376
|
+
vm._watcher = this;
|
|
4377
|
+
}
|
|
4378
|
+
vm._watchers.push(this);
|
|
4379
|
+
// options
|
|
4380
|
+
if (options) {
|
|
4381
|
+
this.deep = !!options.deep;
|
|
4382
|
+
this.user = !!options.user;
|
|
4383
|
+
this.lazy = !!options.lazy;
|
|
4384
|
+
this.sync = !!options.sync;
|
|
4385
|
+
this.before = options.before;
|
|
4386
|
+
} else {
|
|
4387
|
+
this.deep = this.user = this.lazy = this.sync = false;
|
|
4388
|
+
}
|
|
4389
|
+
this.cb = cb;
|
|
4390
|
+
this.id = ++uid$2; // uid for batching
|
|
4391
|
+
this.active = true;
|
|
4392
|
+
this.dirty = this.lazy; // for lazy watchers
|
|
4393
|
+
this.deps = [];
|
|
4394
|
+
this.newDeps = [];
|
|
4395
|
+
this.depIds = new _Set();
|
|
4396
|
+
this.newDepIds = new _Set();
|
|
4397
|
+
this.expression = process.env.NODE_ENV !== 'production'
|
|
4398
|
+
? expOrFn.toString()
|
|
4399
|
+
: '';
|
|
4400
|
+
// parse expression for getter
|
|
4401
|
+
if (typeof expOrFn === 'function') {
|
|
4402
|
+
this.getter = expOrFn;
|
|
4403
|
+
} else {
|
|
4404
|
+
this.getter = parsePath(expOrFn);
|
|
4405
|
+
if (!this.getter) {
|
|
4406
|
+
this.getter = noop;
|
|
4407
|
+
process.env.NODE_ENV !== 'production' && warn(
|
|
4408
|
+
"Failed watching path: \"" + expOrFn + "\" " +
|
|
4409
|
+
'Watcher only accepts simple dot-delimited paths. ' +
|
|
4410
|
+
'For full control, use a function instead.',
|
|
4411
|
+
vm
|
|
4402
4412
|
);
|
|
4403
|
-
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
|
4404
4413
|
}
|
|
4405
|
-
}
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
updateChildComponent(
|
|
4411
|
-
child,
|
|
4412
|
-
options.propsData, // updated props
|
|
4413
|
-
options.listeners, // updated listeners
|
|
4414
|
-
vnode, // new parent vnode
|
|
4415
|
-
options.children // new children
|
|
4416
|
-
);
|
|
4417
|
-
},
|
|
4414
|
+
}
|
|
4415
|
+
this.value = this.lazy
|
|
4416
|
+
? undefined
|
|
4417
|
+
: this.get();
|
|
4418
|
+
};
|
|
4418
4419
|
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
queueActivatedComponent(componentInstance);
|
|
4434
|
-
} else {
|
|
4435
|
-
activateChildComponent(componentInstance, true /* direct */);
|
|
4436
|
-
}
|
|
4420
|
+
/**
|
|
4421
|
+
* Evaluate the getter, and re-collect dependencies.
|
|
4422
|
+
*/
|
|
4423
|
+
Watcher.prototype.get = function get () {
|
|
4424
|
+
pushTarget(this);
|
|
4425
|
+
var value;
|
|
4426
|
+
var vm = this.vm;
|
|
4427
|
+
try {
|
|
4428
|
+
value = this.getter.call(vm, vm);
|
|
4429
|
+
} catch (e) {
|
|
4430
|
+
if (this.user) {
|
|
4431
|
+
handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
|
|
4432
|
+
} else {
|
|
4433
|
+
throw e
|
|
4437
4434
|
}
|
|
4438
|
-
}
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
if (!vnode.data.keepAlive) {
|
|
4444
|
-
componentInstance.$destroy();
|
|
4445
|
-
} else {
|
|
4446
|
-
deactivateChildComponent(componentInstance, true /* direct */);
|
|
4447
|
-
}
|
|
4435
|
+
} finally {
|
|
4436
|
+
// "touch" every property so they are all tracked as
|
|
4437
|
+
// dependencies for deep watching
|
|
4438
|
+
if (this.deep) {
|
|
4439
|
+
traverse(value);
|
|
4448
4440
|
}
|
|
4441
|
+
popTarget();
|
|
4442
|
+
this.cleanupDeps();
|
|
4449
4443
|
}
|
|
4444
|
+
return value
|
|
4450
4445
|
};
|
|
4451
4446
|
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
) {
|
|
4461
|
-
|
|
4462
|
-
|
|
4447
|
+
/**
|
|
4448
|
+
* Add a dependency to this directive.
|
|
4449
|
+
*/
|
|
4450
|
+
Watcher.prototype.addDep = function addDep (dep) {
|
|
4451
|
+
var id = dep.id;
|
|
4452
|
+
if (!this.newDepIds.has(id)) {
|
|
4453
|
+
this.newDepIds.add(id);
|
|
4454
|
+
this.newDeps.push(dep);
|
|
4455
|
+
if (!this.depIds.has(id)) {
|
|
4456
|
+
dep.addSub(this);
|
|
4457
|
+
}
|
|
4463
4458
|
}
|
|
4459
|
+
};
|
|
4464
4460
|
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4461
|
+
/**
|
|
4462
|
+
* Clean up for dependency collection.
|
|
4463
|
+
*/
|
|
4464
|
+
Watcher.prototype.cleanupDeps = function cleanupDeps () {
|
|
4465
|
+
var i = this.deps.length;
|
|
4466
|
+
while (i--) {
|
|
4467
|
+
var dep = this.deps[i];
|
|
4468
|
+
if (!this.newDepIds.has(dep.id)) {
|
|
4469
|
+
dep.removeSub(this);
|
|
4470
|
+
}
|
|
4470
4471
|
}
|
|
4472
|
+
var tmp = this.depIds;
|
|
4473
|
+
this.depIds = this.newDepIds;
|
|
4474
|
+
this.newDepIds = tmp;
|
|
4475
|
+
this.newDepIds.clear();
|
|
4476
|
+
tmp = this.deps;
|
|
4477
|
+
this.deps = this.newDeps;
|
|
4478
|
+
this.newDeps = tmp;
|
|
4479
|
+
this.newDeps.length = 0;
|
|
4480
|
+
};
|
|
4471
4481
|
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4482
|
+
/**
|
|
4483
|
+
* Subscriber interface.
|
|
4484
|
+
* Will be called when a dependency changes.
|
|
4485
|
+
*/
|
|
4486
|
+
Watcher.prototype.update = function update () {
|
|
4487
|
+
/* istanbul ignore else */
|
|
4488
|
+
if (this.lazy) {
|
|
4489
|
+
this.dirty = true;
|
|
4490
|
+
} else if (this.sync) {
|
|
4491
|
+
this.run();
|
|
4492
|
+
} else {
|
|
4493
|
+
queueWatcher(this);
|
|
4479
4494
|
}
|
|
4495
|
+
};
|
|
4480
4496
|
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
+
/**
|
|
4498
|
+
* Scheduler job interface.
|
|
4499
|
+
* Will be called by the scheduler.
|
|
4500
|
+
*/
|
|
4501
|
+
Watcher.prototype.run = function run () {
|
|
4502
|
+
if (this.active) {
|
|
4503
|
+
var value = this.get();
|
|
4504
|
+
if (
|
|
4505
|
+
value !== this.value ||
|
|
4506
|
+
// Deep watchers and watchers on Object/Arrays should fire even
|
|
4507
|
+
// when the value is the same, because the value may
|
|
4508
|
+
// have mutated.
|
|
4509
|
+
isObject(value) ||
|
|
4510
|
+
this.deep
|
|
4511
|
+
) {
|
|
4512
|
+
// set new value
|
|
4513
|
+
var oldValue = this.value;
|
|
4514
|
+
this.value = value;
|
|
4515
|
+
if (this.user) {
|
|
4516
|
+
try {
|
|
4517
|
+
this.cb.call(this.vm, value, oldValue);
|
|
4518
|
+
} catch (e) {
|
|
4519
|
+
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
|
|
4520
|
+
}
|
|
4521
|
+
} else {
|
|
4522
|
+
this.cb.call(this.vm, value, oldValue);
|
|
4523
|
+
}
|
|
4497
4524
|
}
|
|
4498
4525
|
}
|
|
4526
|
+
};
|
|
4499
4527
|
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4528
|
+
/**
|
|
4529
|
+
* Evaluate the value of the watcher.
|
|
4530
|
+
* This only gets called for lazy watchers.
|
|
4531
|
+
*/
|
|
4532
|
+
Watcher.prototype.evaluate = function evaluate () {
|
|
4533
|
+
this.value = this.get();
|
|
4534
|
+
this.dirty = false;
|
|
4535
|
+
};
|
|
4505
4536
|
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4537
|
+
/**
|
|
4538
|
+
* Depend on all deps collected by this watcher.
|
|
4539
|
+
*/
|
|
4540
|
+
Watcher.prototype.depend = function depend () {
|
|
4541
|
+
var i = this.deps.length;
|
|
4542
|
+
while (i--) {
|
|
4543
|
+
this.deps[i].depend();
|
|
4509
4544
|
}
|
|
4545
|
+
};
|
|
4510
4546
|
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
if (
|
|
4516
|
-
|
|
4547
|
+
/**
|
|
4548
|
+
* Remove self from all dependencies' subscriber list.
|
|
4549
|
+
*/
|
|
4550
|
+
Watcher.prototype.teardown = function teardown () {
|
|
4551
|
+
if (this.active) {
|
|
4552
|
+
// remove self from vm's watcher list
|
|
4553
|
+
// this is a somewhat expensive operation so we skip it
|
|
4554
|
+
// if the vm is being destroyed.
|
|
4555
|
+
if (!this.vm._isBeingDestroyed) {
|
|
4556
|
+
remove(this.vm._watchers, this);
|
|
4557
|
+
}
|
|
4558
|
+
var i = this.deps.length;
|
|
4559
|
+
while (i--) {
|
|
4560
|
+
this.deps[i].removeSub(this);
|
|
4561
|
+
}
|
|
4562
|
+
this.active = false;
|
|
4517
4563
|
}
|
|
4564
|
+
};
|
|
4518
4565
|
|
|
4519
|
-
|
|
4520
|
-
// child component listeners instead of DOM listeners
|
|
4521
|
-
var listeners = data.on;
|
|
4522
|
-
// replace with listeners with .native modifier
|
|
4523
|
-
// so it gets processed during parent component patch.
|
|
4524
|
-
data.on = data.nativeOn;
|
|
4566
|
+
/* */
|
|
4525
4567
|
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4568
|
+
var sharedPropertyDefinition = {
|
|
4569
|
+
enumerable: true,
|
|
4570
|
+
configurable: true,
|
|
4571
|
+
get: noop,
|
|
4572
|
+
set: noop
|
|
4573
|
+
};
|
|
4529
4574
|
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
}
|
|
4575
|
+
function proxy (target, sourceKey, key) {
|
|
4576
|
+
sharedPropertyDefinition.get = function proxyGetter () {
|
|
4577
|
+
return this[sourceKey][key]
|
|
4578
|
+
};
|
|
4579
|
+
sharedPropertyDefinition.set = function proxySetter (val) {
|
|
4580
|
+
this[sourceKey][key] = val;
|
|
4581
|
+
};
|
|
4582
|
+
Object.defineProperty(target, key, sharedPropertyDefinition);
|
|
4583
|
+
}
|
|
4537
4584
|
|
|
4538
|
-
|
|
4539
|
-
|
|
4585
|
+
function initState (vm) {
|
|
4586
|
+
vm._watchers = [];
|
|
4587
|
+
var opts = vm.$options;
|
|
4588
|
+
if (opts.props) { initProps(vm, opts.props); }
|
|
4589
|
+
if (opts.methods) { initMethods(vm, opts.methods); }
|
|
4590
|
+
if (opts.data) {
|
|
4591
|
+
initData(vm);
|
|
4592
|
+
} else {
|
|
4593
|
+
observe(vm._data = {}, true /* asRootData */);
|
|
4594
|
+
}
|
|
4595
|
+
if (opts.computed) { initComputed(vm, opts.computed); }
|
|
4596
|
+
if (opts.watch && opts.watch !== nativeWatch) {
|
|
4597
|
+
initWatch(vm, opts.watch);
|
|
4598
|
+
}
|
|
4599
|
+
}
|
|
4540
4600
|
|
|
4541
|
-
|
|
4542
|
-
var
|
|
4543
|
-
var
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4601
|
+
function initProps (vm, propsOptions) {
|
|
4602
|
+
var propsData = vm.$options.propsData || {};
|
|
4603
|
+
var props = vm._props = {};
|
|
4604
|
+
// cache prop keys so that future props updates can iterate using Array
|
|
4605
|
+
// instead of dynamic object key enumeration.
|
|
4606
|
+
var keys = vm.$options._propKeys = [];
|
|
4607
|
+
var isRoot = !vm.$parent;
|
|
4608
|
+
// root instance props should be converted
|
|
4609
|
+
if (!isRoot) {
|
|
4610
|
+
toggleObserving(false);
|
|
4611
|
+
}
|
|
4612
|
+
var loop = function ( key ) {
|
|
4613
|
+
keys.push(key);
|
|
4614
|
+
var value = validateProp(key, propsOptions, propsData, vm);
|
|
4615
|
+
/* istanbul ignore else */
|
|
4616
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4617
|
+
var hyphenatedKey = hyphenate(key);
|
|
4618
|
+
if (isReservedAttribute(hyphenatedKey) ||
|
|
4619
|
+
config.isReservedAttr(hyphenatedKey)) {
|
|
4620
|
+
warn(
|
|
4621
|
+
("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
|
|
4622
|
+
vm
|
|
4623
|
+
);
|
|
4624
|
+
}
|
|
4625
|
+
defineReactive$$1(props, key, value, function () {
|
|
4626
|
+
if (!isRoot && !isUpdatingChildComponent) {
|
|
4627
|
+
warn(
|
|
4628
|
+
"Avoid mutating a prop directly since the value will be " +
|
|
4629
|
+
"overwritten whenever the parent component re-renders. " +
|
|
4630
|
+
"Instead, use a data or computed property based on the prop's " +
|
|
4631
|
+
"value. Prop being mutated: \"" + key + "\"",
|
|
4632
|
+
vm
|
|
4633
|
+
);
|
|
4634
|
+
}
|
|
4635
|
+
});
|
|
4636
|
+
} else {
|
|
4637
|
+
defineReactive$$1(props, key, value);
|
|
4638
|
+
}
|
|
4639
|
+
// static props are already proxied on the component's prototype
|
|
4640
|
+
// during Vue.extend(). We only need to proxy props defined at
|
|
4641
|
+
// instantiation here.
|
|
4642
|
+
if (!(key in vm)) {
|
|
4643
|
+
proxy(vm, "_props", key);
|
|
4644
|
+
}
|
|
4645
|
+
};
|
|
4549
4646
|
|
|
4550
|
-
|
|
4647
|
+
for (var key in propsOptions) loop( key );
|
|
4648
|
+
toggleObserving(true);
|
|
4551
4649
|
}
|
|
4552
4650
|
|
|
4553
|
-
function
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
)
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
options.render = inlineTemplate.render;
|
|
4566
|
-
options.staticRenderFns = inlineTemplate.staticRenderFns;
|
|
4651
|
+
function initData (vm) {
|
|
4652
|
+
var data = vm.$options.data;
|
|
4653
|
+
data = vm._data = typeof data === 'function'
|
|
4654
|
+
? getData(data, vm)
|
|
4655
|
+
: data || {};
|
|
4656
|
+
if (!isPlainObject(data)) {
|
|
4657
|
+
data = {};
|
|
4658
|
+
process.env.NODE_ENV !== 'production' && warn(
|
|
4659
|
+
'data functions should return an object:\n' +
|
|
4660
|
+
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
|
4661
|
+
vm
|
|
4662
|
+
);
|
|
4567
4663
|
}
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
var
|
|
4573
|
-
|
|
4574
|
-
var key =
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4664
|
+
// proxy data on instance
|
|
4665
|
+
var keys = Object.keys(data);
|
|
4666
|
+
var props = vm.$options.props;
|
|
4667
|
+
var methods = vm.$options.methods;
|
|
4668
|
+
var i = keys.length;
|
|
4669
|
+
while (i--) {
|
|
4670
|
+
var key = keys[i];
|
|
4671
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4672
|
+
if (methods && hasOwn(methods, key)) {
|
|
4673
|
+
warn(
|
|
4674
|
+
("Method \"" + key + "\" has already been defined as a data property."),
|
|
4675
|
+
vm
|
|
4676
|
+
);
|
|
4677
|
+
}
|
|
4678
|
+
}
|
|
4679
|
+
if (props && hasOwn(props, key)) {
|
|
4680
|
+
process.env.NODE_ENV !== 'production' && warn(
|
|
4681
|
+
"The data property \"" + key + "\" is already declared as a prop. " +
|
|
4682
|
+
"Use prop default value instead.",
|
|
4683
|
+
vm
|
|
4684
|
+
);
|
|
4685
|
+
} else if (!isReserved(key)) {
|
|
4686
|
+
proxy(vm, "_data", key);
|
|
4579
4687
|
}
|
|
4580
4688
|
}
|
|
4689
|
+
// observe data
|
|
4690
|
+
observe(data, true /* asRootData */);
|
|
4581
4691
|
}
|
|
4582
4692
|
|
|
4583
|
-
function
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
}
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
}
|
|
4592
|
-
|
|
4593
|
-
// transform component v-model info (value and callback) into
|
|
4594
|
-
// prop and event handler respectively.
|
|
4595
|
-
function transformModel (options, data) {
|
|
4596
|
-
var prop = (options.model && options.model.prop) || 'value';
|
|
4597
|
-
var event = (options.model && options.model.event) || 'input'
|
|
4598
|
-
;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
|
|
4599
|
-
var on = data.on || (data.on = {});
|
|
4600
|
-
var existing = on[event];
|
|
4601
|
-
var callback = data.model.callback;
|
|
4602
|
-
if (isDef(existing)) {
|
|
4603
|
-
if (
|
|
4604
|
-
Array.isArray(existing)
|
|
4605
|
-
? existing.indexOf(callback) === -1
|
|
4606
|
-
: existing !== callback
|
|
4607
|
-
) {
|
|
4608
|
-
on[event] = [callback].concat(existing);
|
|
4609
|
-
}
|
|
4610
|
-
} else {
|
|
4611
|
-
on[event] = callback;
|
|
4693
|
+
function getData (data, vm) {
|
|
4694
|
+
// #7573 disable dep collection when invoking data getters
|
|
4695
|
+
pushTarget();
|
|
4696
|
+
try {
|
|
4697
|
+
return data.call(vm, vm)
|
|
4698
|
+
} catch (e) {
|
|
4699
|
+
handleError(e, vm, "data()");
|
|
4700
|
+
return {}
|
|
4701
|
+
} finally {
|
|
4702
|
+
popTarget();
|
|
4612
4703
|
}
|
|
4613
4704
|
}
|
|
4614
4705
|
|
|
4615
|
-
|
|
4706
|
+
var computedWatcherOptions = { lazy: true };
|
|
4616
4707
|
|
|
4617
|
-
|
|
4618
|
-
|
|
4708
|
+
function initComputed (vm, computed) {
|
|
4709
|
+
// $flow-disable-line
|
|
4710
|
+
var watchers = vm._computedWatchers = Object.create(null);
|
|
4711
|
+
// computed properties are just getters during SSR
|
|
4712
|
+
var isSSR = isServerRendering();
|
|
4619
4713
|
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
function
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4714
|
+
for (var key in computed) {
|
|
4715
|
+
var userDef = computed[key];
|
|
4716
|
+
var getter = typeof userDef === 'function' ? userDef : userDef.get;
|
|
4717
|
+
if (process.env.NODE_ENV !== 'production' && getter == null) {
|
|
4718
|
+
warn(
|
|
4719
|
+
("Getter is missing for computed property \"" + key + "\"."),
|
|
4720
|
+
vm
|
|
4721
|
+
);
|
|
4722
|
+
}
|
|
4723
|
+
|
|
4724
|
+
if (!isSSR) {
|
|
4725
|
+
// create internal watcher for the computed property.
|
|
4726
|
+
watchers[key] = new Watcher(
|
|
4727
|
+
vm,
|
|
4728
|
+
getter || noop,
|
|
4729
|
+
noop,
|
|
4730
|
+
computedWatcherOptions
|
|
4731
|
+
);
|
|
4732
|
+
}
|
|
4733
|
+
|
|
4734
|
+
// component-defined computed properties are already defined on the
|
|
4735
|
+
// component prototype. We only need to define computed properties defined
|
|
4736
|
+
// at instantiation here.
|
|
4737
|
+
if (!(key in vm)) {
|
|
4738
|
+
defineComputed(vm, key, userDef);
|
|
4739
|
+
} else if (process.env.NODE_ENV !== 'production') {
|
|
4740
|
+
if (key in vm.$data) {
|
|
4741
|
+
warn(("The computed property \"" + key + "\" is already defined in data."), vm);
|
|
4742
|
+
} else if (vm.$options.props && key in vm.$options.props) {
|
|
4743
|
+
warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
|
|
4744
|
+
}
|
|
4745
|
+
}
|
|
4637
4746
|
}
|
|
4638
|
-
return _createElement(context, tag, data, children, normalizationType)
|
|
4639
4747
|
}
|
|
4640
4748
|
|
|
4641
|
-
function
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
children,
|
|
4646
|
-
normalizationType
|
|
4749
|
+
function defineComputed (
|
|
4750
|
+
target,
|
|
4751
|
+
key,
|
|
4752
|
+
userDef
|
|
4647
4753
|
) {
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
// in case of component :is set to falsy value
|
|
4662
|
-
return createEmptyVNode()
|
|
4754
|
+
var shouldCache = !isServerRendering();
|
|
4755
|
+
if (typeof userDef === 'function') {
|
|
4756
|
+
sharedPropertyDefinition.get = shouldCache
|
|
4757
|
+
? createComputedGetter(key)
|
|
4758
|
+
: createGetterInvoker(userDef);
|
|
4759
|
+
sharedPropertyDefinition.set = noop;
|
|
4760
|
+
} else {
|
|
4761
|
+
sharedPropertyDefinition.get = userDef.get
|
|
4762
|
+
? shouldCache && userDef.cache !== false
|
|
4763
|
+
? createComputedGetter(key)
|
|
4764
|
+
: createGetterInvoker(userDef.get)
|
|
4765
|
+
: noop;
|
|
4766
|
+
sharedPropertyDefinition.set = userDef.set || noop;
|
|
4663
4767
|
}
|
|
4664
|
-
// warn against non-primitive key
|
|
4665
4768
|
if (process.env.NODE_ENV !== 'production' &&
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
'use string/number value instead.',
|
|
4672
|
-
context
|
|
4673
|
-
);
|
|
4674
|
-
}
|
|
4675
|
-
}
|
|
4676
|
-
// support single function children as default scoped slot
|
|
4677
|
-
if (Array.isArray(children) &&
|
|
4678
|
-
typeof children[0] === 'function'
|
|
4679
|
-
) {
|
|
4680
|
-
data = data || {};
|
|
4681
|
-
data.scopedSlots = { default: children[0] };
|
|
4682
|
-
children.length = 0;
|
|
4683
|
-
}
|
|
4684
|
-
if (normalizationType === ALWAYS_NORMALIZE) {
|
|
4685
|
-
children = normalizeChildren(children);
|
|
4686
|
-
} else if (normalizationType === SIMPLE_NORMALIZE) {
|
|
4687
|
-
children = simpleNormalizeChildren(children);
|
|
4688
|
-
}
|
|
4689
|
-
var vnode, ns;
|
|
4690
|
-
if (typeof tag === 'string') {
|
|
4691
|
-
var Ctor;
|
|
4692
|
-
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
|
4693
|
-
if (config.isReservedTag(tag)) {
|
|
4694
|
-
// platform built-in elements
|
|
4695
|
-
vnode = new VNode(
|
|
4696
|
-
config.parsePlatformTagName(tag), data, children,
|
|
4697
|
-
undefined, undefined, context
|
|
4698
|
-
);
|
|
4699
|
-
} else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
|
|
4700
|
-
// component
|
|
4701
|
-
vnode = createComponent(Ctor, data, context, children, tag);
|
|
4702
|
-
} else {
|
|
4703
|
-
// unknown or unlisted namespaced elements
|
|
4704
|
-
// check at runtime because it may get assigned a namespace when its
|
|
4705
|
-
// parent normalizes children
|
|
4706
|
-
vnode = new VNode(
|
|
4707
|
-
tag, data, children,
|
|
4708
|
-
undefined, undefined, context
|
|
4769
|
+
sharedPropertyDefinition.set === noop) {
|
|
4770
|
+
sharedPropertyDefinition.set = function () {
|
|
4771
|
+
warn(
|
|
4772
|
+
("Computed property \"" + key + "\" was assigned to but it has no setter."),
|
|
4773
|
+
this
|
|
4709
4774
|
);
|
|
4775
|
+
};
|
|
4776
|
+
}
|
|
4777
|
+
Object.defineProperty(target, key, sharedPropertyDefinition);
|
|
4778
|
+
}
|
|
4779
|
+
|
|
4780
|
+
function createComputedGetter (key) {
|
|
4781
|
+
return function computedGetter () {
|
|
4782
|
+
var watcher = this._computedWatchers && this._computedWatchers[key];
|
|
4783
|
+
if (watcher) {
|
|
4784
|
+
if (watcher.dirty) {
|
|
4785
|
+
watcher.evaluate();
|
|
4786
|
+
}
|
|
4787
|
+
if (Dep.target) {
|
|
4788
|
+
watcher.depend();
|
|
4789
|
+
}
|
|
4790
|
+
return watcher.value
|
|
4710
4791
|
}
|
|
4711
|
-
} else {
|
|
4712
|
-
// direct component options / constructor
|
|
4713
|
-
vnode = createComponent(tag, data, context, children);
|
|
4714
4792
|
}
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
return vnode
|
|
4721
|
-
} else {
|
|
4722
|
-
return createEmptyVNode()
|
|
4793
|
+
}
|
|
4794
|
+
|
|
4795
|
+
function createGetterInvoker(fn) {
|
|
4796
|
+
return function computedGetter () {
|
|
4797
|
+
return fn.call(this, this)
|
|
4723
4798
|
}
|
|
4724
4799
|
}
|
|
4725
4800
|
|
|
4726
|
-
function
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4801
|
+
function initMethods (vm, methods) {
|
|
4802
|
+
var props = vm.$options.props;
|
|
4803
|
+
for (var key in methods) {
|
|
4804
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
4805
|
+
if (typeof methods[key] !== 'function') {
|
|
4806
|
+
warn(
|
|
4807
|
+
"Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
|
|
4808
|
+
"Did you reference the function correctly?",
|
|
4809
|
+
vm
|
|
4810
|
+
);
|
|
4811
|
+
}
|
|
4812
|
+
if (props && hasOwn(props, key)) {
|
|
4813
|
+
warn(
|
|
4814
|
+
("Method \"" + key + "\" has already been defined as a prop."),
|
|
4815
|
+
vm
|
|
4816
|
+
);
|
|
4817
|
+
}
|
|
4818
|
+
if ((key in vm) && isReserved(key)) {
|
|
4819
|
+
warn(
|
|
4820
|
+
"Method \"" + key + "\" conflicts with an existing Vue instance method. " +
|
|
4821
|
+
"Avoid defining component methods that start with _ or $."
|
|
4822
|
+
);
|
|
4823
|
+
}
|
|
4824
|
+
}
|
|
4825
|
+
vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
|
|
4732
4826
|
}
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4827
|
+
}
|
|
4828
|
+
|
|
4829
|
+
function initWatch (vm, watch) {
|
|
4830
|
+
for (var key in watch) {
|
|
4831
|
+
var handler = watch[key];
|
|
4832
|
+
if (Array.isArray(handler)) {
|
|
4833
|
+
for (var i = 0; i < handler.length; i++) {
|
|
4834
|
+
createWatcher(vm, key, handler[i]);
|
|
4739
4835
|
}
|
|
4836
|
+
} else {
|
|
4837
|
+
createWatcher(vm, key, handler);
|
|
4740
4838
|
}
|
|
4741
4839
|
}
|
|
4742
4840
|
}
|
|
4743
4841
|
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4842
|
+
function createWatcher (
|
|
4843
|
+
vm,
|
|
4844
|
+
expOrFn,
|
|
4845
|
+
handler,
|
|
4846
|
+
options
|
|
4847
|
+
) {
|
|
4848
|
+
if (isPlainObject(handler)) {
|
|
4849
|
+
options = handler;
|
|
4850
|
+
handler = handler.handler;
|
|
4750
4851
|
}
|
|
4751
|
-
if (
|
|
4752
|
-
|
|
4852
|
+
if (typeof handler === 'string') {
|
|
4853
|
+
handler = vm[handler];
|
|
4753
4854
|
}
|
|
4855
|
+
return vm.$watch(expOrFn, handler, options)
|
|
4754
4856
|
}
|
|
4755
4857
|
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
var
|
|
4763
|
-
|
|
4764
|
-
vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
|
4765
|
-
vm.$scopedSlots = emptyObject;
|
|
4766
|
-
// bind the createElement fn to this instance
|
|
4767
|
-
// so that we get proper render context inside it.
|
|
4768
|
-
// args order: tag, data, children, normalizationType, alwaysNormalize
|
|
4769
|
-
// internal version is used by render functions compiled from templates
|
|
4770
|
-
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
|
4771
|
-
// normalization is always applied for the public version, used in
|
|
4772
|
-
// user-written render functions.
|
|
4773
|
-
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
|
|
4774
|
-
|
|
4775
|
-
// $attrs & $listeners are exposed for easier HOC creation.
|
|
4776
|
-
// they need to be reactive so that HOCs using them are always updated
|
|
4777
|
-
var parentData = parentVnode && parentVnode.data;
|
|
4778
|
-
|
|
4779
|
-
/* istanbul ignore else */
|
|
4858
|
+
function stateMixin (Vue) {
|
|
4859
|
+
// flow somehow has problems with directly declared definition object
|
|
4860
|
+
// when using Object.defineProperty, so we have to procedurally build up
|
|
4861
|
+
// the object here.
|
|
4862
|
+
var dataDef = {};
|
|
4863
|
+
dataDef.get = function () { return this._data };
|
|
4864
|
+
var propsDef = {};
|
|
4865
|
+
propsDef.get = function () { return this._props };
|
|
4780
4866
|
if (process.env.NODE_ENV !== 'production') {
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4867
|
+
dataDef.set = function () {
|
|
4868
|
+
warn(
|
|
4869
|
+
'Avoid replacing instance root $data. ' +
|
|
4870
|
+
'Use nested data properties instead.',
|
|
4871
|
+
this
|
|
4872
|
+
);
|
|
4873
|
+
};
|
|
4874
|
+
propsDef.set = function () {
|
|
4875
|
+
warn("$props is readonly.", this);
|
|
4876
|
+
};
|
|
4790
4877
|
}
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
function renderMixin (Vue) {
|
|
4794
|
-
// install runtime convenience helpers
|
|
4795
|
-
installRenderHelpers(Vue.prototype);
|
|
4878
|
+
Object.defineProperty(Vue.prototype, '$data', dataDef);
|
|
4879
|
+
Object.defineProperty(Vue.prototype, '$props', propsDef);
|
|
4796
4880
|
|
|
4797
|
-
Vue.prototype.$
|
|
4798
|
-
|
|
4799
|
-
};
|
|
4881
|
+
Vue.prototype.$set = set;
|
|
4882
|
+
Vue.prototype.$delete = del;
|
|
4800
4883
|
|
|
4801
|
-
Vue.prototype
|
|
4884
|
+
Vue.prototype.$watch = function (
|
|
4885
|
+
expOrFn,
|
|
4886
|
+
cb,
|
|
4887
|
+
options
|
|
4888
|
+
) {
|
|
4802
4889
|
var vm = this;
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
var _parentVnode = ref._parentVnode;
|
|
4806
|
-
|
|
4807
|
-
if (_parentVnode) {
|
|
4808
|
-
vm.$scopedSlots = normalizeScopedSlots(
|
|
4809
|
-
_parentVnode.data.scopedSlots,
|
|
4810
|
-
vm.$slots
|
|
4811
|
-
);
|
|
4890
|
+
if (isPlainObject(cb)) {
|
|
4891
|
+
return createWatcher(vm, expOrFn, cb, options)
|
|
4812
4892
|
}
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
} catch (e) {
|
|
4822
|
-
handleError(e, vm, "render");
|
|
4823
|
-
// return error render result,
|
|
4824
|
-
// or previous vnode to prevent render error causing blank component
|
|
4825
|
-
/* istanbul ignore else */
|
|
4826
|
-
if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) {
|
|
4827
|
-
try {
|
|
4828
|
-
vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
|
|
4829
|
-
} catch (e) {
|
|
4830
|
-
handleError(e, vm, "renderError");
|
|
4831
|
-
vnode = vm._vnode;
|
|
4832
|
-
}
|
|
4833
|
-
} else {
|
|
4834
|
-
vnode = vm._vnode;
|
|
4893
|
+
options = options || {};
|
|
4894
|
+
options.user = true;
|
|
4895
|
+
var watcher = new Watcher(vm, expOrFn, cb, options);
|
|
4896
|
+
if (options.immediate) {
|
|
4897
|
+
try {
|
|
4898
|
+
cb.call(vm, watcher.value);
|
|
4899
|
+
} catch (error) {
|
|
4900
|
+
handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
|
|
4835
4901
|
}
|
|
4836
4902
|
}
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
vnode = vnode[0];
|
|
4840
|
-
}
|
|
4841
|
-
// return empty vnode in case the render function errored out
|
|
4842
|
-
if (!(vnode instanceof VNode)) {
|
|
4843
|
-
if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
|
|
4844
|
-
warn(
|
|
4845
|
-
'Multiple root nodes returned from render function. Render function ' +
|
|
4846
|
-
'should return a single root node.',
|
|
4847
|
-
vm
|
|
4848
|
-
);
|
|
4849
|
-
}
|
|
4850
|
-
vnode = createEmptyVNode();
|
|
4903
|
+
return function unwatchFn () {
|
|
4904
|
+
watcher.teardown();
|
|
4851
4905
|
}
|
|
4852
|
-
// set parent
|
|
4853
|
-
vnode.parent = _parentVnode;
|
|
4854
|
-
return vnode
|
|
4855
4906
|
};
|
|
4856
4907
|
}
|
|
4857
4908
|
|
|
@@ -5348,7 +5399,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
|
|
5348
5399
|
value: FunctionalRenderContext
|
|
5349
5400
|
});
|
|
5350
5401
|
|
|
5351
|
-
Vue.version = '2.6.
|
|
5402
|
+
Vue.version = '2.6.6';
|
|
5352
5403
|
|
|
5353
5404
|
/* */
|
|
5354
5405
|
|
|
@@ -7414,6 +7465,11 @@ function createOnceHandler$1 (event, handler, capture) {
|
|
|
7414
7465
|
}
|
|
7415
7466
|
}
|
|
7416
7467
|
|
|
7468
|
+
// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
|
|
7469
|
+
// implementation and does not fire microtasks in between event propagation, so
|
|
7470
|
+
// safe to exclude.
|
|
7471
|
+
var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
|
|
7472
|
+
|
|
7417
7473
|
function add$1 (
|
|
7418
7474
|
name,
|
|
7419
7475
|
handler,
|
|
@@ -7426,11 +7482,24 @@ function add$1 (
|
|
|
7426
7482
|
// the solution is simple: we save the timestamp when a handler is attached,
|
|
7427
7483
|
// and the handler would only fire if the event passed to it was fired
|
|
7428
7484
|
// AFTER it was attached.
|
|
7429
|
-
if (
|
|
7485
|
+
if (useMicrotaskFix) {
|
|
7430
7486
|
var attachedTimestamp = currentFlushTimestamp;
|
|
7431
7487
|
var original = handler;
|
|
7432
7488
|
handler = original._wrapper = function (e) {
|
|
7433
|
-
if (
|
|
7489
|
+
if (
|
|
7490
|
+
// no bubbling, should always fire.
|
|
7491
|
+
// this is just a safety net in case event.timeStamp is unreliable in
|
|
7492
|
+
// certain weird environments...
|
|
7493
|
+
e.target === e.currentTarget ||
|
|
7494
|
+
// event is fired after handler attachment
|
|
7495
|
+
e.timeStamp >= attachedTimestamp ||
|
|
7496
|
+
// #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
|
|
7497
|
+
e.timeStamp === 0 ||
|
|
7498
|
+
// #9448 bail if event is fired in another document in a multi-page
|
|
7499
|
+
// electron/nw.js app, since event.timeStamp will be using a different
|
|
7500
|
+
// starting reference
|
|
7501
|
+
e.target.ownerDocument !== document
|
|
7502
|
+
) {
|
|
7434
7503
|
return original.apply(this, arguments)
|
|
7435
7504
|
}
|
|
7436
7505
|
};
|
|
@@ -9449,6 +9518,8 @@ var invalidAttributeRE = /[\s"'<>\/=]/;
|
|
|
9449
9518
|
|
|
9450
9519
|
var decodeHTMLCached = cached(he.decode);
|
|
9451
9520
|
|
|
9521
|
+
var emptySlotScopeToken = "_empty_";
|
|
9522
|
+
|
|
9452
9523
|
// configurable state
|
|
9453
9524
|
var warn$2;
|
|
9454
9525
|
var delimiters;
|
|
@@ -10061,7 +10132,7 @@ function processSlotContent (el) {
|
|
|
10061
10132
|
var dynamic = ref.dynamic;
|
|
10062
10133
|
el.slotTarget = name;
|
|
10063
10134
|
el.slotTargetDynamic = dynamic;
|
|
10064
|
-
el.slotScope = slotBinding.value ||
|
|
10135
|
+
el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
|
|
10065
10136
|
}
|
|
10066
10137
|
} else {
|
|
10067
10138
|
// v-slot on component, denotes default slot
|
|
@@ -10096,8 +10167,13 @@ function processSlotContent (el) {
|
|
|
10096
10167
|
var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
|
10097
10168
|
slotContainer.slotTarget = name$1;
|
|
10098
10169
|
slotContainer.slotTargetDynamic = dynamic$1;
|
|
10099
|
-
slotContainer.children = el.children.filter(function (c) {
|
|
10100
|
-
|
|
10170
|
+
slotContainer.children = el.children.filter(function (c) {
|
|
10171
|
+
if (!c.slotScope) {
|
|
10172
|
+
c.parent = slotContainer;
|
|
10173
|
+
return true
|
|
10174
|
+
}
|
|
10175
|
+
});
|
|
10176
|
+
slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
|
|
10101
10177
|
// remove children as they are returned from scopedSlots now
|
|
10102
10178
|
el.children = [];
|
|
10103
10179
|
// mark el non-plain so data gets generated
|
|
@@ -10746,7 +10822,13 @@ function genHandler (handler) {
|
|
|
10746
10822
|
}
|
|
10747
10823
|
|
|
10748
10824
|
function genKeyFilter (keys) {
|
|
10749
|
-
return (
|
|
10825
|
+
return (
|
|
10826
|
+
// make sure the key filters only apply to KeyboardEvents
|
|
10827
|
+
// #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
|
|
10828
|
+
// key events that do not have keyCode property...
|
|
10829
|
+
"if(!$event.type.indexOf('key')&&" +
|
|
10830
|
+
(keys.map(genFilterCode).join('&&')) + ")return null;"
|
|
10831
|
+
)
|
|
10750
10832
|
}
|
|
10751
10833
|
|
|
10752
10834
|
function genFilterCode (key) {
|
|
@@ -11029,7 +11111,7 @@ function genData$2 (el, state) {
|
|
|
11029
11111
|
}
|
|
11030
11112
|
// scoped slots
|
|
11031
11113
|
if (el.scopedSlots) {
|
|
11032
|
-
data += (genScopedSlots(el.scopedSlots, state)) + ",";
|
|
11114
|
+
data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
|
|
11033
11115
|
}
|
|
11034
11116
|
// component v-model
|
|
11035
11117
|
if (el.model) {
|
|
@@ -11102,16 +11184,49 @@ function genInlineTemplate (el, state) {
|
|
|
11102
11184
|
}
|
|
11103
11185
|
|
|
11104
11186
|
function genScopedSlots (
|
|
11187
|
+
el,
|
|
11105
11188
|
slots,
|
|
11106
11189
|
state
|
|
11107
11190
|
) {
|
|
11108
|
-
|
|
11191
|
+
// by default scoped slots are considered "stable", this allows child
|
|
11192
|
+
// components with only scoped slots to skip forced updates from parent.
|
|
11193
|
+
// but in some cases we have to bail-out of this optimization
|
|
11194
|
+
// for example if the slot contains dynamic names, has v-if or v-for on them...
|
|
11195
|
+
var needsForceUpdate = Object.keys(slots).some(function (key) {
|
|
11109
11196
|
var slot = slots[key];
|
|
11110
|
-
return
|
|
11197
|
+
return (
|
|
11198
|
+
slot.slotTargetDynamic ||
|
|
11199
|
+
slot.if ||
|
|
11200
|
+
slot.for ||
|
|
11201
|
+
containsSlotChild(slot) // is passing down slot from parent which may be dynamic
|
|
11202
|
+
)
|
|
11111
11203
|
});
|
|
11204
|
+
// OR when it is inside another scoped slot (the reactivity is disconnected)
|
|
11205
|
+
// #9438
|
|
11206
|
+
if (!needsForceUpdate) {
|
|
11207
|
+
var parent = el.parent;
|
|
11208
|
+
while (parent) {
|
|
11209
|
+
if (parent.slotScope && parent.slotScope !== emptySlotScopeToken) {
|
|
11210
|
+
needsForceUpdate = true;
|
|
11211
|
+
break
|
|
11212
|
+
}
|
|
11213
|
+
parent = parent.parent;
|
|
11214
|
+
}
|
|
11215
|
+
}
|
|
11216
|
+
|
|
11112
11217
|
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
|
|
11113
11218
|
return genScopedSlot(slots[key], state)
|
|
11114
|
-
}).join(',')) + "]" + (
|
|
11219
|
+
}).join(',')) + "]" + (needsForceUpdate ? ",true" : "") + ")")
|
|
11220
|
+
}
|
|
11221
|
+
|
|
11222
|
+
function containsSlotChild (el) {
|
|
11223
|
+
if (el.type === 1) {
|
|
11224
|
+
if (el.tag === 'slot') {
|
|
11225
|
+
return true
|
|
11226
|
+
}
|
|
11227
|
+
return el.children.some(containsSlotChild)
|
|
11228
|
+
}
|
|
11229
|
+
return false
|
|
11115
11230
|
}
|
|
11116
11231
|
|
|
11117
11232
|
function genScopedSlot (
|
|
@@ -11125,13 +11240,18 @@ function genScopedSlot (
|
|
|
11125
11240
|
if (el.for && !el.forProcessed) {
|
|
11126
11241
|
return genFor(el, state, genScopedSlot)
|
|
11127
11242
|
}
|
|
11128
|
-
var
|
|
11243
|
+
var slotScope = el.slotScope === emptySlotScopeToken
|
|
11244
|
+
? ""
|
|
11245
|
+
: String(el.slotScope);
|
|
11246
|
+
var fn = "function(" + slotScope + "){" +
|
|
11129
11247
|
"return " + (el.tag === 'template'
|
|
11130
11248
|
? el.if && isLegacySyntax
|
|
11131
11249
|
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
|
|
11132
11250
|
: genChildren(el, state) || 'undefined'
|
|
11133
11251
|
: genElement(el, state)) + "}";
|
|
11134
|
-
|
|
11252
|
+
// reverse proxy v-slot without scope on this.$slots
|
|
11253
|
+
var reverseProxy = slotScope ? "" : ",proxy:true";
|
|
11254
|
+
return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
|
|
11135
11255
|
}
|
|
11136
11256
|
|
|
11137
11257
|
function genChildren (
|
|
@@ -11218,7 +11338,14 @@ function genSlot (el, state) {
|
|
|
11218
11338
|
var slotName = el.slotName || '"default"';
|
|
11219
11339
|
var children = genChildren(el, state);
|
|
11220
11340
|
var res = "_t(" + slotName + (children ? ("," + children) : '');
|
|
11221
|
-
var attrs = el.attrs
|
|
11341
|
+
var attrs = el.attrs || el.dynamicAttrs
|
|
11342
|
+
? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
|
|
11343
|
+
// slot props are camelized
|
|
11344
|
+
name: camelize(attr.name),
|
|
11345
|
+
value: attr.value,
|
|
11346
|
+
dynamic: attr.dynamic
|
|
11347
|
+
}); }))
|
|
11348
|
+
: null;
|
|
11222
11349
|
var bind$$1 = el.attrsMap['v-bind'];
|
|
11223
11350
|
if ((attrs || bind$$1) && !children) {
|
|
11224
11351
|
res += ",null";
|