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
package/dist/vue.runtime.esm.js
CHANGED
|
@@ -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
|
/* */
|
|
@@ -1695,13 +1695,14 @@ function assertProp (
|
|
|
1695
1695
|
type = [type];
|
|
1696
1696
|
}
|
|
1697
1697
|
for (var i = 0; i < type.length && !valid; i++) {
|
|
1698
|
-
var assertedType = assertType(value, type[i]);
|
|
1698
|
+
var assertedType = assertType(value, type[i], vm);
|
|
1699
1699
|
expectedTypes.push(assertedType.expectedType || '');
|
|
1700
1700
|
valid = assertedType.valid;
|
|
1701
1701
|
}
|
|
1702
1702
|
}
|
|
1703
1703
|
|
|
1704
|
-
|
|
1704
|
+
var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
|
|
1705
|
+
if (!valid && haveExpectedTypes) {
|
|
1705
1706
|
warn(
|
|
1706
1707
|
getInvalidTypeMessage(name, value, expectedTypes),
|
|
1707
1708
|
vm
|
|
@@ -1719,9 +1720,9 @@ function assertProp (
|
|
|
1719
1720
|
}
|
|
1720
1721
|
}
|
|
1721
1722
|
|
|
1722
|
-
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
|
|
1723
|
+
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
|
|
1723
1724
|
|
|
1724
|
-
function assertType (value, type) {
|
|
1725
|
+
function assertType (value, type, vm) {
|
|
1725
1726
|
var valid;
|
|
1726
1727
|
var expectedType = getType(type);
|
|
1727
1728
|
if (simpleCheckRE.test(expectedType)) {
|
|
@@ -1736,7 +1737,12 @@ function assertType (value, type) {
|
|
|
1736
1737
|
} else if (expectedType === 'Array') {
|
|
1737
1738
|
valid = Array.isArray(value);
|
|
1738
1739
|
} else {
|
|
1739
|
-
|
|
1740
|
+
try {
|
|
1741
|
+
valid = value instanceof type;
|
|
1742
|
+
} catch (e) {
|
|
1743
|
+
warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
|
|
1744
|
+
valid = false;
|
|
1745
|
+
}
|
|
1740
1746
|
}
|
|
1741
1747
|
return {
|
|
1742
1748
|
valid: valid,
|
|
@@ -1744,13 +1750,15 @@ function assertType (value, type) {
|
|
|
1744
1750
|
}
|
|
1745
1751
|
}
|
|
1746
1752
|
|
|
1753
|
+
var functionTypeCheckRE = /^\s*function (\w+)/;
|
|
1754
|
+
|
|
1747
1755
|
/**
|
|
1748
1756
|
* Use function string name to check built-in types,
|
|
1749
1757
|
* because a simple equality check will fail when running
|
|
1750
1758
|
* across different vms / iframes.
|
|
1751
1759
|
*/
|
|
1752
1760
|
function getType (fn) {
|
|
1753
|
-
var match = fn && fn.toString().match(
|
|
1761
|
+
var match = fn && fn.toString().match(functionTypeCheckRE);
|
|
1754
1762
|
return match ? match[1] : ''
|
|
1755
1763
|
}
|
|
1756
1764
|
|
|
@@ -1775,18 +1783,19 @@ function getInvalidTypeMessage (name, value, expectedTypes) {
|
|
|
1775
1783
|
" Expected " + (expectedTypes.map(capitalize).join(', '));
|
|
1776
1784
|
var expectedType = expectedTypes[0];
|
|
1777
1785
|
var receivedType = toRawType(value);
|
|
1778
|
-
var expectedValue = styleValue(value, expectedType);
|
|
1779
|
-
var receivedValue = styleValue(value, receivedType);
|
|
1780
1786
|
// check if we need to specify expected value
|
|
1781
|
-
if (
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1787
|
+
if (
|
|
1788
|
+
expectedTypes.length === 1 &&
|
|
1789
|
+
isExplicable(expectedType) &&
|
|
1790
|
+
isExplicable(typeof value) &&
|
|
1791
|
+
!isBoolean(expectedType, receivedType)
|
|
1792
|
+
) {
|
|
1793
|
+
message += " with value " + (styleValue(value, expectedType));
|
|
1785
1794
|
}
|
|
1786
1795
|
message += ", got " + receivedType + " ";
|
|
1787
1796
|
// check if we need to specify received value
|
|
1788
1797
|
if (isExplicable(receivedType)) {
|
|
1789
|
-
message += "with value " +
|
|
1798
|
+
message += "with value " + (styleValue(value, receivedType)) + ".";
|
|
1790
1799
|
}
|
|
1791
1800
|
return message
|
|
1792
1801
|
}
|
|
@@ -1801,9 +1810,9 @@ function styleValue (value, type) {
|
|
|
1801
1810
|
}
|
|
1802
1811
|
}
|
|
1803
1812
|
|
|
1813
|
+
var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
|
|
1804
1814
|
function isExplicable (value) {
|
|
1805
|
-
|
|
1806
|
-
return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
|
|
1815
|
+
return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; })
|
|
1807
1816
|
}
|
|
1808
1817
|
|
|
1809
1818
|
function isBoolean () {
|
|
@@ -1960,7 +1969,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
|
|
1960
1969
|
isUsingMicroTask = true;
|
|
1961
1970
|
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
|
1962
1971
|
// Fallback to setImmediate.
|
|
1963
|
-
//
|
|
1972
|
+
// Technically it leverages the (macro) task queue,
|
|
1964
1973
|
// but it is still a better choice than setTimeout.
|
|
1965
1974
|
timerFunc = function () {
|
|
1966
1975
|
setImmediate(flushCallbacks);
|
|
@@ -2007,7 +2016,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
2007
2016
|
var allowedGlobals = makeMap(
|
|
2008
2017
|
'Infinity,undefined,NaN,isFinite,isNaN,' +
|
|
2009
2018
|
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
|
2010
|
-
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
|
|
2019
|
+
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
|
|
2011
2020
|
'require' // for Webpack/Browserify
|
|
2012
2021
|
);
|
|
2013
2022
|
|
|
@@ -2026,7 +2035,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
2026
2035
|
warn(
|
|
2027
2036
|
"Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
|
|
2028
2037
|
'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
|
2029
|
-
'prevent conflicts with Vue internals' +
|
|
2038
|
+
'prevent conflicts with Vue internals. ' +
|
|
2030
2039
|
'See: https://vuejs.org/v2/api/#data',
|
|
2031
2040
|
target
|
|
2032
2041
|
);
|
|
@@ -2535,14 +2544,20 @@ function isWhitespace (node) {
|
|
|
2535
2544
|
|
|
2536
2545
|
/* */
|
|
2537
2546
|
|
|
2547
|
+
function isAsyncPlaceholder (node) {
|
|
2548
|
+
return node.isComment && node.asyncFactory
|
|
2549
|
+
}
|
|
2550
|
+
|
|
2551
|
+
/* */
|
|
2552
|
+
|
|
2538
2553
|
function normalizeScopedSlots (
|
|
2539
2554
|
slots,
|
|
2540
2555
|
normalSlots,
|
|
2541
2556
|
prevSlots
|
|
2542
2557
|
) {
|
|
2543
2558
|
var res;
|
|
2544
|
-
var isStable = slots ? !!slots.$stable : true;
|
|
2545
2559
|
var hasNormalSlots = Object.keys(normalSlots).length > 0;
|
|
2560
|
+
var isStable = slots ? !!slots.$stable : !hasNormalSlots;
|
|
2546
2561
|
var key = slots && slots.$key;
|
|
2547
2562
|
if (!slots) {
|
|
2548
2563
|
res = {};
|
|
@@ -2591,9 +2606,10 @@ function normalizeScopedSlot(normalSlots, key, fn) {
|
|
|
2591
2606
|
res = res && typeof res === 'object' && !Array.isArray(res)
|
|
2592
2607
|
? [res] // single vnode
|
|
2593
2608
|
: normalizeChildren(res);
|
|
2609
|
+
var vnode = res && res[0];
|
|
2594
2610
|
return res && (
|
|
2595
|
-
|
|
2596
|
-
(
|
|
2611
|
+
!vnode ||
|
|
2612
|
+
(vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
|
|
2597
2613
|
) ? undefined
|
|
2598
2614
|
: res
|
|
2599
2615
|
};
|
|
@@ -2666,26 +2682,28 @@ function renderList (
|
|
|
2666
2682
|
*/
|
|
2667
2683
|
function renderSlot (
|
|
2668
2684
|
name,
|
|
2669
|
-
|
|
2685
|
+
fallbackRender,
|
|
2670
2686
|
props,
|
|
2671
2687
|
bindObject
|
|
2672
2688
|
) {
|
|
2673
2689
|
var scopedSlotFn = this.$scopedSlots[name];
|
|
2674
2690
|
var nodes;
|
|
2675
|
-
if (scopedSlotFn) {
|
|
2691
|
+
if (scopedSlotFn) {
|
|
2692
|
+
// scoped slot
|
|
2676
2693
|
props = props || {};
|
|
2677
2694
|
if (bindObject) {
|
|
2678
2695
|
if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
|
|
2679
|
-
warn(
|
|
2680
|
-
'slot v-bind without argument expects an Object',
|
|
2681
|
-
this
|
|
2682
|
-
);
|
|
2696
|
+
warn('slot v-bind without argument expects an Object', this);
|
|
2683
2697
|
}
|
|
2684
2698
|
props = extend(extend({}, bindObject), props);
|
|
2685
2699
|
}
|
|
2686
|
-
nodes =
|
|
2700
|
+
nodes =
|
|
2701
|
+
scopedSlotFn(props) ||
|
|
2702
|
+
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
|
|
2687
2703
|
} else {
|
|
2688
|
-
nodes =
|
|
2704
|
+
nodes =
|
|
2705
|
+
this.$slots[name] ||
|
|
2706
|
+
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
|
|
2689
2707
|
}
|
|
2690
2708
|
|
|
2691
2709
|
var target = props && props.slot;
|
|
@@ -2735,6 +2753,7 @@ function checkKeyCodes (
|
|
|
2735
2753
|
} else if (eventKeyName) {
|
|
2736
2754
|
return hyphenate(eventKeyName) !== key
|
|
2737
2755
|
}
|
|
2756
|
+
return eventKeyCode === undefined
|
|
2738
2757
|
}
|
|
2739
2758
|
|
|
2740
2759
|
/* */
|
|
@@ -2911,7 +2930,7 @@ function bindDynamicKeys (baseObj, values) {
|
|
|
2911
2930
|
if (typeof key === 'string' && key) {
|
|
2912
2931
|
baseObj[values[i]] = values[i + 1];
|
|
2913
2932
|
} else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
|
|
2914
|
-
// null is a
|
|
2933
|
+
// null is a special value for explicitly removing a binding
|
|
2915
2934
|
warn(
|
|
2916
2935
|
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
|
2917
2936
|
this
|
|
@@ -3266,8 +3285,10 @@ function createComponent (
|
|
|
3266
3285
|
}
|
|
3267
3286
|
|
|
3268
3287
|
function createComponentInstanceForVnode (
|
|
3269
|
-
|
|
3270
|
-
|
|
3288
|
+
// we know it's MountedComponentVNode but flow doesn't
|
|
3289
|
+
vnode,
|
|
3290
|
+
// activeInstance in lifecycle state
|
|
3291
|
+
parent
|
|
3271
3292
|
) {
|
|
3272
3293
|
var options = {
|
|
3273
3294
|
_isComponent: true,
|
|
@@ -3407,6 +3428,12 @@ function _createElement (
|
|
|
3407
3428
|
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
|
3408
3429
|
if (config.isReservedTag(tag)) {
|
|
3409
3430
|
// platform built-in elements
|
|
3431
|
+
if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') {
|
|
3432
|
+
warn(
|
|
3433
|
+
("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
|
|
3434
|
+
context
|
|
3435
|
+
);
|
|
3436
|
+
}
|
|
3410
3437
|
vnode = new VNode(
|
|
3411
3438
|
config.parsePlatformTagName(tag), data, children,
|
|
3412
3439
|
undefined, undefined, context
|
|
@@ -3535,7 +3562,7 @@ function renderMixin (Vue) {
|
|
|
3535
3562
|
// render self
|
|
3536
3563
|
var vnode;
|
|
3537
3564
|
try {
|
|
3538
|
-
// There's no need to maintain a stack
|
|
3565
|
+
// There's no need to maintain a stack because all render fns are called
|
|
3539
3566
|
// separately from one another. Nested component's render fns are called
|
|
3540
3567
|
// when parent component is patched.
|
|
3541
3568
|
currentRenderingInstance = vm;
|
|
@@ -3630,7 +3657,9 @@ function resolveAsyncComponent (
|
|
|
3630
3657
|
|
|
3631
3658
|
if (owner && !isDef(factory.owners)) {
|
|
3632
3659
|
var owners = factory.owners = [owner];
|
|
3633
|
-
var sync = true
|
|
3660
|
+
var sync = true;
|
|
3661
|
+
var timerLoading = null;
|
|
3662
|
+
var timerTimeout = null
|
|
3634
3663
|
|
|
3635
3664
|
;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
|
|
3636
3665
|
|
|
@@ -3641,6 +3670,14 @@ function resolveAsyncComponent (
|
|
|
3641
3670
|
|
|
3642
3671
|
if (renderCompleted) {
|
|
3643
3672
|
owners.length = 0;
|
|
3673
|
+
if (timerLoading !== null) {
|
|
3674
|
+
clearTimeout(timerLoading);
|
|
3675
|
+
timerLoading = null;
|
|
3676
|
+
}
|
|
3677
|
+
if (timerTimeout !== null) {
|
|
3678
|
+
clearTimeout(timerTimeout);
|
|
3679
|
+
timerTimeout = null;
|
|
3680
|
+
}
|
|
3644
3681
|
}
|
|
3645
3682
|
};
|
|
3646
3683
|
|
|
@@ -3687,7 +3724,8 @@ function resolveAsyncComponent (
|
|
|
3687
3724
|
if (res.delay === 0) {
|
|
3688
3725
|
factory.loading = true;
|
|
3689
3726
|
} else {
|
|
3690
|
-
setTimeout(function () {
|
|
3727
|
+
timerLoading = setTimeout(function () {
|
|
3728
|
+
timerLoading = null;
|
|
3691
3729
|
if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
|
3692
3730
|
factory.loading = true;
|
|
3693
3731
|
forceRender(false);
|
|
@@ -3697,7 +3735,8 @@ function resolveAsyncComponent (
|
|
|
3697
3735
|
}
|
|
3698
3736
|
|
|
3699
3737
|
if (isDef(res.timeout)) {
|
|
3700
|
-
setTimeout(function () {
|
|
3738
|
+
timerTimeout = setTimeout(function () {
|
|
3739
|
+
timerTimeout = null;
|
|
3701
3740
|
if (isUndef(factory.resolved)) {
|
|
3702
3741
|
reject(
|
|
3703
3742
|
process.env.NODE_ENV !== 'production'
|
|
@@ -3720,12 +3759,6 @@ function resolveAsyncComponent (
|
|
|
3720
3759
|
|
|
3721
3760
|
/* */
|
|
3722
3761
|
|
|
3723
|
-
function isAsyncPlaceholder (node) {
|
|
3724
|
-
return node.isComment && node.asyncFactory
|
|
3725
|
-
}
|
|
3726
|
-
|
|
3727
|
-
/* */
|
|
3728
|
-
|
|
3729
3762
|
function getFirstComponentChild (children) {
|
|
3730
3763
|
if (Array.isArray(children)) {
|
|
3731
3764
|
for (var i = 0; i < children.length; i++) {
|
|
@@ -4092,7 +4125,8 @@ function updateChildComponent (
|
|
|
4092
4125
|
var hasDynamicScopedSlot = !!(
|
|
4093
4126
|
(newScopedSlots && !newScopedSlots.$stable) ||
|
|
4094
4127
|
(oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
|
4095
|
-
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
|
|
4128
|
+
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
|
|
4129
|
+
(!newScopedSlots && vm.$scopedSlots.$key)
|
|
4096
4130
|
);
|
|
4097
4131
|
|
|
4098
4132
|
// Any static slot children from the parent may have changed during parent's
|
|
@@ -4245,16 +4279,21 @@ var getNow = Date.now;
|
|
|
4245
4279
|
// timestamp can either be hi-res (relative to page load) or low-res
|
|
4246
4280
|
// (relative to UNIX epoch), so in order to compare time we have to use the
|
|
4247
4281
|
// same timestamp type when saving the flush timestamp.
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4282
|
+
// All IE versions use low-res event timestamps, and have problematic clock
|
|
4283
|
+
// implementations (#9632)
|
|
4284
|
+
if (inBrowser && !isIE) {
|
|
4285
|
+
var performance = window.performance;
|
|
4286
|
+
if (
|
|
4287
|
+
performance &&
|
|
4288
|
+
typeof performance.now === 'function' &&
|
|
4289
|
+
getNow() > document.createEvent('Event').timeStamp
|
|
4290
|
+
) {
|
|
4291
|
+
// if the event timestamp, although evaluated AFTER the Date.now(), is
|
|
4292
|
+
// smaller than it, it means the event is using a hi-res timestamp,
|
|
4293
|
+
// and we need to use the hi-res version for event listener timestamps as
|
|
4294
|
+
// well.
|
|
4295
|
+
getNow = function () { return performance.now(); };
|
|
4296
|
+
}
|
|
4258
4297
|
}
|
|
4259
4298
|
|
|
4260
4299
|
/**
|
|
@@ -4541,11 +4580,8 @@ Watcher.prototype.run = function run () {
|
|
|
4541
4580
|
var oldValue = this.value;
|
|
4542
4581
|
this.value = value;
|
|
4543
4582
|
if (this.user) {
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
} catch (e) {
|
|
4547
|
-
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
|
|
4548
|
-
}
|
|
4583
|
+
var info = "callback for watcher \"" + (this.expression) + "\"";
|
|
4584
|
+
invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
|
|
4549
4585
|
} else {
|
|
4550
4586
|
this.cb.call(this.vm, value, oldValue);
|
|
4551
4587
|
}
|
|
@@ -4769,6 +4805,8 @@ function initComputed (vm, computed) {
|
|
|
4769
4805
|
warn(("The computed property \"" + key + "\" is already defined in data."), vm);
|
|
4770
4806
|
} else if (vm.$options.props && key in vm.$options.props) {
|
|
4771
4807
|
warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
|
|
4808
|
+
} else if (vm.$options.methods && key in vm.$options.methods) {
|
|
4809
|
+
warn(("The computed property \"" + key + "\" is already defined as a method."), vm);
|
|
4772
4810
|
}
|
|
4773
4811
|
}
|
|
4774
4812
|
}
|
|
@@ -4922,11 +4960,10 @@ function stateMixin (Vue) {
|
|
|
4922
4960
|
options.user = true;
|
|
4923
4961
|
var watcher = new Watcher(vm, expOrFn, cb, options);
|
|
4924
4962
|
if (options.immediate) {
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
}
|
|
4963
|
+
var info = "callback for immediate watcher \"" + (watcher.expression) + "\"";
|
|
4964
|
+
pushTarget();
|
|
4965
|
+
invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
|
|
4966
|
+
popTarget();
|
|
4930
4967
|
}
|
|
4931
4968
|
return function unwatchFn () {
|
|
4932
4969
|
watcher.teardown();
|
|
@@ -5227,6 +5264,8 @@ function initAssetRegisters (Vue) {
|
|
|
5227
5264
|
|
|
5228
5265
|
|
|
5229
5266
|
|
|
5267
|
+
|
|
5268
|
+
|
|
5230
5269
|
function getComponentName (opts) {
|
|
5231
5270
|
return opts && (opts.Ctor.options.name || opts.tag)
|
|
5232
5271
|
}
|
|
@@ -5248,9 +5287,9 @@ function pruneCache (keepAliveInstance, filter) {
|
|
|
5248
5287
|
var keys = keepAliveInstance.keys;
|
|
5249
5288
|
var _vnode = keepAliveInstance._vnode;
|
|
5250
5289
|
for (var key in cache) {
|
|
5251
|
-
var
|
|
5252
|
-
if (
|
|
5253
|
-
var name =
|
|
5290
|
+
var entry = cache[key];
|
|
5291
|
+
if (entry) {
|
|
5292
|
+
var name = entry.name;
|
|
5254
5293
|
if (name && !filter(name)) {
|
|
5255
5294
|
pruneCacheEntry(cache, key, keys, _vnode);
|
|
5256
5295
|
}
|
|
@@ -5264,9 +5303,9 @@ function pruneCacheEntry (
|
|
|
5264
5303
|
keys,
|
|
5265
5304
|
current
|
|
5266
5305
|
) {
|
|
5267
|
-
var
|
|
5268
|
-
if (
|
|
5269
|
-
|
|
5306
|
+
var entry = cache[key];
|
|
5307
|
+
if (entry && (!current || entry.tag !== current.tag)) {
|
|
5308
|
+
entry.componentInstance.$destroy();
|
|
5270
5309
|
}
|
|
5271
5310
|
cache[key] = null;
|
|
5272
5311
|
remove(keys, key);
|
|
@@ -5284,6 +5323,32 @@ var KeepAlive = {
|
|
|
5284
5323
|
max: [String, Number]
|
|
5285
5324
|
},
|
|
5286
5325
|
|
|
5326
|
+
methods: {
|
|
5327
|
+
cacheVNode: function cacheVNode() {
|
|
5328
|
+
var ref = this;
|
|
5329
|
+
var cache = ref.cache;
|
|
5330
|
+
var keys = ref.keys;
|
|
5331
|
+
var vnodeToCache = ref.vnodeToCache;
|
|
5332
|
+
var keyToCache = ref.keyToCache;
|
|
5333
|
+
if (vnodeToCache) {
|
|
5334
|
+
var tag = vnodeToCache.tag;
|
|
5335
|
+
var componentInstance = vnodeToCache.componentInstance;
|
|
5336
|
+
var componentOptions = vnodeToCache.componentOptions;
|
|
5337
|
+
cache[keyToCache] = {
|
|
5338
|
+
name: getComponentName(componentOptions),
|
|
5339
|
+
tag: tag,
|
|
5340
|
+
componentInstance: componentInstance,
|
|
5341
|
+
};
|
|
5342
|
+
keys.push(keyToCache);
|
|
5343
|
+
// prune oldest entry
|
|
5344
|
+
if (this.max && keys.length > parseInt(this.max)) {
|
|
5345
|
+
pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
|
5346
|
+
}
|
|
5347
|
+
this.vnodeToCache = null;
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
},
|
|
5351
|
+
|
|
5287
5352
|
created: function created () {
|
|
5288
5353
|
this.cache = Object.create(null);
|
|
5289
5354
|
this.keys = [];
|
|
@@ -5298,6 +5363,7 @@ var KeepAlive = {
|
|
|
5298
5363
|
mounted: function mounted () {
|
|
5299
5364
|
var this$1 = this;
|
|
5300
5365
|
|
|
5366
|
+
this.cacheVNode();
|
|
5301
5367
|
this.$watch('include', function (val) {
|
|
5302
5368
|
pruneCache(this$1, function (name) { return matches(val, name); });
|
|
5303
5369
|
});
|
|
@@ -5306,6 +5372,10 @@ var KeepAlive = {
|
|
|
5306
5372
|
});
|
|
5307
5373
|
},
|
|
5308
5374
|
|
|
5375
|
+
updated: function updated () {
|
|
5376
|
+
this.cacheVNode();
|
|
5377
|
+
},
|
|
5378
|
+
|
|
5309
5379
|
render: function render () {
|
|
5310
5380
|
var slot = this.$slots.default;
|
|
5311
5381
|
var vnode = getFirstComponentChild(slot);
|
|
@@ -5339,12 +5409,9 @@ var KeepAlive = {
|
|
|
5339
5409
|
remove(keys, key);
|
|
5340
5410
|
keys.push(key);
|
|
5341
5411
|
} else {
|
|
5342
|
-
cache
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
if (this.max && keys.length > parseInt(this.max)) {
|
|
5346
|
-
pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
|
5347
|
-
}
|
|
5412
|
+
// delay setting the cache until update
|
|
5413
|
+
this.vnodeToCache = vnode;
|
|
5414
|
+
this.keyToCache = key;
|
|
5348
5415
|
}
|
|
5349
5416
|
|
|
5350
5417
|
vnode.data.keepAlive = true;
|
|
@@ -5427,7 +5494,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
|
|
5427
5494
|
value: FunctionalRenderContext
|
|
5428
5495
|
});
|
|
5429
5496
|
|
|
5430
|
-
Vue.version = '2.6.
|
|
5497
|
+
Vue.version = '2.6.13';
|
|
5431
5498
|
|
|
5432
5499
|
/* */
|
|
5433
5500
|
|
|
@@ -5464,7 +5531,7 @@ var isBooleanAttr = makeMap(
|
|
|
5464
5531
|
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
|
5465
5532
|
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
|
5466
5533
|
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
|
5467
|
-
'required,reversed,scoped,seamless,selected,sortable,
|
|
5534
|
+
'required,reversed,scoped,seamless,selected,sortable,' +
|
|
5468
5535
|
'truespeed,typemustmatch,visible'
|
|
5469
5536
|
);
|
|
5470
5537
|
|
|
@@ -5588,7 +5655,7 @@ var isHTMLTag = makeMap(
|
|
|
5588
5655
|
// contain child elements.
|
|
5589
5656
|
var isSVG = makeMap(
|
|
5590
5657
|
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
|
5591
|
-
'
|
|
5658
|
+
'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
|
5592
5659
|
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
|
5593
5660
|
true
|
|
5594
5661
|
);
|
|
@@ -5791,7 +5858,8 @@ var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
|
|
5791
5858
|
|
|
5792
5859
|
function sameVnode (a, b) {
|
|
5793
5860
|
return (
|
|
5794
|
-
a.key === b.key &&
|
|
5861
|
+
a.key === b.key &&
|
|
5862
|
+
a.asyncFactory === b.asyncFactory && (
|
|
5795
5863
|
(
|
|
5796
5864
|
a.tag === b.tag &&
|
|
5797
5865
|
a.isComment === b.isComment &&
|
|
@@ -5799,7 +5867,6 @@ function sameVnode (a, b) {
|
|
|
5799
5867
|
sameInputType(a, b)
|
|
5800
5868
|
) || (
|
|
5801
5869
|
isTrue(a.isAsyncPlaceholder) &&
|
|
5802
|
-
a.asyncFactory === b.asyncFactory &&
|
|
5803
5870
|
isUndef(b.asyncFactory.error)
|
|
5804
5871
|
)
|
|
5805
5872
|
)
|
|
@@ -6098,7 +6165,7 @@ function createPatchFunction (backend) {
|
|
|
6098
6165
|
}
|
|
6099
6166
|
}
|
|
6100
6167
|
|
|
6101
|
-
function removeVnodes (
|
|
6168
|
+
function removeVnodes (vnodes, startIdx, endIdx) {
|
|
6102
6169
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
6103
6170
|
var ch = vnodes[startIdx];
|
|
6104
6171
|
if (isDef(ch)) {
|
|
@@ -6209,7 +6276,7 @@ function createPatchFunction (backend) {
|
|
|
6209
6276
|
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
|
6210
6277
|
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
|
6211
6278
|
} else if (newStartIdx > newEndIdx) {
|
|
6212
|
-
removeVnodes(
|
|
6279
|
+
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
6213
6280
|
}
|
|
6214
6281
|
}
|
|
6215
6282
|
|
|
@@ -6301,7 +6368,7 @@ function createPatchFunction (backend) {
|
|
|
6301
6368
|
if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
|
|
6302
6369
|
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
|
6303
6370
|
} else if (isDef(oldCh)) {
|
|
6304
|
-
removeVnodes(
|
|
6371
|
+
removeVnodes(oldCh, 0, oldCh.length - 1);
|
|
6305
6372
|
} else if (isDef(oldVnode.text)) {
|
|
6306
6373
|
nodeOps.setTextContent(elm, '');
|
|
6307
6374
|
}
|
|
@@ -6532,7 +6599,7 @@ function createPatchFunction (backend) {
|
|
|
6532
6599
|
|
|
6533
6600
|
// destroy old node
|
|
6534
6601
|
if (isDef(parentElm)) {
|
|
6535
|
-
removeVnodes(
|
|
6602
|
+
removeVnodes([oldVnode], 0, 0);
|
|
6536
6603
|
} else if (isDef(oldVnode.tag)) {
|
|
6537
6604
|
invokeDestroyHook(oldVnode);
|
|
6538
6605
|
}
|
|
@@ -6689,7 +6756,7 @@ function updateAttrs (oldVnode, vnode) {
|
|
|
6689
6756
|
cur = attrs[key];
|
|
6690
6757
|
old = oldAttrs[key];
|
|
6691
6758
|
if (old !== cur) {
|
|
6692
|
-
setAttr(elm, key, cur);
|
|
6759
|
+
setAttr(elm, key, cur, vnode.data.pre);
|
|
6693
6760
|
}
|
|
6694
6761
|
}
|
|
6695
6762
|
// #4391: in IE9, setting type can reset value for input[type=radio]
|
|
@@ -6709,8 +6776,8 @@ function updateAttrs (oldVnode, vnode) {
|
|
|
6709
6776
|
}
|
|
6710
6777
|
}
|
|
6711
6778
|
|
|
6712
|
-
function setAttr (el, key, value) {
|
|
6713
|
-
if (el.tagName.indexOf('-') > -1) {
|
|
6779
|
+
function setAttr (el, key, value, isInPre) {
|
|
6780
|
+
if (isInPre || el.tagName.indexOf('-') > -1) {
|
|
6714
6781
|
baseSetAttr(el, key, value);
|
|
6715
6782
|
} else if (isBooleanAttr(key)) {
|
|
6716
6783
|
// set attribute for blank value
|
|
@@ -6952,10 +7019,11 @@ function updateDOMProps (oldVnode, vnode) {
|
|
|
6952
7019
|
}
|
|
6953
7020
|
|
|
6954
7021
|
for (key in oldProps) {
|
|
6955
|
-
if (
|
|
7022
|
+
if (!(key in props)) {
|
|
6956
7023
|
elm[key] = '';
|
|
6957
7024
|
}
|
|
6958
7025
|
}
|
|
7026
|
+
|
|
6959
7027
|
for (key in props) {
|
|
6960
7028
|
cur = props[key];
|
|
6961
7029
|
// ignore children if the node has textContent or innerHTML,
|
|
@@ -6995,7 +7063,7 @@ function updateDOMProps (oldVnode, vnode) {
|
|
|
6995
7063
|
// skip the update if old and new VDOM state is the same.
|
|
6996
7064
|
// `value` is handled separately because the DOM value may be temporarily
|
|
6997
7065
|
// out of sync with VDOM state due to focus, composition and modifiers.
|
|
6998
|
-
// This #4521 by skipping the
|
|
7066
|
+
// This #4521 by skipping the unnecessary `checked` update.
|
|
6999
7067
|
cur !== oldProps[key]
|
|
7000
7068
|
) {
|
|
7001
7069
|
// some property updates can throw
|