vue 2.6.9 → 2.6.13
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 +133 -74
- package/dist/README.md +2 -4
- package/dist/vue.common.dev.js +195 -107
- package/dist/vue.common.prod.js +3 -3
- package/dist/vue.esm.browser.js +189 -107
- package/dist/vue.esm.browser.min.js +3 -3
- package/dist/vue.esm.js +195 -107
- package/dist/vue.js +195 -107
- package/dist/vue.min.js +3 -3
- package/dist/vue.runtime.common.dev.js +159 -91
- package/dist/vue.runtime.common.prod.js +3 -3
- package/dist/vue.runtime.esm.js +159 -91
- package/dist/vue.runtime.js +159 -91
- package/dist/vue.runtime.min.js +3 -3
- package/package.json +5 -5
- package/src/compiler/codegen/events.js +3 -3
- package/src/compiler/codegen/index.js +3 -2
- package/src/compiler/error-detector.js +18 -3
- package/src/compiler/parser/html-parser.js +3 -3
- package/src/compiler/parser/index.js +11 -7
- package/src/core/components/keep-alive.js +42 -14
- package/src/core/instance/lifecycle.js +2 -1
- package/src/core/instance/proxy.js +2 -2
- package/src/core/instance/render-helpers/bind-dynamic-keys.js +2 -2
- package/src/core/instance/render-helpers/check-keycodes.js +1 -0
- package/src/core/instance/render-helpers/render-slot.js +10 -8
- package/src/core/instance/render.js +1 -1
- package/src/core/instance/state.js +8 -6
- package/src/core/observer/scheduler.js +17 -11
- package/src/core/observer/watcher.js +3 -5
- package/src/core/util/env.js +1 -2
- package/src/core/util/next-tick.js +1 -1
- package/src/core/util/props.js +24 -15
- package/src/core/vdom/create-component.js +4 -2
- package/src/core/vdom/create-element.js +6 -0
- package/src/core/vdom/helpers/normalize-scoped-slots.js +5 -3
- package/src/core/vdom/helpers/resolve-async-component.js +14 -2
- package/src/core/vdom/patch.js +6 -6
- package/src/platforms/web/compiler/modules/model.js +1 -1
- package/src/platforms/web/runtime/modules/attrs.js +3 -3
- package/src/platforms/web/runtime/modules/dom-props.js +3 -2
- package/src/platforms/web/server/modules/attrs.js +4 -0
- package/src/platforms/web/server/modules/dom-props.js +2 -2
- package/src/platforms/web/server/util.js +4 -4
- package/src/platforms/web/util/attrs.js +1 -1
- package/src/platforms/web/util/element.js +1 -1
- package/src/server/template-renderer/create-async-file-mapper.js +5 -1
- package/types/index.d.ts +1 -2
- package/types/options.d.ts +3 -3
- package/types/umd.d.ts +48 -0
- package/types/vnode.d.ts +3 -3
- package/types/vue.d.ts +5 -1
- package/src/.DS_Store +0 -0
- package/src/compiler/.DS_Store +0 -0
- package/src/platforms/.DS_Store +0 -0
- package/src/platforms/weex/.DS_Store +0 -0
- package/src/platforms/weex/compiler/.DS_Store +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vue.js v2.6.
|
|
3
|
-
* (c) 2014-
|
|
2
|
+
* Vue.js v2.6.13
|
|
3
|
+
* (c) 2014-2021 Evan You
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
@@ -1691,13 +1691,14 @@ function assertProp (
|
|
|
1691
1691
|
type = [type];
|
|
1692
1692
|
}
|
|
1693
1693
|
for (var i = 0; i < type.length && !valid; i++) {
|
|
1694
|
-
var assertedType = assertType(value, type[i]);
|
|
1694
|
+
var assertedType = assertType(value, type[i], vm);
|
|
1695
1695
|
expectedTypes.push(assertedType.expectedType || '');
|
|
1696
1696
|
valid = assertedType.valid;
|
|
1697
1697
|
}
|
|
1698
1698
|
}
|
|
1699
1699
|
|
|
1700
|
-
|
|
1700
|
+
var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
|
|
1701
|
+
if (!valid && haveExpectedTypes) {
|
|
1701
1702
|
warn(
|
|
1702
1703
|
getInvalidTypeMessage(name, value, expectedTypes),
|
|
1703
1704
|
vm
|
|
@@ -1715,9 +1716,9 @@ function assertProp (
|
|
|
1715
1716
|
}
|
|
1716
1717
|
}
|
|
1717
1718
|
|
|
1718
|
-
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
|
|
1719
|
+
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
|
|
1719
1720
|
|
|
1720
|
-
function assertType (value, type) {
|
|
1721
|
+
function assertType (value, type, vm) {
|
|
1721
1722
|
var valid;
|
|
1722
1723
|
var expectedType = getType(type);
|
|
1723
1724
|
if (simpleCheckRE.test(expectedType)) {
|
|
@@ -1732,7 +1733,12 @@ function assertType (value, type) {
|
|
|
1732
1733
|
} else if (expectedType === 'Array') {
|
|
1733
1734
|
valid = Array.isArray(value);
|
|
1734
1735
|
} else {
|
|
1735
|
-
|
|
1736
|
+
try {
|
|
1737
|
+
valid = value instanceof type;
|
|
1738
|
+
} catch (e) {
|
|
1739
|
+
warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
|
|
1740
|
+
valid = false;
|
|
1741
|
+
}
|
|
1736
1742
|
}
|
|
1737
1743
|
return {
|
|
1738
1744
|
valid: valid,
|
|
@@ -1740,13 +1746,15 @@ function assertType (value, type) {
|
|
|
1740
1746
|
}
|
|
1741
1747
|
}
|
|
1742
1748
|
|
|
1749
|
+
var functionTypeCheckRE = /^\s*function (\w+)/;
|
|
1750
|
+
|
|
1743
1751
|
/**
|
|
1744
1752
|
* Use function string name to check built-in types,
|
|
1745
1753
|
* because a simple equality check will fail when running
|
|
1746
1754
|
* across different vms / iframes.
|
|
1747
1755
|
*/
|
|
1748
1756
|
function getType (fn) {
|
|
1749
|
-
var match = fn && fn.toString().match(
|
|
1757
|
+
var match = fn && fn.toString().match(functionTypeCheckRE);
|
|
1750
1758
|
return match ? match[1] : ''
|
|
1751
1759
|
}
|
|
1752
1760
|
|
|
@@ -1771,18 +1779,19 @@ function getInvalidTypeMessage (name, value, expectedTypes) {
|
|
|
1771
1779
|
" Expected " + (expectedTypes.map(capitalize).join(', '));
|
|
1772
1780
|
var expectedType = expectedTypes[0];
|
|
1773
1781
|
var receivedType = toRawType(value);
|
|
1774
|
-
var expectedValue = styleValue(value, expectedType);
|
|
1775
|
-
var receivedValue = styleValue(value, receivedType);
|
|
1776
1782
|
// check if we need to specify expected value
|
|
1777
|
-
if (
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1783
|
+
if (
|
|
1784
|
+
expectedTypes.length === 1 &&
|
|
1785
|
+
isExplicable(expectedType) &&
|
|
1786
|
+
isExplicable(typeof value) &&
|
|
1787
|
+
!isBoolean(expectedType, receivedType)
|
|
1788
|
+
) {
|
|
1789
|
+
message += " with value " + (styleValue(value, expectedType));
|
|
1781
1790
|
}
|
|
1782
1791
|
message += ", got " + receivedType + " ";
|
|
1783
1792
|
// check if we need to specify received value
|
|
1784
1793
|
if (isExplicable(receivedType)) {
|
|
1785
|
-
message += "with value " +
|
|
1794
|
+
message += "with value " + (styleValue(value, receivedType)) + ".";
|
|
1786
1795
|
}
|
|
1787
1796
|
return message
|
|
1788
1797
|
}
|
|
@@ -1797,9 +1806,9 @@ function styleValue (value, type) {
|
|
|
1797
1806
|
}
|
|
1798
1807
|
}
|
|
1799
1808
|
|
|
1809
|
+
var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
|
|
1800
1810
|
function isExplicable (value) {
|
|
1801
|
-
|
|
1802
|
-
return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
|
|
1811
|
+
return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; })
|
|
1803
1812
|
}
|
|
1804
1813
|
|
|
1805
1814
|
function isBoolean () {
|
|
@@ -1956,7 +1965,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
|
|
1956
1965
|
isUsingMicroTask = true;
|
|
1957
1966
|
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
|
1958
1967
|
// Fallback to setImmediate.
|
|
1959
|
-
//
|
|
1968
|
+
// Technically it leverages the (macro) task queue,
|
|
1960
1969
|
// but it is still a better choice than setTimeout.
|
|
1961
1970
|
timerFunc = function () {
|
|
1962
1971
|
setImmediate(flushCallbacks);
|
|
@@ -2003,7 +2012,7 @@ var initProxy;
|
|
|
2003
2012
|
var allowedGlobals = makeMap(
|
|
2004
2013
|
'Infinity,undefined,NaN,isFinite,isNaN,' +
|
|
2005
2014
|
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
|
2006
|
-
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
|
|
2015
|
+
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
|
|
2007
2016
|
'require' // for Webpack/Browserify
|
|
2008
2017
|
);
|
|
2009
2018
|
|
|
@@ -2022,7 +2031,7 @@ var initProxy;
|
|
|
2022
2031
|
warn(
|
|
2023
2032
|
"Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
|
|
2024
2033
|
'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
|
2025
|
-
'prevent conflicts with Vue internals' +
|
|
2034
|
+
'prevent conflicts with Vue internals. ' +
|
|
2026
2035
|
'See: https://vuejs.org/v2/api/#data',
|
|
2027
2036
|
target
|
|
2028
2037
|
);
|
|
@@ -2529,14 +2538,20 @@ function isWhitespace (node) {
|
|
|
2529
2538
|
|
|
2530
2539
|
/* */
|
|
2531
2540
|
|
|
2541
|
+
function isAsyncPlaceholder (node) {
|
|
2542
|
+
return node.isComment && node.asyncFactory
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
/* */
|
|
2546
|
+
|
|
2532
2547
|
function normalizeScopedSlots (
|
|
2533
2548
|
slots,
|
|
2534
2549
|
normalSlots,
|
|
2535
2550
|
prevSlots
|
|
2536
2551
|
) {
|
|
2537
2552
|
var res;
|
|
2538
|
-
var isStable = slots ? !!slots.$stable : true;
|
|
2539
2553
|
var hasNormalSlots = Object.keys(normalSlots).length > 0;
|
|
2554
|
+
var isStable = slots ? !!slots.$stable : !hasNormalSlots;
|
|
2540
2555
|
var key = slots && slots.$key;
|
|
2541
2556
|
if (!slots) {
|
|
2542
2557
|
res = {};
|
|
@@ -2585,9 +2600,10 @@ function normalizeScopedSlot(normalSlots, key, fn) {
|
|
|
2585
2600
|
res = res && typeof res === 'object' && !Array.isArray(res)
|
|
2586
2601
|
? [res] // single vnode
|
|
2587
2602
|
: normalizeChildren(res);
|
|
2603
|
+
var vnode = res && res[0];
|
|
2588
2604
|
return res && (
|
|
2589
|
-
|
|
2590
|
-
(
|
|
2605
|
+
!vnode ||
|
|
2606
|
+
(vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
|
|
2591
2607
|
) ? undefined
|
|
2592
2608
|
: res
|
|
2593
2609
|
};
|
|
@@ -2660,26 +2676,28 @@ function renderList (
|
|
|
2660
2676
|
*/
|
|
2661
2677
|
function renderSlot (
|
|
2662
2678
|
name,
|
|
2663
|
-
|
|
2679
|
+
fallbackRender,
|
|
2664
2680
|
props,
|
|
2665
2681
|
bindObject
|
|
2666
2682
|
) {
|
|
2667
2683
|
var scopedSlotFn = this.$scopedSlots[name];
|
|
2668
2684
|
var nodes;
|
|
2669
|
-
if (scopedSlotFn) {
|
|
2685
|
+
if (scopedSlotFn) {
|
|
2686
|
+
// scoped slot
|
|
2670
2687
|
props = props || {};
|
|
2671
2688
|
if (bindObject) {
|
|
2672
2689
|
if (!isObject(bindObject)) {
|
|
2673
|
-
warn(
|
|
2674
|
-
'slot v-bind without argument expects an Object',
|
|
2675
|
-
this
|
|
2676
|
-
);
|
|
2690
|
+
warn('slot v-bind without argument expects an Object', this);
|
|
2677
2691
|
}
|
|
2678
2692
|
props = extend(extend({}, bindObject), props);
|
|
2679
2693
|
}
|
|
2680
|
-
nodes =
|
|
2694
|
+
nodes =
|
|
2695
|
+
scopedSlotFn(props) ||
|
|
2696
|
+
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
|
|
2681
2697
|
} else {
|
|
2682
|
-
nodes =
|
|
2698
|
+
nodes =
|
|
2699
|
+
this.$slots[name] ||
|
|
2700
|
+
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
|
|
2683
2701
|
}
|
|
2684
2702
|
|
|
2685
2703
|
var target = props && props.slot;
|
|
@@ -2729,6 +2747,7 @@ function checkKeyCodes (
|
|
|
2729
2747
|
} else if (eventKeyName) {
|
|
2730
2748
|
return hyphenate(eventKeyName) !== key
|
|
2731
2749
|
}
|
|
2750
|
+
return eventKeyCode === undefined
|
|
2732
2751
|
}
|
|
2733
2752
|
|
|
2734
2753
|
/* */
|
|
@@ -2905,7 +2924,7 @@ function bindDynamicKeys (baseObj, values) {
|
|
|
2905
2924
|
if (typeof key === 'string' && key) {
|
|
2906
2925
|
baseObj[values[i]] = values[i + 1];
|
|
2907
2926
|
} else if (key !== '' && key !== null) {
|
|
2908
|
-
// null is a
|
|
2927
|
+
// null is a special value for explicitly removing a binding
|
|
2909
2928
|
warn(
|
|
2910
2929
|
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
|
2911
2930
|
this
|
|
@@ -3260,8 +3279,10 @@ function createComponent (
|
|
|
3260
3279
|
}
|
|
3261
3280
|
|
|
3262
3281
|
function createComponentInstanceForVnode (
|
|
3263
|
-
|
|
3264
|
-
|
|
3282
|
+
// we know it's MountedComponentVNode but flow doesn't
|
|
3283
|
+
vnode,
|
|
3284
|
+
// activeInstance in lifecycle state
|
|
3285
|
+
parent
|
|
3265
3286
|
) {
|
|
3266
3287
|
var options = {
|
|
3267
3288
|
_isComponent: true,
|
|
@@ -3400,6 +3421,12 @@ function _createElement (
|
|
|
3400
3421
|
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
|
3401
3422
|
if (config.isReservedTag(tag)) {
|
|
3402
3423
|
// platform built-in elements
|
|
3424
|
+
if (isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') {
|
|
3425
|
+
warn(
|
|
3426
|
+
("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
|
|
3427
|
+
context
|
|
3428
|
+
);
|
|
3429
|
+
}
|
|
3403
3430
|
vnode = new VNode(
|
|
3404
3431
|
config.parsePlatformTagName(tag), data, children,
|
|
3405
3432
|
undefined, undefined, context
|
|
@@ -3525,7 +3552,7 @@ function renderMixin (Vue) {
|
|
|
3525
3552
|
// render self
|
|
3526
3553
|
var vnode;
|
|
3527
3554
|
try {
|
|
3528
|
-
// There's no need to maintain a stack
|
|
3555
|
+
// There's no need to maintain a stack because all render fns are called
|
|
3529
3556
|
// separately from one another. Nested component's render fns are called
|
|
3530
3557
|
// when parent component is patched.
|
|
3531
3558
|
currentRenderingInstance = vm;
|
|
@@ -3620,7 +3647,9 @@ function resolveAsyncComponent (
|
|
|
3620
3647
|
|
|
3621
3648
|
if (owner && !isDef(factory.owners)) {
|
|
3622
3649
|
var owners = factory.owners = [owner];
|
|
3623
|
-
var sync = true
|
|
3650
|
+
var sync = true;
|
|
3651
|
+
var timerLoading = null;
|
|
3652
|
+
var timerTimeout = null
|
|
3624
3653
|
|
|
3625
3654
|
;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
|
|
3626
3655
|
|
|
@@ -3631,6 +3660,14 @@ function resolveAsyncComponent (
|
|
|
3631
3660
|
|
|
3632
3661
|
if (renderCompleted) {
|
|
3633
3662
|
owners.length = 0;
|
|
3663
|
+
if (timerLoading !== null) {
|
|
3664
|
+
clearTimeout(timerLoading);
|
|
3665
|
+
timerLoading = null;
|
|
3666
|
+
}
|
|
3667
|
+
if (timerTimeout !== null) {
|
|
3668
|
+
clearTimeout(timerTimeout);
|
|
3669
|
+
timerTimeout = null;
|
|
3670
|
+
}
|
|
3634
3671
|
}
|
|
3635
3672
|
};
|
|
3636
3673
|
|
|
@@ -3677,7 +3714,8 @@ function resolveAsyncComponent (
|
|
|
3677
3714
|
if (res.delay === 0) {
|
|
3678
3715
|
factory.loading = true;
|
|
3679
3716
|
} else {
|
|
3680
|
-
setTimeout(function () {
|
|
3717
|
+
timerLoading = setTimeout(function () {
|
|
3718
|
+
timerLoading = null;
|
|
3681
3719
|
if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
|
3682
3720
|
factory.loading = true;
|
|
3683
3721
|
forceRender(false);
|
|
@@ -3687,7 +3725,8 @@ function resolveAsyncComponent (
|
|
|
3687
3725
|
}
|
|
3688
3726
|
|
|
3689
3727
|
if (isDef(res.timeout)) {
|
|
3690
|
-
setTimeout(function () {
|
|
3728
|
+
timerTimeout = setTimeout(function () {
|
|
3729
|
+
timerTimeout = null;
|
|
3691
3730
|
if (isUndef(factory.resolved)) {
|
|
3692
3731
|
reject(
|
|
3693
3732
|
"timeout (" + (res.timeout) + "ms)"
|
|
@@ -3708,12 +3747,6 @@ function resolveAsyncComponent (
|
|
|
3708
3747
|
|
|
3709
3748
|
/* */
|
|
3710
3749
|
|
|
3711
|
-
function isAsyncPlaceholder (node) {
|
|
3712
|
-
return node.isComment && node.asyncFactory
|
|
3713
|
-
}
|
|
3714
|
-
|
|
3715
|
-
/* */
|
|
3716
|
-
|
|
3717
3750
|
function getFirstComponentChild (children) {
|
|
3718
3751
|
if (Array.isArray(children)) {
|
|
3719
3752
|
for (var i = 0; i < children.length; i++) {
|
|
@@ -4080,7 +4113,8 @@ function updateChildComponent (
|
|
|
4080
4113
|
var hasDynamicScopedSlot = !!(
|
|
4081
4114
|
(newScopedSlots && !newScopedSlots.$stable) ||
|
|
4082
4115
|
(oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
|
4083
|
-
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
|
|
4116
|
+
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
|
|
4117
|
+
(!newScopedSlots && vm.$scopedSlots.$key)
|
|
4084
4118
|
);
|
|
4085
4119
|
|
|
4086
4120
|
// Any static slot children from the parent may have changed during parent's
|
|
@@ -4233,16 +4267,21 @@ var getNow = Date.now;
|
|
|
4233
4267
|
// timestamp can either be hi-res (relative to page load) or low-res
|
|
4234
4268
|
// (relative to UNIX epoch), so in order to compare time we have to use the
|
|
4235
4269
|
// same timestamp type when saving the flush timestamp.
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4270
|
+
// All IE versions use low-res event timestamps, and have problematic clock
|
|
4271
|
+
// implementations (#9632)
|
|
4272
|
+
if (inBrowser && !isIE) {
|
|
4273
|
+
var performance = window.performance;
|
|
4274
|
+
if (
|
|
4275
|
+
performance &&
|
|
4276
|
+
typeof performance.now === 'function' &&
|
|
4277
|
+
getNow() > document.createEvent('Event').timeStamp
|
|
4278
|
+
) {
|
|
4279
|
+
// if the event timestamp, although evaluated AFTER the Date.now(), is
|
|
4280
|
+
// smaller than it, it means the event is using a hi-res timestamp,
|
|
4281
|
+
// and we need to use the hi-res version for event listener timestamps as
|
|
4282
|
+
// well.
|
|
4283
|
+
getNow = function () { return performance.now(); };
|
|
4284
|
+
}
|
|
4246
4285
|
}
|
|
4247
4286
|
|
|
4248
4287
|
/**
|
|
@@ -4527,11 +4566,8 @@ Watcher.prototype.run = function run () {
|
|
|
4527
4566
|
var oldValue = this.value;
|
|
4528
4567
|
this.value = value;
|
|
4529
4568
|
if (this.user) {
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
} catch (e) {
|
|
4533
|
-
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
|
|
4534
|
-
}
|
|
4569
|
+
var info = "callback for watcher \"" + (this.expression) + "\"";
|
|
4570
|
+
invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
|
|
4535
4571
|
} else {
|
|
4536
4572
|
this.cb.call(this.vm, value, oldValue);
|
|
4537
4573
|
}
|
|
@@ -4753,6 +4789,8 @@ function initComputed (vm, computed) {
|
|
|
4753
4789
|
warn(("The computed property \"" + key + "\" is already defined in data."), vm);
|
|
4754
4790
|
} else if (vm.$options.props && key in vm.$options.props) {
|
|
4755
4791
|
warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
|
|
4792
|
+
} else if (vm.$options.methods && key in vm.$options.methods) {
|
|
4793
|
+
warn(("The computed property \"" + key + "\" is already defined as a method."), vm);
|
|
4756
4794
|
}
|
|
4757
4795
|
}
|
|
4758
4796
|
}
|
|
@@ -4905,11 +4943,10 @@ function stateMixin (Vue) {
|
|
|
4905
4943
|
options.user = true;
|
|
4906
4944
|
var watcher = new Watcher(vm, expOrFn, cb, options);
|
|
4907
4945
|
if (options.immediate) {
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
}
|
|
4946
|
+
var info = "callback for immediate watcher \"" + (watcher.expression) + "\"";
|
|
4947
|
+
pushTarget();
|
|
4948
|
+
invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
|
|
4949
|
+
popTarget();
|
|
4913
4950
|
}
|
|
4914
4951
|
return function unwatchFn () {
|
|
4915
4952
|
watcher.teardown();
|
|
@@ -5207,6 +5244,8 @@ function initAssetRegisters (Vue) {
|
|
|
5207
5244
|
|
|
5208
5245
|
|
|
5209
5246
|
|
|
5247
|
+
|
|
5248
|
+
|
|
5210
5249
|
function getComponentName (opts) {
|
|
5211
5250
|
return opts && (opts.Ctor.options.name || opts.tag)
|
|
5212
5251
|
}
|
|
@@ -5228,9 +5267,9 @@ function pruneCache (keepAliveInstance, filter) {
|
|
|
5228
5267
|
var keys = keepAliveInstance.keys;
|
|
5229
5268
|
var _vnode = keepAliveInstance._vnode;
|
|
5230
5269
|
for (var key in cache) {
|
|
5231
|
-
var
|
|
5232
|
-
if (
|
|
5233
|
-
var name =
|
|
5270
|
+
var entry = cache[key];
|
|
5271
|
+
if (entry) {
|
|
5272
|
+
var name = entry.name;
|
|
5234
5273
|
if (name && !filter(name)) {
|
|
5235
5274
|
pruneCacheEntry(cache, key, keys, _vnode);
|
|
5236
5275
|
}
|
|
@@ -5244,9 +5283,9 @@ function pruneCacheEntry (
|
|
|
5244
5283
|
keys,
|
|
5245
5284
|
current
|
|
5246
5285
|
) {
|
|
5247
|
-
var
|
|
5248
|
-
if (
|
|
5249
|
-
|
|
5286
|
+
var entry = cache[key];
|
|
5287
|
+
if (entry && (!current || entry.tag !== current.tag)) {
|
|
5288
|
+
entry.componentInstance.$destroy();
|
|
5250
5289
|
}
|
|
5251
5290
|
cache[key] = null;
|
|
5252
5291
|
remove(keys, key);
|
|
@@ -5264,6 +5303,32 @@ var KeepAlive = {
|
|
|
5264
5303
|
max: [String, Number]
|
|
5265
5304
|
},
|
|
5266
5305
|
|
|
5306
|
+
methods: {
|
|
5307
|
+
cacheVNode: function cacheVNode() {
|
|
5308
|
+
var ref = this;
|
|
5309
|
+
var cache = ref.cache;
|
|
5310
|
+
var keys = ref.keys;
|
|
5311
|
+
var vnodeToCache = ref.vnodeToCache;
|
|
5312
|
+
var keyToCache = ref.keyToCache;
|
|
5313
|
+
if (vnodeToCache) {
|
|
5314
|
+
var tag = vnodeToCache.tag;
|
|
5315
|
+
var componentInstance = vnodeToCache.componentInstance;
|
|
5316
|
+
var componentOptions = vnodeToCache.componentOptions;
|
|
5317
|
+
cache[keyToCache] = {
|
|
5318
|
+
name: getComponentName(componentOptions),
|
|
5319
|
+
tag: tag,
|
|
5320
|
+
componentInstance: componentInstance,
|
|
5321
|
+
};
|
|
5322
|
+
keys.push(keyToCache);
|
|
5323
|
+
// prune oldest entry
|
|
5324
|
+
if (this.max && keys.length > parseInt(this.max)) {
|
|
5325
|
+
pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
|
5326
|
+
}
|
|
5327
|
+
this.vnodeToCache = null;
|
|
5328
|
+
}
|
|
5329
|
+
}
|
|
5330
|
+
},
|
|
5331
|
+
|
|
5267
5332
|
created: function created () {
|
|
5268
5333
|
this.cache = Object.create(null);
|
|
5269
5334
|
this.keys = [];
|
|
@@ -5278,6 +5343,7 @@ var KeepAlive = {
|
|
|
5278
5343
|
mounted: function mounted () {
|
|
5279
5344
|
var this$1 = this;
|
|
5280
5345
|
|
|
5346
|
+
this.cacheVNode();
|
|
5281
5347
|
this.$watch('include', function (val) {
|
|
5282
5348
|
pruneCache(this$1, function (name) { return matches(val, name); });
|
|
5283
5349
|
});
|
|
@@ -5286,6 +5352,10 @@ var KeepAlive = {
|
|
|
5286
5352
|
});
|
|
5287
5353
|
},
|
|
5288
5354
|
|
|
5355
|
+
updated: function updated () {
|
|
5356
|
+
this.cacheVNode();
|
|
5357
|
+
},
|
|
5358
|
+
|
|
5289
5359
|
render: function render () {
|
|
5290
5360
|
var slot = this.$slots.default;
|
|
5291
5361
|
var vnode = getFirstComponentChild(slot);
|
|
@@ -5319,12 +5389,9 @@ var KeepAlive = {
|
|
|
5319
5389
|
remove(keys, key);
|
|
5320
5390
|
keys.push(key);
|
|
5321
5391
|
} else {
|
|
5322
|
-
cache
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
if (this.max && keys.length > parseInt(this.max)) {
|
|
5326
|
-
pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
|
5327
|
-
}
|
|
5392
|
+
// delay setting the cache until update
|
|
5393
|
+
this.vnodeToCache = vnode;
|
|
5394
|
+
this.keyToCache = key;
|
|
5328
5395
|
}
|
|
5329
5396
|
|
|
5330
5397
|
vnode.data.keepAlive = true;
|
|
@@ -5407,7 +5474,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
|
|
5407
5474
|
value: FunctionalRenderContext
|
|
5408
5475
|
});
|
|
5409
5476
|
|
|
5410
|
-
Vue.version = '2.6.
|
|
5477
|
+
Vue.version = '2.6.13';
|
|
5411
5478
|
|
|
5412
5479
|
/* */
|
|
5413
5480
|
|
|
@@ -5444,7 +5511,7 @@ var isBooleanAttr = makeMap(
|
|
|
5444
5511
|
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
|
5445
5512
|
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
|
5446
5513
|
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
|
5447
|
-
'required,reversed,scoped,seamless,selected,sortable,
|
|
5514
|
+
'required,reversed,scoped,seamless,selected,sortable,' +
|
|
5448
5515
|
'truespeed,typemustmatch,visible'
|
|
5449
5516
|
);
|
|
5450
5517
|
|
|
@@ -5568,7 +5635,7 @@ var isHTMLTag = makeMap(
|
|
|
5568
5635
|
// contain child elements.
|
|
5569
5636
|
var isSVG = makeMap(
|
|
5570
5637
|
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
|
5571
|
-
'
|
|
5638
|
+
'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
|
5572
5639
|
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
|
5573
5640
|
true
|
|
5574
5641
|
);
|
|
@@ -5771,7 +5838,8 @@ var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
|
|
5771
5838
|
|
|
5772
5839
|
function sameVnode (a, b) {
|
|
5773
5840
|
return (
|
|
5774
|
-
a.key === b.key &&
|
|
5841
|
+
a.key === b.key &&
|
|
5842
|
+
a.asyncFactory === b.asyncFactory && (
|
|
5775
5843
|
(
|
|
5776
5844
|
a.tag === b.tag &&
|
|
5777
5845
|
a.isComment === b.isComment &&
|
|
@@ -5779,7 +5847,6 @@ function sameVnode (a, b) {
|
|
|
5779
5847
|
sameInputType(a, b)
|
|
5780
5848
|
) || (
|
|
5781
5849
|
isTrue(a.isAsyncPlaceholder) &&
|
|
5782
|
-
a.asyncFactory === b.asyncFactory &&
|
|
5783
5850
|
isUndef(b.asyncFactory.error)
|
|
5784
5851
|
)
|
|
5785
5852
|
)
|
|
@@ -6078,7 +6145,7 @@ function createPatchFunction (backend) {
|
|
|
6078
6145
|
}
|
|
6079
6146
|
}
|
|
6080
6147
|
|
|
6081
|
-
function removeVnodes (
|
|
6148
|
+
function removeVnodes (vnodes, startIdx, endIdx) {
|
|
6082
6149
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
6083
6150
|
var ch = vnodes[startIdx];
|
|
6084
6151
|
if (isDef(ch)) {
|
|
@@ -6189,7 +6256,7 @@ function createPatchFunction (backend) {
|
|
|
6189
6256
|
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
|
6190
6257
|
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
|
6191
6258
|
} else if (newStartIdx > newEndIdx) {
|
|
6192
|
-
removeVnodes(
|
|
6259
|
+
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
6193
6260
|
}
|
|
6194
6261
|
}
|
|
6195
6262
|
|
|
@@ -6281,7 +6348,7 @@ function createPatchFunction (backend) {
|
|
|
6281
6348
|
if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
|
|
6282
6349
|
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
|
6283
6350
|
} else if (isDef(oldCh)) {
|
|
6284
|
-
removeVnodes(
|
|
6351
|
+
removeVnodes(oldCh, 0, oldCh.length - 1);
|
|
6285
6352
|
} else if (isDef(oldVnode.text)) {
|
|
6286
6353
|
nodeOps.setTextContent(elm, '');
|
|
6287
6354
|
}
|
|
@@ -6510,7 +6577,7 @@ function createPatchFunction (backend) {
|
|
|
6510
6577
|
|
|
6511
6578
|
// destroy old node
|
|
6512
6579
|
if (isDef(parentElm)) {
|
|
6513
|
-
removeVnodes(
|
|
6580
|
+
removeVnodes([oldVnode], 0, 0);
|
|
6514
6581
|
} else if (isDef(oldVnode.tag)) {
|
|
6515
6582
|
invokeDestroyHook(oldVnode);
|
|
6516
6583
|
}
|
|
@@ -6667,7 +6734,7 @@ function updateAttrs (oldVnode, vnode) {
|
|
|
6667
6734
|
cur = attrs[key];
|
|
6668
6735
|
old = oldAttrs[key];
|
|
6669
6736
|
if (old !== cur) {
|
|
6670
|
-
setAttr(elm, key, cur);
|
|
6737
|
+
setAttr(elm, key, cur, vnode.data.pre);
|
|
6671
6738
|
}
|
|
6672
6739
|
}
|
|
6673
6740
|
// #4391: in IE9, setting type can reset value for input[type=radio]
|
|
@@ -6687,8 +6754,8 @@ function updateAttrs (oldVnode, vnode) {
|
|
|
6687
6754
|
}
|
|
6688
6755
|
}
|
|
6689
6756
|
|
|
6690
|
-
function setAttr (el, key, value) {
|
|
6691
|
-
if (el.tagName.indexOf('-') > -1) {
|
|
6757
|
+
function setAttr (el, key, value, isInPre) {
|
|
6758
|
+
if (isInPre || el.tagName.indexOf('-') > -1) {
|
|
6692
6759
|
baseSetAttr(el, key, value);
|
|
6693
6760
|
} else if (isBooleanAttr(key)) {
|
|
6694
6761
|
// set attribute for blank value
|
|
@@ -6930,10 +6997,11 @@ function updateDOMProps (oldVnode, vnode) {
|
|
|
6930
6997
|
}
|
|
6931
6998
|
|
|
6932
6999
|
for (key in oldProps) {
|
|
6933
|
-
if (
|
|
7000
|
+
if (!(key in props)) {
|
|
6934
7001
|
elm[key] = '';
|
|
6935
7002
|
}
|
|
6936
7003
|
}
|
|
7004
|
+
|
|
6937
7005
|
for (key in props) {
|
|
6938
7006
|
cur = props[key];
|
|
6939
7007
|
// ignore children if the node has textContent or innerHTML,
|
|
@@ -6973,7 +7041,7 @@ function updateDOMProps (oldVnode, vnode) {
|
|
|
6973
7041
|
// skip the update if old and new VDOM state is the same.
|
|
6974
7042
|
// `value` is handled separately because the DOM value may be temporarily
|
|
6975
7043
|
// out of sync with VDOM state due to focus, composition and modifiers.
|
|
6976
|
-
// This #4521 by skipping the
|
|
7044
|
+
// This #4521 by skipping the unnecessary `checked` update.
|
|
6977
7045
|
cur !== oldProps[key]
|
|
6978
7046
|
) {
|
|
6979
7047
|
// some property updates can throw
|