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.esm.browser.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
|
/* */
|
|
@@ -1734,13 +1734,14 @@ function assertProp (
|
|
|
1734
1734
|
type = [type];
|
|
1735
1735
|
}
|
|
1736
1736
|
for (let i = 0; i < type.length && !valid; i++) {
|
|
1737
|
-
const assertedType = assertType(value, type[i]);
|
|
1737
|
+
const assertedType = assertType(value, type[i], vm);
|
|
1738
1738
|
expectedTypes.push(assertedType.expectedType || '');
|
|
1739
1739
|
valid = assertedType.valid;
|
|
1740
1740
|
}
|
|
1741
1741
|
}
|
|
1742
1742
|
|
|
1743
|
-
|
|
1743
|
+
const haveExpectedTypes = expectedTypes.some(t => t);
|
|
1744
|
+
if (!valid && haveExpectedTypes) {
|
|
1744
1745
|
warn(
|
|
1745
1746
|
getInvalidTypeMessage(name, value, expectedTypes),
|
|
1746
1747
|
vm
|
|
@@ -1758,9 +1759,9 @@ function assertProp (
|
|
|
1758
1759
|
}
|
|
1759
1760
|
}
|
|
1760
1761
|
|
|
1761
|
-
const simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
|
|
1762
|
+
const simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
|
|
1762
1763
|
|
|
1763
|
-
function assertType (value, type) {
|
|
1764
|
+
function assertType (value, type, vm) {
|
|
1764
1765
|
let valid;
|
|
1765
1766
|
const expectedType = getType(type);
|
|
1766
1767
|
if (simpleCheckRE.test(expectedType)) {
|
|
@@ -1775,7 +1776,12 @@ function assertType (value, type) {
|
|
|
1775
1776
|
} else if (expectedType === 'Array') {
|
|
1776
1777
|
valid = Array.isArray(value);
|
|
1777
1778
|
} else {
|
|
1778
|
-
|
|
1779
|
+
try {
|
|
1780
|
+
valid = value instanceof type;
|
|
1781
|
+
} catch (e) {
|
|
1782
|
+
warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
|
|
1783
|
+
valid = false;
|
|
1784
|
+
}
|
|
1779
1785
|
}
|
|
1780
1786
|
return {
|
|
1781
1787
|
valid,
|
|
@@ -1783,13 +1789,15 @@ function assertType (value, type) {
|
|
|
1783
1789
|
}
|
|
1784
1790
|
}
|
|
1785
1791
|
|
|
1792
|
+
const functionTypeCheckRE = /^\s*function (\w+)/;
|
|
1793
|
+
|
|
1786
1794
|
/**
|
|
1787
1795
|
* Use function string name to check built-in types,
|
|
1788
1796
|
* because a simple equality check will fail when running
|
|
1789
1797
|
* across different vms / iframes.
|
|
1790
1798
|
*/
|
|
1791
1799
|
function getType (fn) {
|
|
1792
|
-
const match = fn && fn.toString().match(
|
|
1800
|
+
const match = fn && fn.toString().match(functionTypeCheckRE);
|
|
1793
1801
|
return match ? match[1] : ''
|
|
1794
1802
|
}
|
|
1795
1803
|
|
|
@@ -1814,18 +1822,19 @@ function getInvalidTypeMessage (name, value, expectedTypes) {
|
|
|
1814
1822
|
` Expected ${expectedTypes.map(capitalize).join(', ')}`;
|
|
1815
1823
|
const expectedType = expectedTypes[0];
|
|
1816
1824
|
const receivedType = toRawType(value);
|
|
1817
|
-
const expectedValue = styleValue(value, expectedType);
|
|
1818
|
-
const receivedValue = styleValue(value, receivedType);
|
|
1819
1825
|
// check if we need to specify expected value
|
|
1820
|
-
if (
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1826
|
+
if (
|
|
1827
|
+
expectedTypes.length === 1 &&
|
|
1828
|
+
isExplicable(expectedType) &&
|
|
1829
|
+
isExplicable(typeof value) &&
|
|
1830
|
+
!isBoolean(expectedType, receivedType)
|
|
1831
|
+
) {
|
|
1832
|
+
message += ` with value ${styleValue(value, expectedType)}`;
|
|
1824
1833
|
}
|
|
1825
1834
|
message += `, got ${receivedType} `;
|
|
1826
1835
|
// check if we need to specify received value
|
|
1827
1836
|
if (isExplicable(receivedType)) {
|
|
1828
|
-
message += `with value ${
|
|
1837
|
+
message += `with value ${styleValue(value, receivedType)}.`;
|
|
1829
1838
|
}
|
|
1830
1839
|
return message
|
|
1831
1840
|
}
|
|
@@ -1840,9 +1849,9 @@ function styleValue (value, type) {
|
|
|
1840
1849
|
}
|
|
1841
1850
|
}
|
|
1842
1851
|
|
|
1852
|
+
const EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
|
|
1843
1853
|
function isExplicable (value) {
|
|
1844
|
-
|
|
1845
|
-
return explicitTypes.some(elem => value.toLowerCase() === elem)
|
|
1854
|
+
return EXPLICABLE_TYPES.some(elem => value.toLowerCase() === elem)
|
|
1846
1855
|
}
|
|
1847
1856
|
|
|
1848
1857
|
function isBoolean (...args) {
|
|
@@ -1996,7 +2005,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
|
|
1996
2005
|
isUsingMicroTask = true;
|
|
1997
2006
|
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
|
1998
2007
|
// Fallback to setImmediate.
|
|
1999
|
-
//
|
|
2008
|
+
// Technically it leverages the (macro) task queue,
|
|
2000
2009
|
// but it is still a better choice than setTimeout.
|
|
2001
2010
|
timerFunc = () => {
|
|
2002
2011
|
setImmediate(flushCallbacks);
|
|
@@ -2066,7 +2075,7 @@ let initProxy;
|
|
|
2066
2075
|
const allowedGlobals = makeMap(
|
|
2067
2076
|
'Infinity,undefined,NaN,isFinite,isNaN,' +
|
|
2068
2077
|
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
|
2069
|
-
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
|
|
2078
|
+
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
|
|
2070
2079
|
'require' // for Webpack/Browserify
|
|
2071
2080
|
);
|
|
2072
2081
|
|
|
@@ -2085,7 +2094,7 @@ let initProxy;
|
|
|
2085
2094
|
warn(
|
|
2086
2095
|
`Property "${key}" must be accessed with "$data.${key}" because ` +
|
|
2087
2096
|
'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
|
2088
|
-
'prevent conflicts with Vue internals' +
|
|
2097
|
+
'prevent conflicts with Vue internals. ' +
|
|
2089
2098
|
'See: https://vuejs.org/v2/api/#data',
|
|
2090
2099
|
target
|
|
2091
2100
|
);
|
|
@@ -2566,14 +2575,20 @@ function isWhitespace (node) {
|
|
|
2566
2575
|
|
|
2567
2576
|
/* */
|
|
2568
2577
|
|
|
2578
|
+
function isAsyncPlaceholder (node) {
|
|
2579
|
+
return node.isComment && node.asyncFactory
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
/* */
|
|
2583
|
+
|
|
2569
2584
|
function normalizeScopedSlots (
|
|
2570
2585
|
slots,
|
|
2571
2586
|
normalSlots,
|
|
2572
2587
|
prevSlots
|
|
2573
2588
|
) {
|
|
2574
2589
|
let res;
|
|
2575
|
-
const isStable = slots ? !!slots.$stable : true;
|
|
2576
2590
|
const hasNormalSlots = Object.keys(normalSlots).length > 0;
|
|
2591
|
+
const isStable = slots ? !!slots.$stable : !hasNormalSlots;
|
|
2577
2592
|
const key = slots && slots.$key;
|
|
2578
2593
|
if (!slots) {
|
|
2579
2594
|
res = {};
|
|
@@ -2622,9 +2637,10 @@ function normalizeScopedSlot(normalSlots, key, fn) {
|
|
|
2622
2637
|
res = res && typeof res === 'object' && !Array.isArray(res)
|
|
2623
2638
|
? [res] // single vnode
|
|
2624
2639
|
: normalizeChildren(res);
|
|
2640
|
+
let vnode = res && res[0];
|
|
2625
2641
|
return res && (
|
|
2626
|
-
|
|
2627
|
-
(
|
|
2642
|
+
!vnode ||
|
|
2643
|
+
(vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
|
|
2628
2644
|
) ? undefined
|
|
2629
2645
|
: res
|
|
2630
2646
|
};
|
|
@@ -2697,26 +2713,28 @@ function renderList (
|
|
|
2697
2713
|
*/
|
|
2698
2714
|
function renderSlot (
|
|
2699
2715
|
name,
|
|
2700
|
-
|
|
2716
|
+
fallbackRender,
|
|
2701
2717
|
props,
|
|
2702
2718
|
bindObject
|
|
2703
2719
|
) {
|
|
2704
2720
|
const scopedSlotFn = this.$scopedSlots[name];
|
|
2705
2721
|
let nodes;
|
|
2706
|
-
if (scopedSlotFn) {
|
|
2722
|
+
if (scopedSlotFn) {
|
|
2723
|
+
// scoped slot
|
|
2707
2724
|
props = props || {};
|
|
2708
2725
|
if (bindObject) {
|
|
2709
2726
|
if (!isObject(bindObject)) {
|
|
2710
|
-
warn(
|
|
2711
|
-
'slot v-bind without argument expects an Object',
|
|
2712
|
-
this
|
|
2713
|
-
);
|
|
2727
|
+
warn('slot v-bind without argument expects an Object', this);
|
|
2714
2728
|
}
|
|
2715
2729
|
props = extend(extend({}, bindObject), props);
|
|
2716
2730
|
}
|
|
2717
|
-
nodes =
|
|
2731
|
+
nodes =
|
|
2732
|
+
scopedSlotFn(props) ||
|
|
2733
|
+
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
|
|
2718
2734
|
} else {
|
|
2719
|
-
nodes =
|
|
2735
|
+
nodes =
|
|
2736
|
+
this.$slots[name] ||
|
|
2737
|
+
(typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
|
|
2720
2738
|
}
|
|
2721
2739
|
|
|
2722
2740
|
const target = props && props.slot;
|
|
@@ -2766,6 +2784,7 @@ function checkKeyCodes (
|
|
|
2766
2784
|
} else if (eventKeyName) {
|
|
2767
2785
|
return hyphenate(eventKeyName) !== key
|
|
2768
2786
|
}
|
|
2787
|
+
return eventKeyCode === undefined
|
|
2769
2788
|
}
|
|
2770
2789
|
|
|
2771
2790
|
/* */
|
|
@@ -2940,7 +2959,7 @@ function bindDynamicKeys (baseObj, values) {
|
|
|
2940
2959
|
if (typeof key === 'string' && key) {
|
|
2941
2960
|
baseObj[values[i]] = values[i + 1];
|
|
2942
2961
|
} else if (key !== '' && key !== null) {
|
|
2943
|
-
// null is a
|
|
2962
|
+
// null is a special value for explicitly removing a binding
|
|
2944
2963
|
warn(
|
|
2945
2964
|
`Invalid value for dynamic directive argument (expected string or null): ${key}`,
|
|
2946
2965
|
this
|
|
@@ -3292,8 +3311,10 @@ function createComponent (
|
|
|
3292
3311
|
}
|
|
3293
3312
|
|
|
3294
3313
|
function createComponentInstanceForVnode (
|
|
3295
|
-
|
|
3296
|
-
|
|
3314
|
+
// we know it's MountedComponentVNode but flow doesn't
|
|
3315
|
+
vnode,
|
|
3316
|
+
// activeInstance in lifecycle state
|
|
3317
|
+
parent
|
|
3297
3318
|
) {
|
|
3298
3319
|
const options = {
|
|
3299
3320
|
_isComponent: true,
|
|
@@ -3432,6 +3453,12 @@ function _createElement (
|
|
|
3432
3453
|
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
|
3433
3454
|
if (config.isReservedTag(tag)) {
|
|
3434
3455
|
// platform built-in elements
|
|
3456
|
+
if (isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') {
|
|
3457
|
+
warn(
|
|
3458
|
+
`The .native modifier for v-on is only valid on components but it was used on <${tag}>.`,
|
|
3459
|
+
context
|
|
3460
|
+
);
|
|
3461
|
+
}
|
|
3435
3462
|
vnode = new VNode(
|
|
3436
3463
|
config.parsePlatformTagName(tag), data, children,
|
|
3437
3464
|
undefined, undefined, context
|
|
@@ -3555,7 +3582,7 @@ function renderMixin (Vue) {
|
|
|
3555
3582
|
// render self
|
|
3556
3583
|
let vnode;
|
|
3557
3584
|
try {
|
|
3558
|
-
// There's no need to maintain a stack
|
|
3585
|
+
// There's no need to maintain a stack because all render fns are called
|
|
3559
3586
|
// separately from one another. Nested component's render fns are called
|
|
3560
3587
|
// when parent component is patched.
|
|
3561
3588
|
currentRenderingInstance = vm;
|
|
@@ -3650,7 +3677,9 @@ function resolveAsyncComponent (
|
|
|
3650
3677
|
|
|
3651
3678
|
if (owner && !isDef(factory.owners)) {
|
|
3652
3679
|
const owners = factory.owners = [owner];
|
|
3653
|
-
let sync = true
|
|
3680
|
+
let sync = true;
|
|
3681
|
+
let timerLoading = null;
|
|
3682
|
+
let timerTimeout = null
|
|
3654
3683
|
|
|
3655
3684
|
;(owner).$on('hook:destroyed', () => remove(owners, owner));
|
|
3656
3685
|
|
|
@@ -3661,6 +3690,14 @@ function resolveAsyncComponent (
|
|
|
3661
3690
|
|
|
3662
3691
|
if (renderCompleted) {
|
|
3663
3692
|
owners.length = 0;
|
|
3693
|
+
if (timerLoading !== null) {
|
|
3694
|
+
clearTimeout(timerLoading);
|
|
3695
|
+
timerLoading = null;
|
|
3696
|
+
}
|
|
3697
|
+
if (timerTimeout !== null) {
|
|
3698
|
+
clearTimeout(timerTimeout);
|
|
3699
|
+
timerTimeout = null;
|
|
3700
|
+
}
|
|
3664
3701
|
}
|
|
3665
3702
|
};
|
|
3666
3703
|
|
|
@@ -3707,7 +3744,8 @@ function resolveAsyncComponent (
|
|
|
3707
3744
|
if (res.delay === 0) {
|
|
3708
3745
|
factory.loading = true;
|
|
3709
3746
|
} else {
|
|
3710
|
-
setTimeout(() => {
|
|
3747
|
+
timerLoading = setTimeout(() => {
|
|
3748
|
+
timerLoading = null;
|
|
3711
3749
|
if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
|
3712
3750
|
factory.loading = true;
|
|
3713
3751
|
forceRender(false);
|
|
@@ -3717,7 +3755,8 @@ function resolveAsyncComponent (
|
|
|
3717
3755
|
}
|
|
3718
3756
|
|
|
3719
3757
|
if (isDef(res.timeout)) {
|
|
3720
|
-
setTimeout(() => {
|
|
3758
|
+
timerTimeout = setTimeout(() => {
|
|
3759
|
+
timerTimeout = null;
|
|
3721
3760
|
if (isUndef(factory.resolved)) {
|
|
3722
3761
|
reject(
|
|
3723
3762
|
`timeout (${res.timeout}ms)`
|
|
@@ -3738,12 +3777,6 @@ function resolveAsyncComponent (
|
|
|
3738
3777
|
|
|
3739
3778
|
/* */
|
|
3740
3779
|
|
|
3741
|
-
function isAsyncPlaceholder (node) {
|
|
3742
|
-
return node.isComment && node.asyncFactory
|
|
3743
|
-
}
|
|
3744
|
-
|
|
3745
|
-
/* */
|
|
3746
|
-
|
|
3747
3780
|
function getFirstComponentChild (children) {
|
|
3748
3781
|
if (Array.isArray(children)) {
|
|
3749
3782
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -4110,7 +4143,8 @@ function updateChildComponent (
|
|
|
4110
4143
|
const hasDynamicScopedSlot = !!(
|
|
4111
4144
|
(newScopedSlots && !newScopedSlots.$stable) ||
|
|
4112
4145
|
(oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
|
4113
|
-
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
|
|
4146
|
+
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
|
|
4147
|
+
(!newScopedSlots && vm.$scopedSlots.$key)
|
|
4114
4148
|
);
|
|
4115
4149
|
|
|
4116
4150
|
// Any static slot children from the parent may have changed during parent's
|
|
@@ -4263,16 +4297,21 @@ let getNow = Date.now;
|
|
|
4263
4297
|
// timestamp can either be hi-res (relative to page load) or low-res
|
|
4264
4298
|
// (relative to UNIX epoch), so in order to compare time we have to use the
|
|
4265
4299
|
// same timestamp type when saving the flush timestamp.
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4300
|
+
// All IE versions use low-res event timestamps, and have problematic clock
|
|
4301
|
+
// implementations (#9632)
|
|
4302
|
+
if (inBrowser && !isIE) {
|
|
4303
|
+
const performance = window.performance;
|
|
4304
|
+
if (
|
|
4305
|
+
performance &&
|
|
4306
|
+
typeof performance.now === 'function' &&
|
|
4307
|
+
getNow() > document.createEvent('Event').timeStamp
|
|
4308
|
+
) {
|
|
4309
|
+
// if the event timestamp, although evaluated AFTER the Date.now(), is
|
|
4310
|
+
// smaller than it, it means the event is using a hi-res timestamp,
|
|
4311
|
+
// and we need to use the hi-res version for event listener timestamps as
|
|
4312
|
+
// well.
|
|
4313
|
+
getNow = () => performance.now();
|
|
4314
|
+
}
|
|
4276
4315
|
}
|
|
4277
4316
|
|
|
4278
4317
|
/**
|
|
@@ -4576,11 +4615,8 @@ class Watcher {
|
|
|
4576
4615
|
const oldValue = this.value;
|
|
4577
4616
|
this.value = value;
|
|
4578
4617
|
if (this.user) {
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
} catch (e) {
|
|
4582
|
-
handleError(e, this.vm, `callback for watcher "${this.expression}"`);
|
|
4583
|
-
}
|
|
4618
|
+
const info = `callback for watcher "${this.expression}"`;
|
|
4619
|
+
invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
|
|
4584
4620
|
} else {
|
|
4585
4621
|
this.cb.call(this.vm, value, oldValue);
|
|
4586
4622
|
}
|
|
@@ -4801,6 +4837,8 @@ function initComputed (vm, computed) {
|
|
|
4801
4837
|
warn(`The computed property "${key}" is already defined in data.`, vm);
|
|
4802
4838
|
} else if (vm.$options.props && key in vm.$options.props) {
|
|
4803
4839
|
warn(`The computed property "${key}" is already defined as a prop.`, vm);
|
|
4840
|
+
} else if (vm.$options.methods && key in vm.$options.methods) {
|
|
4841
|
+
warn(`The computed property "${key}" is already defined as a method.`, vm);
|
|
4804
4842
|
}
|
|
4805
4843
|
}
|
|
4806
4844
|
}
|
|
@@ -4953,11 +4991,10 @@ function stateMixin (Vue) {
|
|
|
4953
4991
|
options.user = true;
|
|
4954
4992
|
const watcher = new Watcher(vm, expOrFn, cb, options);
|
|
4955
4993
|
if (options.immediate) {
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
}
|
|
4994
|
+
const info = `callback for immediate watcher "${watcher.expression}"`;
|
|
4995
|
+
pushTarget();
|
|
4996
|
+
invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
|
|
4997
|
+
popTarget();
|
|
4961
4998
|
}
|
|
4962
4999
|
return function unwatchFn () {
|
|
4963
5000
|
watcher.teardown();
|
|
@@ -5255,6 +5292,8 @@ function initAssetRegisters (Vue) {
|
|
|
5255
5292
|
|
|
5256
5293
|
|
|
5257
5294
|
|
|
5295
|
+
|
|
5296
|
+
|
|
5258
5297
|
function getComponentName (opts) {
|
|
5259
5298
|
return opts && (opts.Ctor.options.name || opts.tag)
|
|
5260
5299
|
}
|
|
@@ -5274,9 +5313,9 @@ function matches (pattern, name) {
|
|
|
5274
5313
|
function pruneCache (keepAliveInstance, filter) {
|
|
5275
5314
|
const { cache, keys, _vnode } = keepAliveInstance;
|
|
5276
5315
|
for (const key in cache) {
|
|
5277
|
-
const
|
|
5278
|
-
if (
|
|
5279
|
-
const name =
|
|
5316
|
+
const entry = cache[key];
|
|
5317
|
+
if (entry) {
|
|
5318
|
+
const name = entry.name;
|
|
5280
5319
|
if (name && !filter(name)) {
|
|
5281
5320
|
pruneCacheEntry(cache, key, keys, _vnode);
|
|
5282
5321
|
}
|
|
@@ -5290,9 +5329,9 @@ function pruneCacheEntry (
|
|
|
5290
5329
|
keys,
|
|
5291
5330
|
current
|
|
5292
5331
|
) {
|
|
5293
|
-
const
|
|
5294
|
-
if (
|
|
5295
|
-
|
|
5332
|
+
const entry = cache[key];
|
|
5333
|
+
if (entry && (!current || entry.tag !== current.tag)) {
|
|
5334
|
+
entry.componentInstance.$destroy();
|
|
5296
5335
|
}
|
|
5297
5336
|
cache[key] = null;
|
|
5298
5337
|
remove(keys, key);
|
|
@@ -5310,6 +5349,26 @@ var KeepAlive = {
|
|
|
5310
5349
|
max: [String, Number]
|
|
5311
5350
|
},
|
|
5312
5351
|
|
|
5352
|
+
methods: {
|
|
5353
|
+
cacheVNode() {
|
|
5354
|
+
const { cache, keys, vnodeToCache, keyToCache } = this;
|
|
5355
|
+
if (vnodeToCache) {
|
|
5356
|
+
const { tag, componentInstance, componentOptions } = vnodeToCache;
|
|
5357
|
+
cache[keyToCache] = {
|
|
5358
|
+
name: getComponentName(componentOptions),
|
|
5359
|
+
tag,
|
|
5360
|
+
componentInstance,
|
|
5361
|
+
};
|
|
5362
|
+
keys.push(keyToCache);
|
|
5363
|
+
// prune oldest entry
|
|
5364
|
+
if (this.max && keys.length > parseInt(this.max)) {
|
|
5365
|
+
pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
|
5366
|
+
}
|
|
5367
|
+
this.vnodeToCache = null;
|
|
5368
|
+
}
|
|
5369
|
+
}
|
|
5370
|
+
},
|
|
5371
|
+
|
|
5313
5372
|
created () {
|
|
5314
5373
|
this.cache = Object.create(null);
|
|
5315
5374
|
this.keys = [];
|
|
@@ -5322,6 +5381,7 @@ var KeepAlive = {
|
|
|
5322
5381
|
},
|
|
5323
5382
|
|
|
5324
5383
|
mounted () {
|
|
5384
|
+
this.cacheVNode();
|
|
5325
5385
|
this.$watch('include', val => {
|
|
5326
5386
|
pruneCache(this, name => matches(val, name));
|
|
5327
5387
|
});
|
|
@@ -5330,6 +5390,10 @@ var KeepAlive = {
|
|
|
5330
5390
|
});
|
|
5331
5391
|
},
|
|
5332
5392
|
|
|
5393
|
+
updated () {
|
|
5394
|
+
this.cacheVNode();
|
|
5395
|
+
},
|
|
5396
|
+
|
|
5333
5397
|
render () {
|
|
5334
5398
|
const slot = this.$slots.default;
|
|
5335
5399
|
const vnode = getFirstComponentChild(slot);
|
|
@@ -5359,12 +5423,9 @@ var KeepAlive = {
|
|
|
5359
5423
|
remove(keys, key);
|
|
5360
5424
|
keys.push(key);
|
|
5361
5425
|
} else {
|
|
5362
|
-
cache
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
if (this.max && keys.length > parseInt(this.max)) {
|
|
5366
|
-
pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
|
5367
|
-
}
|
|
5426
|
+
// delay setting the cache until update
|
|
5427
|
+
this.vnodeToCache = vnode;
|
|
5428
|
+
this.keyToCache = key;
|
|
5368
5429
|
}
|
|
5369
5430
|
|
|
5370
5431
|
vnode.data.keepAlive = true;
|
|
@@ -5447,7 +5508,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
|
|
5447
5508
|
value: FunctionalRenderContext
|
|
5448
5509
|
});
|
|
5449
5510
|
|
|
5450
|
-
Vue.version = '2.6.
|
|
5511
|
+
Vue.version = '2.6.13';
|
|
5451
5512
|
|
|
5452
5513
|
/* */
|
|
5453
5514
|
|
|
@@ -5484,7 +5545,7 @@ const isBooleanAttr = makeMap(
|
|
|
5484
5545
|
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
|
5485
5546
|
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
|
5486
5547
|
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
|
5487
|
-
'required,reversed,scoped,seamless,selected,sortable,
|
|
5548
|
+
'required,reversed,scoped,seamless,selected,sortable,' +
|
|
5488
5549
|
'truespeed,typemustmatch,visible'
|
|
5489
5550
|
);
|
|
5490
5551
|
|
|
@@ -5608,7 +5669,7 @@ const isHTMLTag = makeMap(
|
|
|
5608
5669
|
// contain child elements.
|
|
5609
5670
|
const isSVG = makeMap(
|
|
5610
5671
|
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
|
5611
|
-
'
|
|
5672
|
+
'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
|
5612
5673
|
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
|
5613
5674
|
true
|
|
5614
5675
|
);
|
|
@@ -5813,7 +5874,8 @@ const hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
|
|
5813
5874
|
|
|
5814
5875
|
function sameVnode (a, b) {
|
|
5815
5876
|
return (
|
|
5816
|
-
a.key === b.key &&
|
|
5877
|
+
a.key === b.key &&
|
|
5878
|
+
a.asyncFactory === b.asyncFactory && (
|
|
5817
5879
|
(
|
|
5818
5880
|
a.tag === b.tag &&
|
|
5819
5881
|
a.isComment === b.isComment &&
|
|
@@ -5821,7 +5883,6 @@ function sameVnode (a, b) {
|
|
|
5821
5883
|
sameInputType(a, b)
|
|
5822
5884
|
) || (
|
|
5823
5885
|
isTrue(a.isAsyncPlaceholder) &&
|
|
5824
|
-
a.asyncFactory === b.asyncFactory &&
|
|
5825
5886
|
isUndef(b.asyncFactory.error)
|
|
5826
5887
|
)
|
|
5827
5888
|
)
|
|
@@ -6119,7 +6180,7 @@ function createPatchFunction (backend) {
|
|
|
6119
6180
|
}
|
|
6120
6181
|
}
|
|
6121
6182
|
|
|
6122
|
-
function removeVnodes (
|
|
6183
|
+
function removeVnodes (vnodes, startIdx, endIdx) {
|
|
6123
6184
|
for (; startIdx <= endIdx; ++startIdx) {
|
|
6124
6185
|
const ch = vnodes[startIdx];
|
|
6125
6186
|
if (isDef(ch)) {
|
|
@@ -6230,7 +6291,7 @@ function createPatchFunction (backend) {
|
|
|
6230
6291
|
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
|
6231
6292
|
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
|
6232
6293
|
} else if (newStartIdx > newEndIdx) {
|
|
6233
|
-
removeVnodes(
|
|
6294
|
+
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
|
6234
6295
|
}
|
|
6235
6296
|
}
|
|
6236
6297
|
|
|
@@ -6322,7 +6383,7 @@ function createPatchFunction (backend) {
|
|
|
6322
6383
|
if (isDef(oldVnode.text)) nodeOps.setTextContent(elm, '');
|
|
6323
6384
|
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
|
6324
6385
|
} else if (isDef(oldCh)) {
|
|
6325
|
-
removeVnodes(
|
|
6386
|
+
removeVnodes(oldCh, 0, oldCh.length - 1);
|
|
6326
6387
|
} else if (isDef(oldVnode.text)) {
|
|
6327
6388
|
nodeOps.setTextContent(elm, '');
|
|
6328
6389
|
}
|
|
@@ -6549,7 +6610,7 @@ function createPatchFunction (backend) {
|
|
|
6549
6610
|
|
|
6550
6611
|
// destroy old node
|
|
6551
6612
|
if (isDef(parentElm)) {
|
|
6552
|
-
removeVnodes(
|
|
6613
|
+
removeVnodes([oldVnode], 0, 0);
|
|
6553
6614
|
} else if (isDef(oldVnode.tag)) {
|
|
6554
6615
|
invokeDestroyHook(oldVnode);
|
|
6555
6616
|
}
|
|
@@ -6706,7 +6767,7 @@ function updateAttrs (oldVnode, vnode) {
|
|
|
6706
6767
|
cur = attrs[key];
|
|
6707
6768
|
old = oldAttrs[key];
|
|
6708
6769
|
if (old !== cur) {
|
|
6709
|
-
setAttr(elm, key, cur);
|
|
6770
|
+
setAttr(elm, key, cur, vnode.data.pre);
|
|
6710
6771
|
}
|
|
6711
6772
|
}
|
|
6712
6773
|
// #4391: in IE9, setting type can reset value for input[type=radio]
|
|
@@ -6726,8 +6787,8 @@ function updateAttrs (oldVnode, vnode) {
|
|
|
6726
6787
|
}
|
|
6727
6788
|
}
|
|
6728
6789
|
|
|
6729
|
-
function setAttr (el, key, value) {
|
|
6730
|
-
if (el.tagName.indexOf('-') > -1) {
|
|
6790
|
+
function setAttr (el, key, value, isInPre) {
|
|
6791
|
+
if (isInPre || el.tagName.indexOf('-') > -1) {
|
|
6731
6792
|
baseSetAttr(el, key, value);
|
|
6732
6793
|
} else if (isBooleanAttr(key)) {
|
|
6733
6794
|
// set attribute for blank value
|
|
@@ -7601,10 +7662,11 @@ function updateDOMProps (oldVnode, vnode) {
|
|
|
7601
7662
|
}
|
|
7602
7663
|
|
|
7603
7664
|
for (key in oldProps) {
|
|
7604
|
-
if (
|
|
7665
|
+
if (!(key in props)) {
|
|
7605
7666
|
elm[key] = '';
|
|
7606
7667
|
}
|
|
7607
7668
|
}
|
|
7669
|
+
|
|
7608
7670
|
for (key in props) {
|
|
7609
7671
|
cur = props[key];
|
|
7610
7672
|
// ignore children if the node has textContent or innerHTML,
|
|
@@ -7644,7 +7706,7 @@ function updateDOMProps (oldVnode, vnode) {
|
|
|
7644
7706
|
// skip the update if old and new VDOM state is the same.
|
|
7645
7707
|
// `value` is handled separately because the DOM value may be temporarily
|
|
7646
7708
|
// out of sync with VDOM state due to focus, composition and modifiers.
|
|
7647
|
-
// This #4521 by skipping the
|
|
7709
|
+
// This #4521 by skipping the unnecessary `checked` update.
|
|
7648
7710
|
cur !== oldProps[key]
|
|
7649
7711
|
) {
|
|
7650
7712
|
// some property updates can throw
|
|
@@ -9236,14 +9298,14 @@ const isNonPhrasingTag = makeMap(
|
|
|
9236
9298
|
|
|
9237
9299
|
// Regular Expressions for parsing tags and attributes
|
|
9238
9300
|
const attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
|
9239
|
-
const dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]
|
|
9301
|
+
const dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
|
9240
9302
|
const ncname = `[a-zA-Z_][\\-\\.0-9_a-zA-Z${unicodeRegExp.source}]*`;
|
|
9241
9303
|
const qnameCapture = `((?:${ncname}\\:)?${ncname})`;
|
|
9242
9304
|
const startTagOpen = new RegExp(`^<${qnameCapture}`);
|
|
9243
9305
|
const startTagClose = /^\s*(\/?)>/;
|
|
9244
9306
|
const endTag = new RegExp(`^<\\/${qnameCapture}[^>]*>`);
|
|
9245
9307
|
const doctype = /^<!DOCTYPE [^>]+>/i;
|
|
9246
|
-
// #7298: escape - to avoid being
|
|
9308
|
+
// #7298: escape - to avoid being passed as HTML comment when inlined in page
|
|
9247
9309
|
const comment = /^<!\--/;
|
|
9248
9310
|
const conditionalComment = /^<!\[/;
|
|
9249
9311
|
|
|
@@ -9528,7 +9590,7 @@ function parseHTML (html, options) {
|
|
|
9528
9590
|
/* */
|
|
9529
9591
|
|
|
9530
9592
|
const onRE = /^@|^v-on:/;
|
|
9531
|
-
const dirRE = /^v
|
|
9593
|
+
const dirRE = /^v-|^@|^:|^#/;
|
|
9532
9594
|
const forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
|
9533
9595
|
const forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
|
9534
9596
|
const stripParensRE = /^\(|\)$/g;
|
|
@@ -9541,7 +9603,7 @@ const modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
|
|
|
9541
9603
|
const slotRE = /^v-slot(:|$)|^#/;
|
|
9542
9604
|
|
|
9543
9605
|
const lineBreakRE = /[\r\n]/;
|
|
9544
|
-
const whitespaceRE$1 =
|
|
9606
|
+
const whitespaceRE$1 = /[ \f\t\r\n]+/g;
|
|
9545
9607
|
|
|
9546
9608
|
const invalidAttributeRE = /[\s"'<>\/=]/;
|
|
9547
9609
|
|
|
@@ -9589,8 +9651,12 @@ function parse (
|
|
|
9589
9651
|
platformMustUseProp = options.mustUseProp || no;
|
|
9590
9652
|
platformGetTagNamespace = options.getTagNamespace || no;
|
|
9591
9653
|
const isReservedTag = options.isReservedTag || no;
|
|
9592
|
-
maybeComponent = (el) => !!
|
|
9593
|
-
|
|
9654
|
+
maybeComponent = (el) => !!(
|
|
9655
|
+
el.component ||
|
|
9656
|
+
el.attrsMap[':is'] ||
|
|
9657
|
+
el.attrsMap['v-bind:is'] ||
|
|
9658
|
+
!(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag))
|
|
9659
|
+
);
|
|
9594
9660
|
transforms = pluckModuleFunction(options.modules, 'transformNode');
|
|
9595
9661
|
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
|
9596
9662
|
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
|
|
@@ -9883,7 +9949,7 @@ function parse (
|
|
|
9883
9949
|
}
|
|
9884
9950
|
},
|
|
9885
9951
|
comment (text, start, end) {
|
|
9886
|
-
// adding
|
|
9952
|
+
// adding anything as a sibling to the root node is forbidden
|
|
9887
9953
|
// comments should still be allowed, but ignored
|
|
9888
9954
|
if (currentParent) {
|
|
9889
9955
|
const child = {
|
|
@@ -10152,7 +10218,7 @@ function processSlotContent (el) {
|
|
|
10152
10218
|
if (el.parent && !maybeComponent(el.parent)) {
|
|
10153
10219
|
warn$2(
|
|
10154
10220
|
`<template v-slot> can only appear at the root level inside ` +
|
|
10155
|
-
`the receiving
|
|
10221
|
+
`the receiving component`,
|
|
10156
10222
|
el
|
|
10157
10223
|
);
|
|
10158
10224
|
}
|
|
@@ -10711,7 +10777,7 @@ function isDirectChildOfTemplateFor (node) {
|
|
|
10711
10777
|
|
|
10712
10778
|
/* */
|
|
10713
10779
|
|
|
10714
|
-
const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
|
|
10780
|
+
const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
|
|
10715
10781
|
const fnInvokeRE = /\([^)]*?\);*$/;
|
|
10716
10782
|
const simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
|
|
10717
10783
|
|
|
@@ -10837,9 +10903,9 @@ function genHandler (handler) {
|
|
|
10837
10903
|
code += genModifierCode;
|
|
10838
10904
|
}
|
|
10839
10905
|
const handlerCode = isMethodPath
|
|
10840
|
-
? `return ${handler.value}(
|
|
10906
|
+
? `return ${handler.value}.apply(null, arguments)`
|
|
10841
10907
|
: isFunctionExpression
|
|
10842
|
-
? `return (${handler.value})(
|
|
10908
|
+
? `return (${handler.value}).apply(null, arguments)`
|
|
10843
10909
|
: isFunctionInvocation
|
|
10844
10910
|
? `return ${handler.value}`
|
|
10845
10911
|
: handler.value;
|
|
@@ -10941,7 +11007,8 @@ function generate (
|
|
|
10941
11007
|
options
|
|
10942
11008
|
) {
|
|
10943
11009
|
const state = new CodegenState(options);
|
|
10944
|
-
|
|
11010
|
+
// fix #11483, Root level <script> tags should not be rendered.
|
|
11011
|
+
const code = ast ? (ast.tag === 'script' ? 'null' : genElement(ast, state)) : '_c("div")';
|
|
10945
11012
|
return {
|
|
10946
11013
|
render: `with(this){return ${code}}`,
|
|
10947
11014
|
staticRenderFns: state.staticRenderFns
|
|
@@ -11439,7 +11506,7 @@ function genComment (comment) {
|
|
|
11439
11506
|
function genSlot (el, state) {
|
|
11440
11507
|
const slotName = el.slotName || '"default"';
|
|
11441
11508
|
const children = genChildren(el, state);
|
|
11442
|
-
let res = `_t(${slotName}${children ?
|
|
11509
|
+
let res = `_t(${slotName}${children ? `,function(){return ${children}}` : ''}`;
|
|
11443
11510
|
const attrs = el.attrs || el.dynamicAttrs
|
|
11444
11511
|
? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(attr => ({
|
|
11445
11512
|
// slot props are camelized
|
|
@@ -11536,6 +11603,8 @@ function checkNode (node, warn) {
|
|
|
11536
11603
|
const range = node.rawAttrsMap[name];
|
|
11537
11604
|
if (name === 'v-for') {
|
|
11538
11605
|
checkFor(node, `v-for="${value}"`, warn, range);
|
|
11606
|
+
} else if (name === 'v-slot' || name[0] === '#') {
|
|
11607
|
+
checkFunctionParameterExpression(value, `${name}="${value}"`, warn, range);
|
|
11539
11608
|
} else if (onRE.test(name)) {
|
|
11540
11609
|
checkEvent(value, `${name}="${value}"`, warn, range);
|
|
11541
11610
|
} else {
|
|
@@ -11555,9 +11624,9 @@ function checkNode (node, warn) {
|
|
|
11555
11624
|
}
|
|
11556
11625
|
|
|
11557
11626
|
function checkEvent (exp, text, warn, range) {
|
|
11558
|
-
const
|
|
11559
|
-
const keywordMatch =
|
|
11560
|
-
if (keywordMatch &&
|
|
11627
|
+
const stripped = exp.replace(stripStringRE, '');
|
|
11628
|
+
const keywordMatch = stripped.match(unaryOperatorsRE);
|
|
11629
|
+
if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
|
|
11561
11630
|
warn(
|
|
11562
11631
|
`avoid using JavaScript unary operator as property name: ` +
|
|
11563
11632
|
`"${keywordMatch[0]}" in expression ${text.trim()}`,
|
|
@@ -11612,6 +11681,19 @@ function checkExpression (exp, text, warn, range) {
|
|
|
11612
11681
|
}
|
|
11613
11682
|
}
|
|
11614
11683
|
|
|
11684
|
+
function checkFunctionParameterExpression (exp, text, warn, range) {
|
|
11685
|
+
try {
|
|
11686
|
+
new Function(exp, '');
|
|
11687
|
+
} catch (e) {
|
|
11688
|
+
warn(
|
|
11689
|
+
`invalid function parameter expression: ${e.message} in\n\n` +
|
|
11690
|
+
` ${exp}\n\n` +
|
|
11691
|
+
` Raw expression: ${text.trim()}\n`,
|
|
11692
|
+
range
|
|
11693
|
+
);
|
|
11694
|
+
}
|
|
11695
|
+
}
|
|
11696
|
+
|
|
11615
11697
|
/* */
|
|
11616
11698
|
|
|
11617
11699
|
const range = 2;
|