mirror of
https://github.com/vuejs/vue.git
synced 2024-11-22 04:39:46 +00:00
build: build 2.6.0-beta.2
This commit is contained in:
parent
dbc0582587
commit
90f47d1bc6
11667
dist/vue.common.dev.js
vendored
Normal file
11667
dist/vue.common.dev.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
dist/vue.common.prod.js
vendored
Normal file
6
dist/vue.common.prod.js
vendored
Normal file
File diff suppressed because one or more lines are too long
11724
dist/vue.esm.browser.js
vendored
Normal file
11724
dist/vue.esm.browser.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
dist/vue.esm.browser.min.js
vendored
Normal file
6
dist/vue.esm.browser.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
440
dist/vue.esm.js
vendored
440
dist/vue.esm.js
vendored
@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Vue.js v2.6.0-beta.1
|
||||
* Vue.js v2.6.0-beta.2
|
||||
* (c) 2014-2019 Evan You
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
@ -367,7 +367,7 @@ var LIFECYCLE_HOOKS = [
|
||||
'activated',
|
||||
'deactivated',
|
||||
'errorCaptured',
|
||||
'ssrPrefetch'
|
||||
'serverPrefetch'
|
||||
];
|
||||
|
||||
/* */
|
||||
@ -1887,6 +1887,8 @@ function logError (err, vm, info) {
|
||||
|
||||
/* */
|
||||
|
||||
var isUsingMicroTask = false;
|
||||
|
||||
var callbacks = [];
|
||||
var pending = false;
|
||||
|
||||
@ -1930,6 +1932,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
||||
// "force" the microtask queue to be flushed by adding an empty timer.
|
||||
if (isIOS) { setTimeout(noop); }
|
||||
};
|
||||
isUsingMicroTask = true;
|
||||
} else if (!isIE && typeof MutationObserver !== 'undefined' && (
|
||||
isNative(MutationObserver) ||
|
||||
// PhantomJS and iOS 7.x
|
||||
@ -1948,6 +1951,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
||||
counter = (counter + 1) % 2;
|
||||
textNode.data = String(counter);
|
||||
};
|
||||
isUsingMicroTask = true;
|
||||
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
||||
// Fallback to setImmediate.
|
||||
// Techinically it leverages the (macro) task queue,
|
||||
@ -2746,13 +2750,14 @@ function isWhitespace (node) {
|
||||
|
||||
function resolveScopedSlots (
|
||||
fns, // see flow/vnode
|
||||
hasDynamicKeys,
|
||||
res
|
||||
) {
|
||||
res = res || {};
|
||||
res = res || { $stable: !hasDynamicKeys };
|
||||
for (var i = 0; i < fns.length; i++) {
|
||||
var slot = fns[i];
|
||||
if (Array.isArray(slot)) {
|
||||
resolveScopedSlots(slot, res);
|
||||
resolveScopedSlots(slot, hasDynamicKeys, res);
|
||||
} else {
|
||||
res[slot.key] = slot.fn;
|
||||
}
|
||||
@ -2968,12 +2973,22 @@ function updateChildComponent (
|
||||
}
|
||||
|
||||
// determine whether component has slot children
|
||||
// we need to do this before overwriting $options._renderChildren
|
||||
var hasChildren = !!(
|
||||
// we need to do this before overwriting $options._renderChildren.
|
||||
|
||||
// check if there are dynamic scopedSlots (hand-written or compiled but with
|
||||
// dynamic slot names). Static scoped slots compiled from template has the
|
||||
// "$stable" marker.
|
||||
var hasDynamicScopedSlot = !!(
|
||||
(parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
|
||||
(vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
|
||||
);
|
||||
// Any static slot children from the parent may have changed during parent's
|
||||
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
||||
// update is necessary to ensure correctness.
|
||||
var needsForceUpdate = !!(
|
||||
renderChildren || // has new static slots
|
||||
vm.$options._renderChildren || // has old static slots
|
||||
parentVnode.data.scopedSlots || // has new scoped slots
|
||||
vm.$scopedSlots !== emptyObject // has old scoped slots
|
||||
hasDynamicScopedSlot
|
||||
);
|
||||
|
||||
vm.$options._parentVnode = parentVnode;
|
||||
@ -3012,7 +3027,7 @@ function updateChildComponent (
|
||||
updateComponentListeners(vm, listeners, oldListeners);
|
||||
|
||||
// resolve slots + force update if has children
|
||||
if (hasChildren) {
|
||||
if (needsForceUpdate) {
|
||||
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
||||
vm.$forceUpdate();
|
||||
}
|
||||
@ -3103,10 +3118,32 @@ function resetSchedulerState () {
|
||||
waiting = flushing = false;
|
||||
}
|
||||
|
||||
// Async edge case #6566 requires saving the timestamp when event listeners are
|
||||
// attached. However, calling performance.now() has a perf overhead especially
|
||||
// if the page has thousands of event listeners. Instead, we take a timestamp
|
||||
// every time the scheduler flushes and use that for all event listeners
|
||||
// attached during that flush.
|
||||
var currentFlushTimestamp = 0;
|
||||
|
||||
// Async edge case fix requires storing an event listener's attach timestamp.
|
||||
var getNow = Date.now;
|
||||
|
||||
// Determine what event timestamp the browser is using. Annoyingly, the
|
||||
// timestamp can either be hi-res ( relative to poge load) or low-res
|
||||
// (relative to UNIX epoch), so in order to compare time we have to use the
|
||||
// same timestamp type when saving the flush timestamp.
|
||||
if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
|
||||
// if the low-res timestamp which is bigger than the event timestamp
|
||||
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,
|
||||
// and we need to use the hi-res version for event listeners as well.
|
||||
getNow = function () { return performance.now(); };
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush both queues and run the watchers.
|
||||
*/
|
||||
function flushSchedulerQueue () {
|
||||
currentFlushTimestamp = getNow();
|
||||
flushing = true;
|
||||
var watcher, id;
|
||||
|
||||
@ -3863,7 +3900,7 @@ function normalizeScopedSlots (
|
||||
} else {
|
||||
res = {};
|
||||
for (var key in slots) {
|
||||
if (slots[key]) {
|
||||
if (slots[key] && key[0] !== '$') {
|
||||
res[key] = normalizeScopedSlot(slots[key]);
|
||||
}
|
||||
}
|
||||
@ -3875,6 +3912,7 @@ function normalizeScopedSlots (
|
||||
}
|
||||
}
|
||||
res._normalized = true;
|
||||
res.$stable = slots && slots.$stable;
|
||||
return res
|
||||
}
|
||||
|
||||
@ -4153,6 +4191,31 @@ function bindObjectListeners (data, value) {
|
||||
|
||||
/* */
|
||||
|
||||
function bindDynamicKeys (baseObj, values) {
|
||||
for (var i = 0; i < values.length; i += 2) {
|
||||
var key = values[i];
|
||||
if (typeof key === 'string' && key) {
|
||||
baseObj[values[i]] = values[i + 1];
|
||||
} else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
|
||||
// null is a speical value for explicitly removing a binding
|
||||
warn(
|
||||
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
||||
this
|
||||
);
|
||||
}
|
||||
}
|
||||
return baseObj
|
||||
}
|
||||
|
||||
// helper to dynamically append modifier runtime markers to event names.
|
||||
// ensure only append when value is already string, otherwise it will be cast
|
||||
// to string and cause the type check to miss.
|
||||
function prependModifier (value, symbol) {
|
||||
return typeof value === 'string' ? symbol + value : value
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
function installRenderHelpers (target) {
|
||||
target._o = markOnce;
|
||||
target._n = toNumber;
|
||||
@ -4169,6 +4232,8 @@ function installRenderHelpers (target) {
|
||||
target._e = createEmptyVNode;
|
||||
target._u = resolveScopedSlots;
|
||||
target._g = bindObjectListeners;
|
||||
target._d = bindDynamicKeys;
|
||||
target._p = prependModifier;
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -5274,7 +5339,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
||||
value: FunctionalRenderContext
|
||||
});
|
||||
|
||||
Vue.version = '2.6.0-beta.1';
|
||||
Vue.version = '2.6.0-beta.2';
|
||||
|
||||
/* */
|
||||
|
||||
@ -6420,6 +6485,7 @@ function _update (oldVnode, vnode) {
|
||||
} else {
|
||||
// existing directive, update
|
||||
dir.oldValue = oldDir.value;
|
||||
dir.oldArg = oldDir.arg;
|
||||
callHook$1(dir, 'update', vnode, oldVnode);
|
||||
if (dir.def && dir.def.componentUpdated) {
|
||||
dirsWithPostpatch.push(dir);
|
||||
@ -6760,13 +6826,16 @@ function pluckModuleFunction (
|
||||
: []
|
||||
}
|
||||
|
||||
function addProp (el, name, value, range) {
|
||||
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value }, range));
|
||||
function addProp (el, name, value, range, dynamic) {
|
||||
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
function addAttr (el, name, value, range) {
|
||||
(el.attrs || (el.attrs = [])).push(rangeSetItem({ name: name, value: value }, range));
|
||||
function addAttr (el, name, value, range, dynamic) {
|
||||
var attrs = dynamic
|
||||
? (el.dynamicAttrs || (el.dynamicAttrs = []))
|
||||
: (el.attrs || (el.attrs = []));
|
||||
attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
@ -6782,13 +6851,27 @@ function addDirective (
|
||||
rawName,
|
||||
value,
|
||||
arg,
|
||||
isDynamicArg,
|
||||
modifiers,
|
||||
range
|
||||
) {
|
||||
(el.directives || (el.directives = [])).push(rangeSetItem({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers }, range));
|
||||
(el.directives || (el.directives = [])).push(rangeSetItem({
|
||||
name: name,
|
||||
rawName: rawName,
|
||||
value: value,
|
||||
arg: arg,
|
||||
isDynamicArg: isDynamicArg,
|
||||
modifiers: modifiers
|
||||
}, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
function prependModifierMarker (symbol, name, dynamic) {
|
||||
return dynamic
|
||||
? ("_p(" + name + ",\"" + symbol + "\")")
|
||||
: symbol + name // mark the event as captured
|
||||
}
|
||||
|
||||
function addHandler (
|
||||
el,
|
||||
name,
|
||||
@ -6796,7 +6879,8 @@ function addHandler (
|
||||
modifiers,
|
||||
important,
|
||||
warn,
|
||||
range
|
||||
range,
|
||||
dynamic
|
||||
) {
|
||||
modifiers = modifiers || emptyObject;
|
||||
// warn prevent and passive modifier
|
||||
@ -6815,11 +6899,17 @@ function addHandler (
|
||||
// normalize click.right and click.middle since they don't actually fire
|
||||
// this is technically browser-specific, but at least for now browsers are
|
||||
// the only target envs that have right/middle clicks.
|
||||
if (name === 'click') {
|
||||
if (modifiers.right) {
|
||||
if (modifiers.right) {
|
||||
if (dynamic) {
|
||||
name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
|
||||
} else if (name === 'click') {
|
||||
name = 'contextmenu';
|
||||
delete modifiers.right;
|
||||
} else if (modifiers.middle) {
|
||||
}
|
||||
} else if (modifiers.middle) {
|
||||
if (dynamic) {
|
||||
name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
|
||||
} else if (name === 'click') {
|
||||
name = 'mouseup';
|
||||
}
|
||||
}
|
||||
@ -6827,16 +6917,16 @@ function addHandler (
|
||||
// check capture modifier
|
||||
if (modifiers.capture) {
|
||||
delete modifiers.capture;
|
||||
name = '!' + name; // mark the event as captured
|
||||
name = prependModifierMarker('!', name, dynamic);
|
||||
}
|
||||
if (modifiers.once) {
|
||||
delete modifiers.once;
|
||||
name = '~' + name; // mark the event as once
|
||||
name = prependModifierMarker('~', name, dynamic);
|
||||
}
|
||||
/* istanbul ignore if */
|
||||
if (modifiers.passive) {
|
||||
delete modifiers.passive;
|
||||
name = '&' + name; // mark the event as passive
|
||||
name = prependModifierMarker('&', name, dynamic);
|
||||
}
|
||||
|
||||
var events;
|
||||
@ -6847,7 +6937,7 @@ function addHandler (
|
||||
events = el.events || (el.events = {});
|
||||
}
|
||||
|
||||
var newHandler = rangeSetItem({ value: value.trim() }, range);
|
||||
var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
||||
if (modifiers !== emptyObject) {
|
||||
newHandler.modifiers = modifiers;
|
||||
}
|
||||
@ -7310,17 +7400,17 @@ function add$1 (
|
||||
capture,
|
||||
passive
|
||||
) {
|
||||
if (isChrome) {
|
||||
// async edge case #6566: inner click event triggers patch, event handler
|
||||
// attached to outer element during patch, and triggered again. This only
|
||||
// happens in Chrome as it fires microtask ticks between event propagation.
|
||||
// the solution is simple: we save the timestamp when a handler is attached,
|
||||
// and the handler would only fire if the event passed to it was fired
|
||||
// AFTER it was attached.
|
||||
var now = performance.now();
|
||||
// async edge case #6566: inner click event triggers patch, event handler
|
||||
// attached to outer element during patch, and triggered again. This
|
||||
// happens because browsers fire microtask ticks between event propagation.
|
||||
// the solution is simple: we save the timestamp when a handler is attached,
|
||||
// and the handler would only fire if the event passed to it was fired
|
||||
// AFTER it was attached.
|
||||
if (isUsingMicroTask) {
|
||||
var attachedTimestamp = currentFlushTimestamp;
|
||||
var original = handler;
|
||||
handler = original._wrapper = function (e) {
|
||||
if (e.timeStamp >= now) {
|
||||
if (e.timeStamp >= attachedTimestamp) {
|
||||
return original.apply(this, arguments)
|
||||
}
|
||||
};
|
||||
@ -7401,14 +7491,11 @@ function updateDOMProps (oldVnode, vnode) {
|
||||
}
|
||||
}
|
||||
|
||||
// #4521: if a click event triggers update before the change event is
|
||||
// dispatched on a checkbox/radio input, the input's checked state will
|
||||
// be reset and fail to trigger another update.
|
||||
// The root cause here is that browsers may fire microtasks in between click/change.
|
||||
// In Chrome / Firefox, click event fires before change, thus having this problem.
|
||||
// In Safari / Edge, the order is opposite.
|
||||
// Note: in Edge, if you click too fast, only the click event would fire twice.
|
||||
if (key === 'checked' && !isNotInFocusAndDirty(elm, cur)) {
|
||||
// skip the update if old and new VDOM state is the same.
|
||||
// the only exception is `value` where the DOM value may be temporarily
|
||||
// out of sync with VDOM state due to focus, composition and modifiers.
|
||||
// This also covers #4521 by skipping the unnecesarry `checked` update.
|
||||
if (key !== 'value' && cur === oldProps[key]) {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -9325,13 +9412,14 @@ var dirRE = /^v-|^@|^:|^\./;
|
||||
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
||||
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
||||
var stripParensRE = /^\(|\)$/g;
|
||||
var dynamicArgRE = /^\[.*\]$/;
|
||||
|
||||
var argRE = /:(.*)$/;
|
||||
var bindRE = /^:|^\.|^v-bind:/;
|
||||
var propBindRE = /^\./;
|
||||
var modifierRE = /\.[^.]+/g;
|
||||
|
||||
var scopedSlotShorthandRE = /^:?\(.*\)$/;
|
||||
var slotRE = /^v-slot(:|$)|^#/;
|
||||
|
||||
var lineBreakRE = /[\r\n]/;
|
||||
var whitespaceRE$1 = /\s+/g;
|
||||
@ -9860,27 +9948,7 @@ function processSlotContent (el) {
|
||||
true
|
||||
);
|
||||
}
|
||||
el.slotScope = (
|
||||
slotScope ||
|
||||
getAndRemoveAttr(el, 'slot-scope')
|
||||
);
|
||||
if (process.env.NEW_SLOT_SYNTAX) {
|
||||
// new in 2.6: slot-props and its shorthand works the same as slot-scope
|
||||
// when used on <template> containers
|
||||
el.slotScope = el.slotScope || getAndRemoveAttr(el, 'slot-props');
|
||||
// 2.6 shorthand syntax
|
||||
var shorthand = getAndRemoveAttrByRegex(el, scopedSlotShorthandRE);
|
||||
if (shorthand) {
|
||||
if (process.env.NODE_ENV !== 'production' && el.slotScope) {
|
||||
warn$2(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
el.slotTarget = getScopedSlotShorthandName(shorthand);
|
||||
el.slotScope = shorthand.value;
|
||||
}
|
||||
}
|
||||
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
||||
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
||||
/* istanbul ignore if */
|
||||
if (process.env.NODE_ENV !== 'production' && el.attrsMap['v-for']) {
|
||||
@ -9893,58 +9961,101 @@ function processSlotContent (el) {
|
||||
);
|
||||
}
|
||||
el.slotScope = slotScope;
|
||||
} else if (process.env.NEW_SLOT_SYNTAX) {
|
||||
// 2.6: slot-props on component, denotes default slot
|
||||
slotScope = getAndRemoveAttr(el, 'slot-props');
|
||||
var shorthand$1 = getAndRemoveAttrByRegex(el, scopedSlotShorthandRE);
|
||||
if (slotScope || shorthand$1) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!maybeComponent(el)) {
|
||||
warn$2(
|
||||
"slot-props cannot be used on non-component elements.",
|
||||
el.rawAttrsMap['slot-props'] || el.rawAttrsMap['()']
|
||||
);
|
||||
}
|
||||
if (slotScope && shorthand$1) {
|
||||
warn$2(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
}
|
||||
// add the component's children to its default slot
|
||||
var slots = el.scopedSlots || (el.scopedSlots = {});
|
||||
var target = shorthand$1 ? getScopedSlotShorthandName(shorthand$1) : "\"default\"";
|
||||
var slotContainer = slots[target] = createASTElement('template', [], el);
|
||||
slotContainer.children = el.children;
|
||||
slotContainer.slotScope = shorthand$1 ? shorthand$1.value : slotScope;
|
||||
// remove children as they are returned from scopedSlots now
|
||||
el.children = [];
|
||||
// mark el non-plain so data gets generated
|
||||
el.plain = false;
|
||||
}
|
||||
}
|
||||
|
||||
// slot="xxx"
|
||||
var slotTarget = getBindingAttr(el, 'slot');
|
||||
if (slotTarget) {
|
||||
el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
||||
el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
||||
// preserve slot as an attribute for native shadow DOM compat
|
||||
// only for non-scoped slots.
|
||||
if (el.tag !== 'template' && !el.slotScope) {
|
||||
addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
||||
}
|
||||
}
|
||||
|
||||
// 2.6 v-slot syntax
|
||||
if (process.env.NEW_SLOT_SYNTAX) {
|
||||
if (el.tag === 'template') {
|
||||
// v-slot on <template>
|
||||
var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
||||
if (slotBinding) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (el.slotTarget || el.slotScope) {
|
||||
warn$2(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
}
|
||||
var ref = getSlotName(slotBinding);
|
||||
var name = ref.name;
|
||||
var dynamic = ref.dynamic;
|
||||
el.slotTarget = name;
|
||||
el.slotTargetDynamic = dynamic;
|
||||
el.slotScope = slotBinding.value || "_"; // force it into a scoped slot for perf
|
||||
}
|
||||
} else {
|
||||
// v-slot on component, denotes default slot
|
||||
var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
|
||||
if (slotBinding$1) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!maybeComponent(el)) {
|
||||
warn$2(
|
||||
"v-slot can only be used on components or <template>.",
|
||||
slotBinding$1
|
||||
);
|
||||
}
|
||||
if (el.slotScope || el.slotTarget) {
|
||||
warn$2(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
if (el.scopedSlots) {
|
||||
warn$2(
|
||||
"To avoid scope ambiguity, the default slot should also use " +
|
||||
"<template> syntax when there are other named slots.",
|
||||
slotBinding$1
|
||||
);
|
||||
}
|
||||
}
|
||||
// add the component's children to its default slot
|
||||
var slots = el.scopedSlots || (el.scopedSlots = {});
|
||||
var ref$1 = getSlotName(slotBinding$1);
|
||||
var name$1 = ref$1.name;
|
||||
var dynamic$1 = ref$1.dynamic;
|
||||
var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
||||
slotContainer.slotTargetDynamic = dynamic$1;
|
||||
slotContainer.children = el.children;
|
||||
slotContainer.slotScope = slotBinding$1.value || "_";
|
||||
// remove children as they are returned from scopedSlots now
|
||||
el.children = [];
|
||||
// mark el non-plain so data gets generated
|
||||
el.plain = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getScopedSlotShorthandName (ref) {
|
||||
var name = ref.name;
|
||||
|
||||
return name.charAt(0) === ':'
|
||||
// dynamic :(name)
|
||||
? name.slice(2, -1) || "\"default\""
|
||||
// static (name)
|
||||
: ("\"" + (name.slice(1, -1) || "default") + "\"")
|
||||
function getSlotName (binding) {
|
||||
var name = binding.name.replace(slotRE, '');
|
||||
if (!name) {
|
||||
if (binding.name[0] !== '#') {
|
||||
name = 'default';
|
||||
} else if (process.env.NODE_ENV !== 'production') {
|
||||
warn$2(
|
||||
"v-slot shorthand syntax requires a slot name.",
|
||||
binding
|
||||
);
|
||||
}
|
||||
}
|
||||
return dynamicArgRE.test(name)
|
||||
// dynamic [name]
|
||||
? { name: name.slice(1, -1), dynamic: true }
|
||||
// static name
|
||||
: { name: ("\"" + name + "\""), dynamic: false }
|
||||
}
|
||||
|
||||
// handle <slot/> outlets
|
||||
@ -9974,7 +10085,7 @@ function processComponent (el) {
|
||||
|
||||
function processAttrs (el) {
|
||||
var list = el.attrsList;
|
||||
var i, l, name, rawName, value, modifiers, isProp, syncGen;
|
||||
var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
||||
for (i = 0, l = list.length; i < l; i++) {
|
||||
name = rawName = list[i].name;
|
||||
value = list[i].value;
|
||||
@ -9993,7 +10104,10 @@ function processAttrs (el) {
|
||||
if (bindRE.test(name)) { // v-bind
|
||||
name = name.replace(bindRE, '');
|
||||
value = parseFilters(value);
|
||||
isProp = false;
|
||||
isDynamic = dynamicArgRE.test(name);
|
||||
if (isDynamic) {
|
||||
name = name.slice(1, -1);
|
||||
}
|
||||
if (
|
||||
process.env.NODE_ENV !== 'production' &&
|
||||
value.trim().length === 0
|
||||
@ -10003,57 +10117,79 @@ function processAttrs (el) {
|
||||
);
|
||||
}
|
||||
if (modifiers) {
|
||||
if (modifiers.prop) {
|
||||
isProp = true;
|
||||
if (modifiers.prop && !isDynamic) {
|
||||
name = camelize(name);
|
||||
if (name === 'innerHtml') { name = 'innerHTML'; }
|
||||
}
|
||||
if (modifiers.camel) {
|
||||
if (modifiers.camel && !isDynamic) {
|
||||
name = camelize(name);
|
||||
}
|
||||
if (modifiers.sync) {
|
||||
syncGen = genAssignmentCode(value, "$event");
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (camelize(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$2,
|
||||
list[i]
|
||||
);
|
||||
if (hyphenate(name) !== camelize(name)) {
|
||||
if (!isDynamic) {
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (hyphenate(name))),
|
||||
("update:" + (camelize(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$2,
|
||||
list[i]
|
||||
);
|
||||
if (hyphenate(name) !== camelize(name)) {
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (hyphenate(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$2,
|
||||
list[i]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// handler w/ dynamic event name
|
||||
addHandler(
|
||||
el,
|
||||
("\"update:\"+(" + name + ")"),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$2,
|
||||
list[i],
|
||||
true // dynamic
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isProp || (
|
||||
if ((modifiers && modifiers.prop) || (
|
||||
!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
|
||||
)) {
|
||||
addProp(el, name, value, list[i]);
|
||||
addProp(el, name, value, list[i], isDynamic);
|
||||
} else {
|
||||
addAttr(el, name, value, list[i]);
|
||||
addAttr(el, name, value, list[i], isDynamic);
|
||||
}
|
||||
} else if (onRE.test(name)) { // v-on
|
||||
name = name.replace(onRE, '');
|
||||
addHandler(el, name, value, modifiers, false, warn$2, list[i]);
|
||||
isDynamic = dynamicArgRE.test(name);
|
||||
if (isDynamic) {
|
||||
name = name.slice(1, -1);
|
||||
}
|
||||
addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
|
||||
} else { // normal directives
|
||||
name = name.replace(dirRE, '');
|
||||
// parse arg
|
||||
var argMatch = name.match(argRE);
|
||||
var arg = argMatch && argMatch[1];
|
||||
isDynamic = false;
|
||||
if (arg) {
|
||||
name = name.slice(0, -(arg.length + 1));
|
||||
if (dynamicArgRE.test(arg)) {
|
||||
arg = arg.slice(1, -1);
|
||||
isDynamic = true;
|
||||
}
|
||||
}
|
||||
addDirective(el, name, rawName, value, arg, modifiers, list[i]);
|
||||
addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
||||
if (process.env.NODE_ENV !== 'production' && name === 'model') {
|
||||
checkForAliasModel(el, value);
|
||||
}
|
||||
@ -10466,23 +10602,32 @@ function genHandlers (
|
||||
events,
|
||||
isNative
|
||||
) {
|
||||
var res = isNative ? 'nativeOn:{' : 'on:{';
|
||||
var prefix = isNative ? 'nativeOn:' : 'on:';
|
||||
var staticHandlers = "";
|
||||
var dynamicHandlers = "";
|
||||
for (var name in events) {
|
||||
res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
|
||||
var handlerCode = genHandler(events[name]);
|
||||
if (events[name] && events[name].dynamic) {
|
||||
dynamicHandlers += name + "," + handlerCode + ",";
|
||||
} else {
|
||||
staticHandlers += "\"" + name + "\":" + handlerCode + ",";
|
||||
}
|
||||
}
|
||||
staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
|
||||
if (dynamicHandlers) {
|
||||
return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
|
||||
} else {
|
||||
return prefix + staticHandlers
|
||||
}
|
||||
return res.slice(0, -1) + '}'
|
||||
}
|
||||
|
||||
function genHandler (
|
||||
name,
|
||||
handler
|
||||
) {
|
||||
function genHandler (handler) {
|
||||
if (!handler) {
|
||||
return 'function(){}'
|
||||
}
|
||||
|
||||
if (Array.isArray(handler)) {
|
||||
return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
|
||||
return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
|
||||
}
|
||||
|
||||
var isMethodPath = simplePathRE.test(handler.value);
|
||||
@ -10536,7 +10681,7 @@ function genHandler (
|
||||
}
|
||||
|
||||
function genKeyFilter (keys) {
|
||||
return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
||||
return ("if(('keyCode' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
||||
}
|
||||
|
||||
function genFilterCode (key) {
|
||||
@ -10799,11 +10944,11 @@ function genData$2 (el, state) {
|
||||
}
|
||||
// attributes
|
||||
if (el.attrs) {
|
||||
data += "attrs:{" + (genProps(el.attrs)) + "},";
|
||||
data += "attrs:" + (genProps(el.attrs)) + ",";
|
||||
}
|
||||
// DOM props
|
||||
if (el.props) {
|
||||
data += "domProps:{" + (genProps(el.props)) + "},";
|
||||
data += "domProps:" + (genProps(el.props)) + ",";
|
||||
}
|
||||
// event handlers
|
||||
if (el.events) {
|
||||
@ -10833,6 +10978,12 @@ function genData$2 (el, state) {
|
||||
}
|
||||
}
|
||||
data = data.replace(/,$/, '') + '}';
|
||||
// v-bind dynamic argument wrap
|
||||
// v-bind with dynamic arguments must be applied using the same v-bind object
|
||||
// merge helper so that class/style/mustUseProp attrs are handled correctly.
|
||||
if (el.dynamicAttrs) {
|
||||
data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
|
||||
}
|
||||
// v-bind data wrap
|
||||
if (el.wrapData) {
|
||||
data = el.wrapData(data);
|
||||
@ -10861,7 +11012,7 @@ function genDirectives (el, state) {
|
||||
}
|
||||
if (needRuntime) {
|
||||
hasRuntime = true;
|
||||
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
||||
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
||||
}
|
||||
}
|
||||
if (hasRuntime) {
|
||||
@ -10889,9 +11040,10 @@ function genScopedSlots (
|
||||
slots,
|
||||
state
|
||||
) {
|
||||
var hasDynamicKeys = Object.keys(slots).some(function (key) { return slots[key].slotTargetDynamic; });
|
||||
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
|
||||
return genScopedSlot(key, slots[key], state)
|
||||
}).join(',')) + "])")
|
||||
}).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
|
||||
}
|
||||
|
||||
function genScopedSlot (
|
||||
@ -11036,15 +11188,23 @@ function genComponent (
|
||||
}
|
||||
|
||||
function genProps (props) {
|
||||
var res = '';
|
||||
var staticProps = "";
|
||||
var dynamicProps = "";
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var prop = props[i];
|
||||
/* istanbul ignore if */
|
||||
{
|
||||
res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
|
||||
var value = transformSpecialNewlines(prop.value);
|
||||
if (prop.dynamic) {
|
||||
dynamicProps += (prop.name) + "," + value + ",";
|
||||
} else {
|
||||
staticProps += "\"" + (prop.name) + "\":" + value + ",";
|
||||
}
|
||||
}
|
||||
return res.slice(0, -1)
|
||||
staticProps = "{" + (staticProps.slice(0, -1)) + "}";
|
||||
if (dynamicProps) {
|
||||
return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
|
||||
} else {
|
||||
return staticProps
|
||||
}
|
||||
}
|
||||
|
||||
// #3895, #4268
|
||||
|
403
dist/vue.js
vendored
403
dist/vue.js
vendored
@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Vue.js v2.6.0-beta.1
|
||||
* Vue.js v2.6.0-beta.2
|
||||
* (c) 2014-2019 Evan You
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
@ -373,7 +373,7 @@
|
||||
'activated',
|
||||
'deactivated',
|
||||
'errorCaptured',
|
||||
'ssrPrefetch'
|
||||
'serverPrefetch'
|
||||
];
|
||||
|
||||
/* */
|
||||
@ -1887,6 +1887,8 @@
|
||||
|
||||
/* */
|
||||
|
||||
var isUsingMicroTask = false;
|
||||
|
||||
var callbacks = [];
|
||||
var pending = false;
|
||||
|
||||
@ -1930,6 +1932,7 @@
|
||||
// "force" the microtask queue to be flushed by adding an empty timer.
|
||||
if (isIOS) { setTimeout(noop); }
|
||||
};
|
||||
isUsingMicroTask = true;
|
||||
} else if (!isIE && typeof MutationObserver !== 'undefined' && (
|
||||
isNative(MutationObserver) ||
|
||||
// PhantomJS and iOS 7.x
|
||||
@ -1948,6 +1951,7 @@
|
||||
counter = (counter + 1) % 2;
|
||||
textNode.data = String(counter);
|
||||
};
|
||||
isUsingMicroTask = true;
|
||||
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
||||
// Fallback to setImmediate.
|
||||
// Techinically it leverages the (macro) task queue,
|
||||
@ -2744,13 +2748,14 @@
|
||||
|
||||
function resolveScopedSlots (
|
||||
fns, // see flow/vnode
|
||||
hasDynamicKeys,
|
||||
res
|
||||
) {
|
||||
res = res || {};
|
||||
res = res || { $stable: !hasDynamicKeys };
|
||||
for (var i = 0; i < fns.length; i++) {
|
||||
var slot = fns[i];
|
||||
if (Array.isArray(slot)) {
|
||||
resolveScopedSlots(slot, res);
|
||||
resolveScopedSlots(slot, hasDynamicKeys, res);
|
||||
} else {
|
||||
res[slot.key] = slot.fn;
|
||||
}
|
||||
@ -2966,12 +2971,22 @@
|
||||
}
|
||||
|
||||
// determine whether component has slot children
|
||||
// we need to do this before overwriting $options._renderChildren
|
||||
var hasChildren = !!(
|
||||
// we need to do this before overwriting $options._renderChildren.
|
||||
|
||||
// check if there are dynamic scopedSlots (hand-written or compiled but with
|
||||
// dynamic slot names). Static scoped slots compiled from template has the
|
||||
// "$stable" marker.
|
||||
var hasDynamicScopedSlot = !!(
|
||||
(parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
|
||||
(vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
|
||||
);
|
||||
// Any static slot children from the parent may have changed during parent's
|
||||
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
||||
// update is necessary to ensure correctness.
|
||||
var needsForceUpdate = !!(
|
||||
renderChildren || // has new static slots
|
||||
vm.$options._renderChildren || // has old static slots
|
||||
parentVnode.data.scopedSlots || // has new scoped slots
|
||||
vm.$scopedSlots !== emptyObject // has old scoped slots
|
||||
hasDynamicScopedSlot
|
||||
);
|
||||
|
||||
vm.$options._parentVnode = parentVnode;
|
||||
@ -3010,7 +3025,7 @@
|
||||
updateComponentListeners(vm, listeners, oldListeners);
|
||||
|
||||
// resolve slots + force update if has children
|
||||
if (hasChildren) {
|
||||
if (needsForceUpdate) {
|
||||
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
||||
vm.$forceUpdate();
|
||||
}
|
||||
@ -3101,10 +3116,32 @@
|
||||
waiting = flushing = false;
|
||||
}
|
||||
|
||||
// Async edge case #6566 requires saving the timestamp when event listeners are
|
||||
// attached. However, calling performance.now() has a perf overhead especially
|
||||
// if the page has thousands of event listeners. Instead, we take a timestamp
|
||||
// every time the scheduler flushes and use that for all event listeners
|
||||
// attached during that flush.
|
||||
var currentFlushTimestamp = 0;
|
||||
|
||||
// Async edge case fix requires storing an event listener's attach timestamp.
|
||||
var getNow = Date.now;
|
||||
|
||||
// Determine what event timestamp the browser is using. Annoyingly, the
|
||||
// timestamp can either be hi-res ( relative to poge load) or low-res
|
||||
// (relative to UNIX epoch), so in order to compare time we have to use the
|
||||
// same timestamp type when saving the flush timestamp.
|
||||
if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
|
||||
// if the low-res timestamp which is bigger than the event timestamp
|
||||
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,
|
||||
// and we need to use the hi-res version for event listeners as well.
|
||||
getNow = function () { return performance.now(); };
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush both queues and run the watchers.
|
||||
*/
|
||||
function flushSchedulerQueue () {
|
||||
currentFlushTimestamp = getNow();
|
||||
flushing = true;
|
||||
var watcher, id;
|
||||
|
||||
@ -3854,7 +3891,7 @@
|
||||
} else {
|
||||
res = {};
|
||||
for (var key in slots) {
|
||||
if (slots[key]) {
|
||||
if (slots[key] && key[0] !== '$') {
|
||||
res[key] = normalizeScopedSlot(slots[key]);
|
||||
}
|
||||
}
|
||||
@ -3866,6 +3903,7 @@
|
||||
}
|
||||
}
|
||||
res._normalized = true;
|
||||
res.$stable = slots && slots.$stable;
|
||||
return res
|
||||
}
|
||||
|
||||
@ -4144,6 +4182,31 @@
|
||||
|
||||
/* */
|
||||
|
||||
function bindDynamicKeys (baseObj, values) {
|
||||
for (var i = 0; i < values.length; i += 2) {
|
||||
var key = values[i];
|
||||
if (typeof key === 'string' && key) {
|
||||
baseObj[values[i]] = values[i + 1];
|
||||
} else if (key !== '' && key !== null) {
|
||||
// null is a speical value for explicitly removing a binding
|
||||
warn(
|
||||
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
||||
this
|
||||
);
|
||||
}
|
||||
}
|
||||
return baseObj
|
||||
}
|
||||
|
||||
// helper to dynamically append modifier runtime markers to event names.
|
||||
// ensure only append when value is already string, otherwise it will be cast
|
||||
// to string and cause the type check to miss.
|
||||
function prependModifier (value, symbol) {
|
||||
return typeof value === 'string' ? symbol + value : value
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
function installRenderHelpers (target) {
|
||||
target._o = markOnce;
|
||||
target._n = toNumber;
|
||||
@ -4160,6 +4223,8 @@
|
||||
target._e = createEmptyVNode;
|
||||
target._u = resolveScopedSlots;
|
||||
target._g = bindObjectListeners;
|
||||
target._d = bindDynamicKeys;
|
||||
target._p = prependModifier;
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -5258,7 +5323,7 @@
|
||||
value: FunctionalRenderContext
|
||||
});
|
||||
|
||||
Vue.version = '2.6.0-beta.1';
|
||||
Vue.version = '2.6.0-beta.2';
|
||||
|
||||
/* */
|
||||
|
||||
@ -6402,6 +6467,7 @@
|
||||
} else {
|
||||
// existing directive, update
|
||||
dir.oldValue = oldDir.value;
|
||||
dir.oldArg = oldDir.arg;
|
||||
callHook$1(dir, 'update', vnode, oldVnode);
|
||||
if (dir.def && dir.def.componentUpdated) {
|
||||
dirsWithPostpatch.push(dir);
|
||||
@ -6742,13 +6808,16 @@
|
||||
: []
|
||||
}
|
||||
|
||||
function addProp (el, name, value, range) {
|
||||
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value }, range));
|
||||
function addProp (el, name, value, range, dynamic) {
|
||||
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
function addAttr (el, name, value, range) {
|
||||
(el.attrs || (el.attrs = [])).push(rangeSetItem({ name: name, value: value }, range));
|
||||
function addAttr (el, name, value, range, dynamic) {
|
||||
var attrs = dynamic
|
||||
? (el.dynamicAttrs || (el.dynamicAttrs = []))
|
||||
: (el.attrs || (el.attrs = []));
|
||||
attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
@ -6764,13 +6833,27 @@
|
||||
rawName,
|
||||
value,
|
||||
arg,
|
||||
isDynamicArg,
|
||||
modifiers,
|
||||
range
|
||||
) {
|
||||
(el.directives || (el.directives = [])).push(rangeSetItem({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers }, range));
|
||||
(el.directives || (el.directives = [])).push(rangeSetItem({
|
||||
name: name,
|
||||
rawName: rawName,
|
||||
value: value,
|
||||
arg: arg,
|
||||
isDynamicArg: isDynamicArg,
|
||||
modifiers: modifiers
|
||||
}, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
function prependModifierMarker (symbol, name, dynamic) {
|
||||
return dynamic
|
||||
? ("_p(" + name + ",\"" + symbol + "\")")
|
||||
: symbol + name // mark the event as captured
|
||||
}
|
||||
|
||||
function addHandler (
|
||||
el,
|
||||
name,
|
||||
@ -6778,7 +6861,8 @@
|
||||
modifiers,
|
||||
important,
|
||||
warn,
|
||||
range
|
||||
range,
|
||||
dynamic
|
||||
) {
|
||||
modifiers = modifiers || emptyObject;
|
||||
// warn prevent and passive modifier
|
||||
@ -6797,11 +6881,17 @@
|
||||
// normalize click.right and click.middle since they don't actually fire
|
||||
// this is technically browser-specific, but at least for now browsers are
|
||||
// the only target envs that have right/middle clicks.
|
||||
if (name === 'click') {
|
||||
if (modifiers.right) {
|
||||
if (modifiers.right) {
|
||||
if (dynamic) {
|
||||
name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
|
||||
} else if (name === 'click') {
|
||||
name = 'contextmenu';
|
||||
delete modifiers.right;
|
||||
} else if (modifiers.middle) {
|
||||
}
|
||||
} else if (modifiers.middle) {
|
||||
if (dynamic) {
|
||||
name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
|
||||
} else if (name === 'click') {
|
||||
name = 'mouseup';
|
||||
}
|
||||
}
|
||||
@ -6809,16 +6899,16 @@
|
||||
// check capture modifier
|
||||
if (modifiers.capture) {
|
||||
delete modifiers.capture;
|
||||
name = '!' + name; // mark the event as captured
|
||||
name = prependModifierMarker('!', name, dynamic);
|
||||
}
|
||||
if (modifiers.once) {
|
||||
delete modifiers.once;
|
||||
name = '~' + name; // mark the event as once
|
||||
name = prependModifierMarker('~', name, dynamic);
|
||||
}
|
||||
/* istanbul ignore if */
|
||||
if (modifiers.passive) {
|
||||
delete modifiers.passive;
|
||||
name = '&' + name; // mark the event as passive
|
||||
name = prependModifierMarker('&', name, dynamic);
|
||||
}
|
||||
|
||||
var events;
|
||||
@ -6829,7 +6919,7 @@
|
||||
events = el.events || (el.events = {});
|
||||
}
|
||||
|
||||
var newHandler = rangeSetItem({ value: value.trim() }, range);
|
||||
var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
||||
if (modifiers !== emptyObject) {
|
||||
newHandler.modifiers = modifiers;
|
||||
}
|
||||
@ -6899,6 +6989,20 @@
|
||||
return val
|
||||
}
|
||||
|
||||
function getAndRemoveAttrByRegex (
|
||||
el,
|
||||
name
|
||||
) {
|
||||
var list = el.attrsList;
|
||||
for (var i = 0, l = list.length; i < l; i++) {
|
||||
var attr = list[i];
|
||||
if (name.test(attr.name)) {
|
||||
list.splice(i, 1);
|
||||
return attr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function rangeSetItem (
|
||||
item,
|
||||
range
|
||||
@ -7278,17 +7382,17 @@
|
||||
capture,
|
||||
passive
|
||||
) {
|
||||
if (isChrome) {
|
||||
// async edge case #6566: inner click event triggers patch, event handler
|
||||
// attached to outer element during patch, and triggered again. This only
|
||||
// happens in Chrome as it fires microtask ticks between event propagation.
|
||||
// the solution is simple: we save the timestamp when a handler is attached,
|
||||
// and the handler would only fire if the event passed to it was fired
|
||||
// AFTER it was attached.
|
||||
var now = performance.now();
|
||||
// async edge case #6566: inner click event triggers patch, event handler
|
||||
// attached to outer element during patch, and triggered again. This
|
||||
// happens because browsers fire microtask ticks between event propagation.
|
||||
// the solution is simple: we save the timestamp when a handler is attached,
|
||||
// and the handler would only fire if the event passed to it was fired
|
||||
// AFTER it was attached.
|
||||
if (isUsingMicroTask) {
|
||||
var attachedTimestamp = currentFlushTimestamp;
|
||||
var original = handler;
|
||||
handler = original._wrapper = function (e) {
|
||||
if (e.timeStamp >= now) {
|
||||
if (e.timeStamp >= attachedTimestamp) {
|
||||
return original.apply(this, arguments)
|
||||
}
|
||||
};
|
||||
@ -7369,14 +7473,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
// #4521: if a click event triggers update before the change event is
|
||||
// dispatched on a checkbox/radio input, the input's checked state will
|
||||
// be reset and fail to trigger another update.
|
||||
// The root cause here is that browsers may fire microtasks in between click/change.
|
||||
// In Chrome / Firefox, click event fires before change, thus having this problem.
|
||||
// In Safari / Edge, the order is opposite.
|
||||
// Note: in Edge, if you click too fast, only the click event would fire twice.
|
||||
if (key === 'checked' && !isNotInFocusAndDirty(elm, cur)) {
|
||||
// skip the update if old and new VDOM state is the same.
|
||||
// the only exception is `value` where the DOM value may be temporarily
|
||||
// out of sync with VDOM state due to focus, composition and modifiers.
|
||||
// This also covers #4521 by skipping the unnecesarry `checked` update.
|
||||
if (key !== 'value' && cur === oldProps[key]) {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -9286,12 +9387,15 @@
|
||||
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
||||
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
||||
var stripParensRE = /^\(|\)$/g;
|
||||
var dynamicArgRE = /^\[.*\]$/;
|
||||
|
||||
var argRE = /:(.*)$/;
|
||||
var bindRE = /^:|^\.|^v-bind:/;
|
||||
var propBindRE = /^\./;
|
||||
var modifierRE = /\.[^.]+/g;
|
||||
|
||||
var slotRE = /^v-slot(:|$)|^#/;
|
||||
|
||||
var lineBreakRE = /[\r\n]/;
|
||||
var whitespaceRE$1 = /\s+/g;
|
||||
|
||||
@ -9306,6 +9410,7 @@
|
||||
var platformIsPreTag;
|
||||
var platformMustUseProp;
|
||||
var platformGetTagNamespace;
|
||||
var maybeComponent;
|
||||
|
||||
function createASTElement (
|
||||
tag,
|
||||
@ -9336,6 +9441,7 @@
|
||||
platformMustUseProp = options.mustUseProp || no;
|
||||
platformGetTagNamespace = options.getTagNamespace || no;
|
||||
var isReservedTag = options.isReservedTag || no;
|
||||
maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
||||
|
||||
transforms = pluckModuleFunction(options.modules, 'transformNode');
|
||||
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
||||
@ -9817,10 +9923,7 @@
|
||||
true
|
||||
);
|
||||
}
|
||||
el.slotScope = (
|
||||
slotScope ||
|
||||
getAndRemoveAttr(el, 'slot-scope')
|
||||
);
|
||||
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
||||
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
||||
/* istanbul ignore if */
|
||||
if (el.attrsMap['v-for']) {
|
||||
@ -9839,12 +9942,95 @@
|
||||
var slotTarget = getBindingAttr(el, 'slot');
|
||||
if (slotTarget) {
|
||||
el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
||||
el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
||||
// preserve slot as an attribute for native shadow DOM compat
|
||||
// only for non-scoped slots.
|
||||
if (el.tag !== 'template' && !el.slotScope) {
|
||||
addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
||||
}
|
||||
}
|
||||
|
||||
// 2.6 v-slot syntax
|
||||
{
|
||||
if (el.tag === 'template') {
|
||||
// v-slot on <template>
|
||||
var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
||||
if (slotBinding) {
|
||||
{
|
||||
if (el.slotTarget || el.slotScope) {
|
||||
warn$2(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
}
|
||||
var ref = getSlotName(slotBinding);
|
||||
var name = ref.name;
|
||||
var dynamic = ref.dynamic;
|
||||
el.slotTarget = name;
|
||||
el.slotTargetDynamic = dynamic;
|
||||
el.slotScope = slotBinding.value || "_"; // force it into a scoped slot for perf
|
||||
}
|
||||
} else {
|
||||
// v-slot on component, denotes default slot
|
||||
var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
|
||||
if (slotBinding$1) {
|
||||
{
|
||||
if (!maybeComponent(el)) {
|
||||
warn$2(
|
||||
"v-slot can only be used on components or <template>.",
|
||||
slotBinding$1
|
||||
);
|
||||
}
|
||||
if (el.slotScope || el.slotTarget) {
|
||||
warn$2(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
if (el.scopedSlots) {
|
||||
warn$2(
|
||||
"To avoid scope ambiguity, the default slot should also use " +
|
||||
"<template> syntax when there are other named slots.",
|
||||
slotBinding$1
|
||||
);
|
||||
}
|
||||
}
|
||||
// add the component's children to its default slot
|
||||
var slots = el.scopedSlots || (el.scopedSlots = {});
|
||||
var ref$1 = getSlotName(slotBinding$1);
|
||||
var name$1 = ref$1.name;
|
||||
var dynamic$1 = ref$1.dynamic;
|
||||
var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
||||
slotContainer.slotTargetDynamic = dynamic$1;
|
||||
slotContainer.children = el.children;
|
||||
slotContainer.slotScope = slotBinding$1.value || "_";
|
||||
// remove children as they are returned from scopedSlots now
|
||||
el.children = [];
|
||||
// mark el non-plain so data gets generated
|
||||
el.plain = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSlotName (binding) {
|
||||
var name = binding.name.replace(slotRE, '');
|
||||
if (!name) {
|
||||
if (binding.name[0] !== '#') {
|
||||
name = 'default';
|
||||
} else {
|
||||
warn$2(
|
||||
"v-slot shorthand syntax requires a slot name.",
|
||||
binding
|
||||
);
|
||||
}
|
||||
}
|
||||
return dynamicArgRE.test(name)
|
||||
// dynamic [name]
|
||||
? { name: name.slice(1, -1), dynamic: true }
|
||||
// static name
|
||||
: { name: ("\"" + name + "\""), dynamic: false }
|
||||
}
|
||||
|
||||
// handle <slot/> outlets
|
||||
@ -9874,7 +10060,7 @@
|
||||
|
||||
function processAttrs (el) {
|
||||
var list = el.attrsList;
|
||||
var i, l, name, rawName, value, modifiers, isProp, syncGen;
|
||||
var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
||||
for (i = 0, l = list.length; i < l; i++) {
|
||||
name = rawName = list[i].name;
|
||||
value = list[i].value;
|
||||
@ -9893,7 +10079,10 @@
|
||||
if (bindRE.test(name)) { // v-bind
|
||||
name = name.replace(bindRE, '');
|
||||
value = parseFilters(value);
|
||||
isProp = false;
|
||||
isDynamic = dynamicArgRE.test(name);
|
||||
if (isDynamic) {
|
||||
name = name.slice(1, -1);
|
||||
}
|
||||
if (
|
||||
value.trim().length === 0
|
||||
) {
|
||||
@ -9902,57 +10091,79 @@
|
||||
);
|
||||
}
|
||||
if (modifiers) {
|
||||
if (modifiers.prop) {
|
||||
isProp = true;
|
||||
if (modifiers.prop && !isDynamic) {
|
||||
name = camelize(name);
|
||||
if (name === 'innerHtml') { name = 'innerHTML'; }
|
||||
}
|
||||
if (modifiers.camel) {
|
||||
if (modifiers.camel && !isDynamic) {
|
||||
name = camelize(name);
|
||||
}
|
||||
if (modifiers.sync) {
|
||||
syncGen = genAssignmentCode(value, "$event");
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (camelize(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$2,
|
||||
list[i]
|
||||
);
|
||||
if (hyphenate(name) !== camelize(name)) {
|
||||
if (!isDynamic) {
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (hyphenate(name))),
|
||||
("update:" + (camelize(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$2,
|
||||
list[i]
|
||||
);
|
||||
if (hyphenate(name) !== camelize(name)) {
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (hyphenate(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$2,
|
||||
list[i]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// handler w/ dynamic event name
|
||||
addHandler(
|
||||
el,
|
||||
("\"update:\"+(" + name + ")"),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$2,
|
||||
list[i],
|
||||
true // dynamic
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isProp || (
|
||||
if ((modifiers && modifiers.prop) || (
|
||||
!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
|
||||
)) {
|
||||
addProp(el, name, value, list[i]);
|
||||
addProp(el, name, value, list[i], isDynamic);
|
||||
} else {
|
||||
addAttr(el, name, value, list[i]);
|
||||
addAttr(el, name, value, list[i], isDynamic);
|
||||
}
|
||||
} else if (onRE.test(name)) { // v-on
|
||||
name = name.replace(onRE, '');
|
||||
addHandler(el, name, value, modifiers, false, warn$2, list[i]);
|
||||
isDynamic = dynamicArgRE.test(name);
|
||||
if (isDynamic) {
|
||||
name = name.slice(1, -1);
|
||||
}
|
||||
addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
|
||||
} else { // normal directives
|
||||
name = name.replace(dirRE, '');
|
||||
// parse arg
|
||||
var argMatch = name.match(argRE);
|
||||
var arg = argMatch && argMatch[1];
|
||||
isDynamic = false;
|
||||
if (arg) {
|
||||
name = name.slice(0, -(arg.length + 1));
|
||||
if (dynamicArgRE.test(arg)) {
|
||||
arg = arg.slice(1, -1);
|
||||
isDynamic = true;
|
||||
}
|
||||
}
|
||||
addDirective(el, name, rawName, value, arg, modifiers, list[i]);
|
||||
addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
||||
if (name === 'model') {
|
||||
checkForAliasModel(el, value);
|
||||
}
|
||||
@ -10364,23 +10575,32 @@
|
||||
events,
|
||||
isNative
|
||||
) {
|
||||
var res = isNative ? 'nativeOn:{' : 'on:{';
|
||||
var prefix = isNative ? 'nativeOn:' : 'on:';
|
||||
var staticHandlers = "";
|
||||
var dynamicHandlers = "";
|
||||
for (var name in events) {
|
||||
res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
|
||||
var handlerCode = genHandler(events[name]);
|
||||
if (events[name] && events[name].dynamic) {
|
||||
dynamicHandlers += name + "," + handlerCode + ",";
|
||||
} else {
|
||||
staticHandlers += "\"" + name + "\":" + handlerCode + ",";
|
||||
}
|
||||
}
|
||||
staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
|
||||
if (dynamicHandlers) {
|
||||
return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
|
||||
} else {
|
||||
return prefix + staticHandlers
|
||||
}
|
||||
return res.slice(0, -1) + '}'
|
||||
}
|
||||
|
||||
function genHandler (
|
||||
name,
|
||||
handler
|
||||
) {
|
||||
function genHandler (handler) {
|
||||
if (!handler) {
|
||||
return 'function(){}'
|
||||
}
|
||||
|
||||
if (Array.isArray(handler)) {
|
||||
return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
|
||||
return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
|
||||
}
|
||||
|
||||
var isMethodPath = simplePathRE.test(handler.value);
|
||||
@ -10434,7 +10654,7 @@
|
||||
}
|
||||
|
||||
function genKeyFilter (keys) {
|
||||
return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
||||
return ("if(('keyCode' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
||||
}
|
||||
|
||||
function genFilterCode (key) {
|
||||
@ -10696,11 +10916,11 @@
|
||||
}
|
||||
// attributes
|
||||
if (el.attrs) {
|
||||
data += "attrs:{" + (genProps(el.attrs)) + "},";
|
||||
data += "attrs:" + (genProps(el.attrs)) + ",";
|
||||
}
|
||||
// DOM props
|
||||
if (el.props) {
|
||||
data += "domProps:{" + (genProps(el.props)) + "},";
|
||||
data += "domProps:" + (genProps(el.props)) + ",";
|
||||
}
|
||||
// event handlers
|
||||
if (el.events) {
|
||||
@ -10730,6 +10950,12 @@
|
||||
}
|
||||
}
|
||||
data = data.replace(/,$/, '') + '}';
|
||||
// v-bind dynamic argument wrap
|
||||
// v-bind with dynamic arguments must be applied using the same v-bind object
|
||||
// merge helper so that class/style/mustUseProp attrs are handled correctly.
|
||||
if (el.dynamicAttrs) {
|
||||
data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
|
||||
}
|
||||
// v-bind data wrap
|
||||
if (el.wrapData) {
|
||||
data = el.wrapData(data);
|
||||
@ -10758,7 +10984,7 @@
|
||||
}
|
||||
if (needRuntime) {
|
||||
hasRuntime = true;
|
||||
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
||||
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
||||
}
|
||||
}
|
||||
if (hasRuntime) {
|
||||
@ -10784,9 +11010,10 @@
|
||||
slots,
|
||||
state
|
||||
) {
|
||||
var hasDynamicKeys = Object.keys(slots).some(function (key) { return slots[key].slotTargetDynamic; });
|
||||
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
|
||||
return genScopedSlot(key, slots[key], state)
|
||||
}).join(',')) + "])")
|
||||
}).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
|
||||
}
|
||||
|
||||
function genScopedSlot (
|
||||
@ -10931,15 +11158,23 @@
|
||||
}
|
||||
|
||||
function genProps (props) {
|
||||
var res = '';
|
||||
var staticProps = "";
|
||||
var dynamicProps = "";
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var prop = props[i];
|
||||
/* istanbul ignore if */
|
||||
{
|
||||
res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
|
||||
var value = transformSpecialNewlines(prop.value);
|
||||
if (prop.dynamic) {
|
||||
dynamicProps += (prop.name) + "," + value + ",";
|
||||
} else {
|
||||
staticProps += "\"" + (prop.name) + "\":" + value + ",";
|
||||
}
|
||||
}
|
||||
return res.slice(0, -1)
|
||||
staticProps = "{" + (staticProps.slice(0, -1)) + "}";
|
||||
if (dynamicProps) {
|
||||
return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
|
||||
} else {
|
||||
return staticProps
|
||||
}
|
||||
}
|
||||
|
||||
// #3895, #4268
|
||||
|
4
dist/vue.min.js
vendored
4
dist/vue.min.js
vendored
File diff suppressed because one or more lines are too long
8269
dist/vue.runtime.common.dev.js
vendored
Normal file
8269
dist/vue.runtime.common.dev.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6
dist/vue.runtime.common.prod.js
vendored
Normal file
6
dist/vue.runtime.common.prod.js
vendored
Normal file
File diff suppressed because one or more lines are too long
119
dist/vue.runtime.esm.js
vendored
119
dist/vue.runtime.esm.js
vendored
@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Vue.js v2.6.0-beta.1
|
||||
* Vue.js v2.6.0-beta.2
|
||||
* (c) 2014-2019 Evan You
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
@ -358,7 +358,7 @@ var LIFECYCLE_HOOKS = [
|
||||
'activated',
|
||||
'deactivated',
|
||||
'errorCaptured',
|
||||
'ssrPrefetch'
|
||||
'serverPrefetch'
|
||||
];
|
||||
|
||||
/* */
|
||||
@ -1878,6 +1878,8 @@ function logError (err, vm, info) {
|
||||
|
||||
/* */
|
||||
|
||||
var isUsingMicroTask = false;
|
||||
|
||||
var callbacks = [];
|
||||
var pending = false;
|
||||
|
||||
@ -1921,6 +1923,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
||||
// "force" the microtask queue to be flushed by adding an empty timer.
|
||||
if (isIOS) { setTimeout(noop); }
|
||||
};
|
||||
isUsingMicroTask = true;
|
||||
} else if (!isIE && typeof MutationObserver !== 'undefined' && (
|
||||
isNative(MutationObserver) ||
|
||||
// PhantomJS and iOS 7.x
|
||||
@ -1939,6 +1942,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
||||
counter = (counter + 1) % 2;
|
||||
textNode.data = String(counter);
|
||||
};
|
||||
isUsingMicroTask = true;
|
||||
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
||||
// Fallback to setImmediate.
|
||||
// Techinically it leverages the (macro) task queue,
|
||||
@ -2737,13 +2741,14 @@ function isWhitespace (node) {
|
||||
|
||||
function resolveScopedSlots (
|
||||
fns, // see flow/vnode
|
||||
hasDynamicKeys,
|
||||
res
|
||||
) {
|
||||
res = res || {};
|
||||
res = res || { $stable: !hasDynamicKeys };
|
||||
for (var i = 0; i < fns.length; i++) {
|
||||
var slot = fns[i];
|
||||
if (Array.isArray(slot)) {
|
||||
resolveScopedSlots(slot, res);
|
||||
resolveScopedSlots(slot, hasDynamicKeys, res);
|
||||
} else {
|
||||
res[slot.key] = slot.fn;
|
||||
}
|
||||
@ -2959,12 +2964,22 @@ function updateChildComponent (
|
||||
}
|
||||
|
||||
// determine whether component has slot children
|
||||
// we need to do this before overwriting $options._renderChildren
|
||||
var hasChildren = !!(
|
||||
// we need to do this before overwriting $options._renderChildren.
|
||||
|
||||
// check if there are dynamic scopedSlots (hand-written or compiled but with
|
||||
// dynamic slot names). Static scoped slots compiled from template has the
|
||||
// "$stable" marker.
|
||||
var hasDynamicScopedSlot = !!(
|
||||
(parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
|
||||
(vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
|
||||
);
|
||||
// Any static slot children from the parent may have changed during parent's
|
||||
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
||||
// update is necessary to ensure correctness.
|
||||
var needsForceUpdate = !!(
|
||||
renderChildren || // has new static slots
|
||||
vm.$options._renderChildren || // has old static slots
|
||||
parentVnode.data.scopedSlots || // has new scoped slots
|
||||
vm.$scopedSlots !== emptyObject // has old scoped slots
|
||||
hasDynamicScopedSlot
|
||||
);
|
||||
|
||||
vm.$options._parentVnode = parentVnode;
|
||||
@ -3003,7 +3018,7 @@ function updateChildComponent (
|
||||
updateComponentListeners(vm, listeners, oldListeners);
|
||||
|
||||
// resolve slots + force update if has children
|
||||
if (hasChildren) {
|
||||
if (needsForceUpdate) {
|
||||
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
||||
vm.$forceUpdate();
|
||||
}
|
||||
@ -3094,10 +3109,32 @@ function resetSchedulerState () {
|
||||
waiting = flushing = false;
|
||||
}
|
||||
|
||||
// Async edge case #6566 requires saving the timestamp when event listeners are
|
||||
// attached. However, calling performance.now() has a perf overhead especially
|
||||
// if the page has thousands of event listeners. Instead, we take a timestamp
|
||||
// every time the scheduler flushes and use that for all event listeners
|
||||
// attached during that flush.
|
||||
var currentFlushTimestamp = 0;
|
||||
|
||||
// Async edge case fix requires storing an event listener's attach timestamp.
|
||||
var getNow = Date.now;
|
||||
|
||||
// Determine what event timestamp the browser is using. Annoyingly, the
|
||||
// timestamp can either be hi-res ( relative to poge load) or low-res
|
||||
// (relative to UNIX epoch), so in order to compare time we have to use the
|
||||
// same timestamp type when saving the flush timestamp.
|
||||
if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
|
||||
// if the low-res timestamp which is bigger than the event timestamp
|
||||
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,
|
||||
// and we need to use the hi-res version for event listeners as well.
|
||||
getNow = function () { return performance.now(); };
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush both queues and run the watchers.
|
||||
*/
|
||||
function flushSchedulerQueue () {
|
||||
currentFlushTimestamp = getNow();
|
||||
flushing = true;
|
||||
var watcher, id;
|
||||
|
||||
@ -3854,7 +3891,7 @@ function normalizeScopedSlots (
|
||||
} else {
|
||||
res = {};
|
||||
for (var key in slots) {
|
||||
if (slots[key]) {
|
||||
if (slots[key] && key[0] !== '$') {
|
||||
res[key] = normalizeScopedSlot(slots[key]);
|
||||
}
|
||||
}
|
||||
@ -3866,6 +3903,7 @@ function normalizeScopedSlots (
|
||||
}
|
||||
}
|
||||
res._normalized = true;
|
||||
res.$stable = slots && slots.$stable;
|
||||
return res
|
||||
}
|
||||
|
||||
@ -4144,6 +4182,31 @@ function bindObjectListeners (data, value) {
|
||||
|
||||
/* */
|
||||
|
||||
function bindDynamicKeys (baseObj, values) {
|
||||
for (var i = 0; i < values.length; i += 2) {
|
||||
var key = values[i];
|
||||
if (typeof key === 'string' && key) {
|
||||
baseObj[values[i]] = values[i + 1];
|
||||
} else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
|
||||
// null is a speical value for explicitly removing a binding
|
||||
warn(
|
||||
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
||||
this
|
||||
);
|
||||
}
|
||||
}
|
||||
return baseObj
|
||||
}
|
||||
|
||||
// helper to dynamically append modifier runtime markers to event names.
|
||||
// ensure only append when value is already string, otherwise it will be cast
|
||||
// to string and cause the type check to miss.
|
||||
function prependModifier (value, symbol) {
|
||||
return typeof value === 'string' ? symbol + value : value
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
function installRenderHelpers (target) {
|
||||
target._o = markOnce;
|
||||
target._n = toNumber;
|
||||
@ -4160,6 +4223,8 @@ function installRenderHelpers (target) {
|
||||
target._e = createEmptyVNode;
|
||||
target._u = resolveScopedSlots;
|
||||
target._g = bindObjectListeners;
|
||||
target._d = bindDynamicKeys;
|
||||
target._p = prependModifier;
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -5265,7 +5330,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
||||
value: FunctionalRenderContext
|
||||
});
|
||||
|
||||
Vue.version = '2.6.0-beta.1';
|
||||
Vue.version = '2.6.0-beta.2';
|
||||
|
||||
/* */
|
||||
|
||||
@ -6409,6 +6474,7 @@ function _update (oldVnode, vnode) {
|
||||
} else {
|
||||
// existing directive, update
|
||||
dir.oldValue = oldDir.value;
|
||||
dir.oldArg = oldDir.arg;
|
||||
callHook$1(dir, 'update', vnode, oldVnode);
|
||||
if (dir.def && dir.def.componentUpdated) {
|
||||
dirsWithPostpatch.push(dir);
|
||||
@ -6686,17 +6752,17 @@ function add$1 (
|
||||
capture,
|
||||
passive
|
||||
) {
|
||||
if (isChrome) {
|
||||
// async edge case #6566: inner click event triggers patch, event handler
|
||||
// attached to outer element during patch, and triggered again. This only
|
||||
// happens in Chrome as it fires microtask ticks between event propagation.
|
||||
// the solution is simple: we save the timestamp when a handler is attached,
|
||||
// and the handler would only fire if the event passed to it was fired
|
||||
// AFTER it was attached.
|
||||
var now = performance.now();
|
||||
// async edge case #6566: inner click event triggers patch, event handler
|
||||
// attached to outer element during patch, and triggered again. This
|
||||
// happens because browsers fire microtask ticks between event propagation.
|
||||
// the solution is simple: we save the timestamp when a handler is attached,
|
||||
// and the handler would only fire if the event passed to it was fired
|
||||
// AFTER it was attached.
|
||||
if (isUsingMicroTask) {
|
||||
var attachedTimestamp = currentFlushTimestamp;
|
||||
var original = handler;
|
||||
handler = original._wrapper = function (e) {
|
||||
if (e.timeStamp >= now) {
|
||||
if (e.timeStamp >= attachedTimestamp) {
|
||||
return original.apply(this, arguments)
|
||||
}
|
||||
};
|
||||
@ -6777,14 +6843,11 @@ function updateDOMProps (oldVnode, vnode) {
|
||||
}
|
||||
}
|
||||
|
||||
// #4521: if a click event triggers update before the change event is
|
||||
// dispatched on a checkbox/radio input, the input's checked state will
|
||||
// be reset and fail to trigger another update.
|
||||
// The root cause here is that browsers may fire microtasks in between click/change.
|
||||
// In Chrome / Firefox, click event fires before change, thus having this problem.
|
||||
// In Safari / Edge, the order is opposite.
|
||||
// Note: in Edge, if you click too fast, only the click event would fire twice.
|
||||
if (key === 'checked' && !isNotInFocusAndDirty(elm, cur)) {
|
||||
// skip the update if old and new VDOM state is the same.
|
||||
// the only exception is `value` where the DOM value may be temporarily
|
||||
// out of sync with VDOM state due to focus, composition and modifiers.
|
||||
// This also covers #4521 by skipping the unnecesarry `checked` update.
|
||||
if (key !== 'value' && cur === oldProps[key]) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
119
dist/vue.runtime.js
vendored
119
dist/vue.runtime.js
vendored
@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Vue.js v2.6.0-beta.1
|
||||
* Vue.js v2.6.0-beta.2
|
||||
* (c) 2014-2019 Evan You
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
@ -364,7 +364,7 @@
|
||||
'activated',
|
||||
'deactivated',
|
||||
'errorCaptured',
|
||||
'ssrPrefetch'
|
||||
'serverPrefetch'
|
||||
];
|
||||
|
||||
/* */
|
||||
@ -1878,6 +1878,8 @@
|
||||
|
||||
/* */
|
||||
|
||||
var isUsingMicroTask = false;
|
||||
|
||||
var callbacks = [];
|
||||
var pending = false;
|
||||
|
||||
@ -1921,6 +1923,7 @@
|
||||
// "force" the microtask queue to be flushed by adding an empty timer.
|
||||
if (isIOS) { setTimeout(noop); }
|
||||
};
|
||||
isUsingMicroTask = true;
|
||||
} else if (!isIE && typeof MutationObserver !== 'undefined' && (
|
||||
isNative(MutationObserver) ||
|
||||
// PhantomJS and iOS 7.x
|
||||
@ -1939,6 +1942,7 @@
|
||||
counter = (counter + 1) % 2;
|
||||
textNode.data = String(counter);
|
||||
};
|
||||
isUsingMicroTask = true;
|
||||
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
||||
// Fallback to setImmediate.
|
||||
// Techinically it leverages the (macro) task queue,
|
||||
@ -2735,13 +2739,14 @@
|
||||
|
||||
function resolveScopedSlots (
|
||||
fns, // see flow/vnode
|
||||
hasDynamicKeys,
|
||||
res
|
||||
) {
|
||||
res = res || {};
|
||||
res = res || { $stable: !hasDynamicKeys };
|
||||
for (var i = 0; i < fns.length; i++) {
|
||||
var slot = fns[i];
|
||||
if (Array.isArray(slot)) {
|
||||
resolveScopedSlots(slot, res);
|
||||
resolveScopedSlots(slot, hasDynamicKeys, res);
|
||||
} else {
|
||||
res[slot.key] = slot.fn;
|
||||
}
|
||||
@ -2957,12 +2962,22 @@
|
||||
}
|
||||
|
||||
// determine whether component has slot children
|
||||
// we need to do this before overwriting $options._renderChildren
|
||||
var hasChildren = !!(
|
||||
// we need to do this before overwriting $options._renderChildren.
|
||||
|
||||
// check if there are dynamic scopedSlots (hand-written or compiled but with
|
||||
// dynamic slot names). Static scoped slots compiled from template has the
|
||||
// "$stable" marker.
|
||||
var hasDynamicScopedSlot = !!(
|
||||
(parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
|
||||
(vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
|
||||
);
|
||||
// Any static slot children from the parent may have changed during parent's
|
||||
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
||||
// update is necessary to ensure correctness.
|
||||
var needsForceUpdate = !!(
|
||||
renderChildren || // has new static slots
|
||||
vm.$options._renderChildren || // has old static slots
|
||||
parentVnode.data.scopedSlots || // has new scoped slots
|
||||
vm.$scopedSlots !== emptyObject // has old scoped slots
|
||||
hasDynamicScopedSlot
|
||||
);
|
||||
|
||||
vm.$options._parentVnode = parentVnode;
|
||||
@ -3001,7 +3016,7 @@
|
||||
updateComponentListeners(vm, listeners, oldListeners);
|
||||
|
||||
// resolve slots + force update if has children
|
||||
if (hasChildren) {
|
||||
if (needsForceUpdate) {
|
||||
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
||||
vm.$forceUpdate();
|
||||
}
|
||||
@ -3092,10 +3107,32 @@
|
||||
waiting = flushing = false;
|
||||
}
|
||||
|
||||
// Async edge case #6566 requires saving the timestamp when event listeners are
|
||||
// attached. However, calling performance.now() has a perf overhead especially
|
||||
// if the page has thousands of event listeners. Instead, we take a timestamp
|
||||
// every time the scheduler flushes and use that for all event listeners
|
||||
// attached during that flush.
|
||||
var currentFlushTimestamp = 0;
|
||||
|
||||
// Async edge case fix requires storing an event listener's attach timestamp.
|
||||
var getNow = Date.now;
|
||||
|
||||
// Determine what event timestamp the browser is using. Annoyingly, the
|
||||
// timestamp can either be hi-res ( relative to poge load) or low-res
|
||||
// (relative to UNIX epoch), so in order to compare time we have to use the
|
||||
// same timestamp type when saving the flush timestamp.
|
||||
if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
|
||||
// if the low-res timestamp which is bigger than the event timestamp
|
||||
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,
|
||||
// and we need to use the hi-res version for event listeners as well.
|
||||
getNow = function () { return performance.now(); };
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush both queues and run the watchers.
|
||||
*/
|
||||
function flushSchedulerQueue () {
|
||||
currentFlushTimestamp = getNow();
|
||||
flushing = true;
|
||||
var watcher, id;
|
||||
|
||||
@ -3845,7 +3882,7 @@
|
||||
} else {
|
||||
res = {};
|
||||
for (var key in slots) {
|
||||
if (slots[key]) {
|
||||
if (slots[key] && key[0] !== '$') {
|
||||
res[key] = normalizeScopedSlot(slots[key]);
|
||||
}
|
||||
}
|
||||
@ -3857,6 +3894,7 @@
|
||||
}
|
||||
}
|
||||
res._normalized = true;
|
||||
res.$stable = slots && slots.$stable;
|
||||
return res
|
||||
}
|
||||
|
||||
@ -4135,6 +4173,31 @@
|
||||
|
||||
/* */
|
||||
|
||||
function bindDynamicKeys (baseObj, values) {
|
||||
for (var i = 0; i < values.length; i += 2) {
|
||||
var key = values[i];
|
||||
if (typeof key === 'string' && key) {
|
||||
baseObj[values[i]] = values[i + 1];
|
||||
} else if (key !== '' && key !== null) {
|
||||
// null is a speical value for explicitly removing a binding
|
||||
warn(
|
||||
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
||||
this
|
||||
);
|
||||
}
|
||||
}
|
||||
return baseObj
|
||||
}
|
||||
|
||||
// helper to dynamically append modifier runtime markers to event names.
|
||||
// ensure only append when value is already string, otherwise it will be cast
|
||||
// to string and cause the type check to miss.
|
||||
function prependModifier (value, symbol) {
|
||||
return typeof value === 'string' ? symbol + value : value
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
function installRenderHelpers (target) {
|
||||
target._o = markOnce;
|
||||
target._n = toNumber;
|
||||
@ -4151,6 +4214,8 @@
|
||||
target._e = createEmptyVNode;
|
||||
target._u = resolveScopedSlots;
|
||||
target._g = bindObjectListeners;
|
||||
target._d = bindDynamicKeys;
|
||||
target._p = prependModifier;
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -5249,7 +5314,7 @@
|
||||
value: FunctionalRenderContext
|
||||
});
|
||||
|
||||
Vue.version = '2.6.0-beta.1';
|
||||
Vue.version = '2.6.0-beta.2';
|
||||
|
||||
/* */
|
||||
|
||||
@ -6391,6 +6456,7 @@
|
||||
} else {
|
||||
// existing directive, update
|
||||
dir.oldValue = oldDir.value;
|
||||
dir.oldArg = oldDir.arg;
|
||||
callHook$1(dir, 'update', vnode, oldVnode);
|
||||
if (dir.def && dir.def.componentUpdated) {
|
||||
dirsWithPostpatch.push(dir);
|
||||
@ -6668,17 +6734,17 @@
|
||||
capture,
|
||||
passive
|
||||
) {
|
||||
if (isChrome) {
|
||||
// async edge case #6566: inner click event triggers patch, event handler
|
||||
// attached to outer element during patch, and triggered again. This only
|
||||
// happens in Chrome as it fires microtask ticks between event propagation.
|
||||
// the solution is simple: we save the timestamp when a handler is attached,
|
||||
// and the handler would only fire if the event passed to it was fired
|
||||
// AFTER it was attached.
|
||||
var now = performance.now();
|
||||
// async edge case #6566: inner click event triggers patch, event handler
|
||||
// attached to outer element during patch, and triggered again. This
|
||||
// happens because browsers fire microtask ticks between event propagation.
|
||||
// the solution is simple: we save the timestamp when a handler is attached,
|
||||
// and the handler would only fire if the event passed to it was fired
|
||||
// AFTER it was attached.
|
||||
if (isUsingMicroTask) {
|
||||
var attachedTimestamp = currentFlushTimestamp;
|
||||
var original = handler;
|
||||
handler = original._wrapper = function (e) {
|
||||
if (e.timeStamp >= now) {
|
||||
if (e.timeStamp >= attachedTimestamp) {
|
||||
return original.apply(this, arguments)
|
||||
}
|
||||
};
|
||||
@ -6759,14 +6825,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
// #4521: if a click event triggers update before the change event is
|
||||
// dispatched on a checkbox/radio input, the input's checked state will
|
||||
// be reset and fail to trigger another update.
|
||||
// The root cause here is that browsers may fire microtasks in between click/change.
|
||||
// In Chrome / Firefox, click event fires before change, thus having this problem.
|
||||
// In Safari / Edge, the order is opposite.
|
||||
// Note: in Edge, if you click too fast, only the click event would fire twice.
|
||||
if (key === 'checked' && !isNotInFocusAndDirty(elm, cur)) {
|
||||
// skip the update if old and new VDOM state is the same.
|
||||
// the only exception is `value` where the DOM value may be temporarily
|
||||
// out of sync with VDOM state due to focus, composition and modifiers.
|
||||
// This also covers #4521 by skipping the unnecesarry `checked` update.
|
||||
if (key !== 'value' && cur === oldProps[key]) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
4
dist/vue.runtime.min.js
vendored
4
dist/vue.runtime.min.js
vendored
File diff suppressed because one or more lines are too long
@ -771,7 +771,7 @@
|
||||
'activated',
|
||||
'deactivated',
|
||||
'errorCaptured',
|
||||
'ssrPrefetch'
|
||||
'serverPrefetch'
|
||||
];
|
||||
|
||||
/* */
|
||||
@ -2695,13 +2695,16 @@
|
||||
: []
|
||||
}
|
||||
|
||||
function addProp (el, name, value, range) {
|
||||
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value }, range));
|
||||
function addProp (el, name, value, range, dynamic) {
|
||||
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
function addAttr (el, name, value, range) {
|
||||
(el.attrs || (el.attrs = [])).push(rangeSetItem({ name: name, value: value }, range));
|
||||
function addAttr (el, name, value, range, dynamic) {
|
||||
var attrs = dynamic
|
||||
? (el.dynamicAttrs || (el.dynamicAttrs = []))
|
||||
: (el.attrs || (el.attrs = []));
|
||||
attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
@ -2717,13 +2720,27 @@
|
||||
rawName,
|
||||
value,
|
||||
arg,
|
||||
isDynamicArg,
|
||||
modifiers,
|
||||
range
|
||||
) {
|
||||
(el.directives || (el.directives = [])).push(rangeSetItem({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers }, range));
|
||||
(el.directives || (el.directives = [])).push(rangeSetItem({
|
||||
name: name,
|
||||
rawName: rawName,
|
||||
value: value,
|
||||
arg: arg,
|
||||
isDynamicArg: isDynamicArg,
|
||||
modifiers: modifiers
|
||||
}, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
function prependModifierMarker (symbol, name, dynamic) {
|
||||
return dynamic
|
||||
? ("_p(" + name + ",\"" + symbol + "\")")
|
||||
: symbol + name // mark the event as captured
|
||||
}
|
||||
|
||||
function addHandler (
|
||||
el,
|
||||
name,
|
||||
@ -2731,7 +2748,8 @@
|
||||
modifiers,
|
||||
important,
|
||||
warn,
|
||||
range
|
||||
range,
|
||||
dynamic
|
||||
) {
|
||||
modifiers = modifiers || emptyObject;
|
||||
// warn prevent and passive modifier
|
||||
@ -2750,11 +2768,17 @@
|
||||
// normalize click.right and click.middle since they don't actually fire
|
||||
// this is technically browser-specific, but at least for now browsers are
|
||||
// the only target envs that have right/middle clicks.
|
||||
if (name === 'click') {
|
||||
if (modifiers.right) {
|
||||
if (modifiers.right) {
|
||||
if (dynamic) {
|
||||
name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
|
||||
} else if (name === 'click') {
|
||||
name = 'contextmenu';
|
||||
delete modifiers.right;
|
||||
} else if (modifiers.middle) {
|
||||
}
|
||||
} else if (modifiers.middle) {
|
||||
if (dynamic) {
|
||||
name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
|
||||
} else if (name === 'click') {
|
||||
name = 'mouseup';
|
||||
}
|
||||
}
|
||||
@ -2762,16 +2786,16 @@
|
||||
// check capture modifier
|
||||
if (modifiers.capture) {
|
||||
delete modifiers.capture;
|
||||
name = '!' + name; // mark the event as captured
|
||||
name = prependModifierMarker('!', name, dynamic);
|
||||
}
|
||||
if (modifiers.once) {
|
||||
delete modifiers.once;
|
||||
name = '~' + name; // mark the event as once
|
||||
name = prependModifierMarker('~', name, dynamic);
|
||||
}
|
||||
/* istanbul ignore if */
|
||||
if (modifiers.passive) {
|
||||
delete modifiers.passive;
|
||||
name = '&' + name; // mark the event as passive
|
||||
name = prependModifierMarker('&', name, dynamic);
|
||||
}
|
||||
|
||||
var events;
|
||||
@ -2782,7 +2806,7 @@
|
||||
events = el.events || (el.events = {});
|
||||
}
|
||||
|
||||
var newHandler = rangeSetItem({ value: value.trim() }, range);
|
||||
var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
||||
if (modifiers !== emptyObject) {
|
||||
newHandler.modifiers = modifiers;
|
||||
}
|
||||
@ -2852,6 +2876,20 @@
|
||||
return val
|
||||
}
|
||||
|
||||
function getAndRemoveAttrByRegex (
|
||||
el,
|
||||
name
|
||||
) {
|
||||
var list = el.attrsList;
|
||||
for (var i = 0, l = list.length; i < l; i++) {
|
||||
var attr = list[i];
|
||||
if (name.test(attr.name)) {
|
||||
list.splice(i, 1);
|
||||
return attr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function rangeSetItem (
|
||||
item,
|
||||
range
|
||||
@ -3748,12 +3786,15 @@
|
||||
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
||||
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
||||
var stripParensRE = /^\(|\)$/g;
|
||||
var dynamicArgRE = /^\[.*\]$/;
|
||||
|
||||
var argRE = /:(.*)$/;
|
||||
var bindRE = /^:|^\.|^v-bind:/;
|
||||
var propBindRE = /^\./;
|
||||
var modifierRE = /\.[^.]+/g;
|
||||
|
||||
var slotRE = /^v-slot(:|$)|^#/;
|
||||
|
||||
var lineBreakRE = /[\r\n]/;
|
||||
var whitespaceRE = /\s+/g;
|
||||
|
||||
@ -3768,6 +3809,7 @@
|
||||
var platformIsPreTag;
|
||||
var platformMustUseProp;
|
||||
var platformGetTagNamespace;
|
||||
var maybeComponent;
|
||||
|
||||
function createASTElement (
|
||||
tag,
|
||||
@ -3798,6 +3840,7 @@
|
||||
platformMustUseProp = options.mustUseProp || no;
|
||||
platformGetTagNamespace = options.getTagNamespace || no;
|
||||
var isReservedTag = options.isReservedTag || no;
|
||||
maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
||||
|
||||
transforms = pluckModuleFunction(options.modules, 'transformNode');
|
||||
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
||||
@ -4279,10 +4322,7 @@
|
||||
true
|
||||
);
|
||||
}
|
||||
el.slotScope = (
|
||||
slotScope ||
|
||||
getAndRemoveAttr(el, 'slot-scope')
|
||||
);
|
||||
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
||||
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
||||
/* istanbul ignore if */
|
||||
if (el.attrsMap['v-for']) {
|
||||
@ -4301,12 +4341,95 @@
|
||||
var slotTarget = getBindingAttr(el, 'slot');
|
||||
if (slotTarget) {
|
||||
el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
||||
el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
||||
// preserve slot as an attribute for native shadow DOM compat
|
||||
// only for non-scoped slots.
|
||||
if (el.tag !== 'template' && !el.slotScope) {
|
||||
addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
||||
}
|
||||
}
|
||||
|
||||
// 2.6 v-slot syntax
|
||||
{
|
||||
if (el.tag === 'template') {
|
||||
// v-slot on <template>
|
||||
var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
||||
if (slotBinding) {
|
||||
{
|
||||
if (el.slotTarget || el.slotScope) {
|
||||
warn$1(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
}
|
||||
var ref = getSlotName(slotBinding);
|
||||
var name = ref.name;
|
||||
var dynamic = ref.dynamic;
|
||||
el.slotTarget = name;
|
||||
el.slotTargetDynamic = dynamic;
|
||||
el.slotScope = slotBinding.value || "_"; // force it into a scoped slot for perf
|
||||
}
|
||||
} else {
|
||||
// v-slot on component, denotes default slot
|
||||
var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
|
||||
if (slotBinding$1) {
|
||||
{
|
||||
if (!maybeComponent(el)) {
|
||||
warn$1(
|
||||
"v-slot can only be used on components or <template>.",
|
||||
slotBinding$1
|
||||
);
|
||||
}
|
||||
if (el.slotScope || el.slotTarget) {
|
||||
warn$1(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
if (el.scopedSlots) {
|
||||
warn$1(
|
||||
"To avoid scope ambiguity, the default slot should also use " +
|
||||
"<template> syntax when there are other named slots.",
|
||||
slotBinding$1
|
||||
);
|
||||
}
|
||||
}
|
||||
// add the component's children to its default slot
|
||||
var slots = el.scopedSlots || (el.scopedSlots = {});
|
||||
var ref$1 = getSlotName(slotBinding$1);
|
||||
var name$1 = ref$1.name;
|
||||
var dynamic$1 = ref$1.dynamic;
|
||||
var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
||||
slotContainer.slotTargetDynamic = dynamic$1;
|
||||
slotContainer.children = el.children;
|
||||
slotContainer.slotScope = slotBinding$1.value || "_";
|
||||
// remove children as they are returned from scopedSlots now
|
||||
el.children = [];
|
||||
// mark el non-plain so data gets generated
|
||||
el.plain = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSlotName (binding) {
|
||||
var name = binding.name.replace(slotRE, '');
|
||||
if (!name) {
|
||||
if (binding.name[0] !== '#') {
|
||||
name = 'default';
|
||||
} else {
|
||||
warn$1(
|
||||
"v-slot shorthand syntax requires a slot name.",
|
||||
binding
|
||||
);
|
||||
}
|
||||
}
|
||||
return dynamicArgRE.test(name)
|
||||
// dynamic [name]
|
||||
? { name: name.slice(1, -1), dynamic: true }
|
||||
// static name
|
||||
: { name: ("\"" + name + "\""), dynamic: false }
|
||||
}
|
||||
|
||||
// handle <slot/> outlets
|
||||
@ -4336,7 +4459,7 @@
|
||||
|
||||
function processAttrs (el) {
|
||||
var list = el.attrsList;
|
||||
var i, l, name, rawName, value, modifiers, isProp, syncGen;
|
||||
var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
||||
for (i = 0, l = list.length; i < l; i++) {
|
||||
name = rawName = list[i].name;
|
||||
value = list[i].value;
|
||||
@ -4355,7 +4478,10 @@
|
||||
if (bindRE.test(name)) { // v-bind
|
||||
name = name.replace(bindRE, '');
|
||||
value = parseFilters(value);
|
||||
isProp = false;
|
||||
isDynamic = dynamicArgRE.test(name);
|
||||
if (isDynamic) {
|
||||
name = name.slice(1, -1);
|
||||
}
|
||||
if (
|
||||
value.trim().length === 0
|
||||
) {
|
||||
@ -4364,57 +4490,79 @@
|
||||
);
|
||||
}
|
||||
if (modifiers) {
|
||||
if (modifiers.prop) {
|
||||
isProp = true;
|
||||
if (modifiers.prop && !isDynamic) {
|
||||
name = camelize(name);
|
||||
if (name === 'innerHtml') { name = 'innerHTML'; }
|
||||
}
|
||||
if (modifiers.camel) {
|
||||
if (modifiers.camel && !isDynamic) {
|
||||
name = camelize(name);
|
||||
}
|
||||
if (modifiers.sync) {
|
||||
syncGen = genAssignmentCode(value, "$event");
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (camelize(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i]
|
||||
);
|
||||
if (hyphenate(name) !== camelize(name)) {
|
||||
if (!isDynamic) {
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (hyphenate(name))),
|
||||
("update:" + (camelize(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i]
|
||||
);
|
||||
if (hyphenate(name) !== camelize(name)) {
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (hyphenate(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// handler w/ dynamic event name
|
||||
addHandler(
|
||||
el,
|
||||
("\"update:\"+(" + name + ")"),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i],
|
||||
true // dynamic
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isProp || (
|
||||
if ((modifiers && modifiers.prop) || (
|
||||
!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
|
||||
)) {
|
||||
addProp(el, name, value, list[i]);
|
||||
addProp(el, name, value, list[i], isDynamic);
|
||||
} else {
|
||||
addAttr(el, name, value, list[i]);
|
||||
addAttr(el, name, value, list[i], isDynamic);
|
||||
}
|
||||
} else if (onRE.test(name)) { // v-on
|
||||
name = name.replace(onRE, '');
|
||||
addHandler(el, name, value, modifiers, false, warn$1, list[i]);
|
||||
isDynamic = dynamicArgRE.test(name);
|
||||
if (isDynamic) {
|
||||
name = name.slice(1, -1);
|
||||
}
|
||||
addHandler(el, name, value, modifiers, false, warn$1, list[i], isDynamic);
|
||||
} else { // normal directives
|
||||
name = name.replace(dirRE, '');
|
||||
// parse arg
|
||||
var argMatch = name.match(argRE);
|
||||
var arg = argMatch && argMatch[1];
|
||||
isDynamic = false;
|
||||
if (arg) {
|
||||
name = name.slice(0, -(arg.length + 1));
|
||||
if (dynamicArgRE.test(arg)) {
|
||||
arg = arg.slice(1, -1);
|
||||
isDynamic = true;
|
||||
}
|
||||
}
|
||||
addDirective(el, name, rawName, value, arg, modifiers, list[i]);
|
||||
addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
||||
if (name === 'model') {
|
||||
checkForAliasModel(el, value);
|
||||
}
|
||||
@ -4865,23 +5013,32 @@
|
||||
events,
|
||||
isNative
|
||||
) {
|
||||
var res = isNative ? 'nativeOn:{' : 'on:{';
|
||||
var prefix = isNative ? 'nativeOn:' : 'on:';
|
||||
var staticHandlers = "";
|
||||
var dynamicHandlers = "";
|
||||
for (var name in events) {
|
||||
res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
|
||||
var handlerCode = genHandler(events[name]);
|
||||
if (events[name] && events[name].dynamic) {
|
||||
dynamicHandlers += name + "," + handlerCode + ",";
|
||||
} else {
|
||||
staticHandlers += "\"" + name + "\":" + handlerCode + ",";
|
||||
}
|
||||
}
|
||||
staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
|
||||
if (dynamicHandlers) {
|
||||
return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
|
||||
} else {
|
||||
return prefix + staticHandlers
|
||||
}
|
||||
return res.slice(0, -1) + '}'
|
||||
}
|
||||
|
||||
function genHandler (
|
||||
name,
|
||||
handler
|
||||
) {
|
||||
function genHandler (handler) {
|
||||
if (!handler) {
|
||||
return 'function(){}'
|
||||
}
|
||||
|
||||
if (Array.isArray(handler)) {
|
||||
return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
|
||||
return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
|
||||
}
|
||||
|
||||
var isMethodPath = simplePathRE.test(handler.value);
|
||||
@ -4935,7 +5092,7 @@
|
||||
}
|
||||
|
||||
function genKeyFilter (keys) {
|
||||
return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
||||
return ("if(('keyCode' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
||||
}
|
||||
|
||||
function genFilterCode (key) {
|
||||
@ -5197,11 +5354,11 @@
|
||||
}
|
||||
// attributes
|
||||
if (el.attrs) {
|
||||
data += "attrs:{" + (genProps(el.attrs)) + "},";
|
||||
data += "attrs:" + (genProps(el.attrs)) + ",";
|
||||
}
|
||||
// DOM props
|
||||
if (el.props) {
|
||||
data += "domProps:{" + (genProps(el.props)) + "},";
|
||||
data += "domProps:" + (genProps(el.props)) + ",";
|
||||
}
|
||||
// event handlers
|
||||
if (el.events) {
|
||||
@ -5231,6 +5388,12 @@
|
||||
}
|
||||
}
|
||||
data = data.replace(/,$/, '') + '}';
|
||||
// v-bind dynamic argument wrap
|
||||
// v-bind with dynamic arguments must be applied using the same v-bind object
|
||||
// merge helper so that class/style/mustUseProp attrs are handled correctly.
|
||||
if (el.dynamicAttrs) {
|
||||
data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
|
||||
}
|
||||
// v-bind data wrap
|
||||
if (el.wrapData) {
|
||||
data = el.wrapData(data);
|
||||
@ -5259,7 +5422,7 @@
|
||||
}
|
||||
if (needRuntime) {
|
||||
hasRuntime = true;
|
||||
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
||||
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
||||
}
|
||||
}
|
||||
if (hasRuntime) {
|
||||
@ -5285,9 +5448,10 @@
|
||||
slots,
|
||||
state
|
||||
) {
|
||||
var hasDynamicKeys = Object.keys(slots).some(function (key) { return slots[key].slotTargetDynamic; });
|
||||
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
|
||||
return genScopedSlot(key, slots[key], state)
|
||||
}).join(',')) + "])")
|
||||
}).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
|
||||
}
|
||||
|
||||
function genScopedSlot (
|
||||
@ -5432,15 +5596,23 @@
|
||||
}
|
||||
|
||||
function genProps (props) {
|
||||
var res = '';
|
||||
var staticProps = "";
|
||||
var dynamicProps = "";
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var prop = props[i];
|
||||
/* istanbul ignore if */
|
||||
{
|
||||
res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
|
||||
var value = transformSpecialNewlines(prop.value);
|
||||
if (prop.dynamic) {
|
||||
dynamicProps += (prop.name) + "," + value + ",";
|
||||
} else {
|
||||
staticProps += "\"" + (prop.name) + "\":" + value + ",";
|
||||
}
|
||||
}
|
||||
return res.slice(0, -1)
|
||||
staticProps = "{" + (staticProps.slice(0, -1)) + "}";
|
||||
if (dynamicProps) {
|
||||
return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
|
||||
} else {
|
||||
return staticProps
|
||||
}
|
||||
}
|
||||
|
||||
// #3895, #4268
|
||||
@ -6949,13 +7121,14 @@
|
||||
|
||||
function resolveScopedSlots (
|
||||
fns, // see flow/vnode
|
||||
hasDynamicKeys,
|
||||
res
|
||||
) {
|
||||
res = res || {};
|
||||
res = res || { $stable: !hasDynamicKeys };
|
||||
for (var i = 0; i < fns.length; i++) {
|
||||
var slot = fns[i];
|
||||
if (Array.isArray(slot)) {
|
||||
resolveScopedSlots(slot, res);
|
||||
resolveScopedSlots(slot, hasDynamicKeys, res);
|
||||
} else {
|
||||
res[slot.key] = slot.fn;
|
||||
}
|
||||
@ -6976,12 +7149,22 @@
|
||||
) {
|
||||
|
||||
// determine whether component has slot children
|
||||
// we need to do this before overwriting $options._renderChildren
|
||||
var hasChildren = !!(
|
||||
// we need to do this before overwriting $options._renderChildren.
|
||||
|
||||
// check if there are dynamic scopedSlots (hand-written or compiled but with
|
||||
// dynamic slot names). Static scoped slots compiled from template has the
|
||||
// "$stable" marker.
|
||||
var hasDynamicScopedSlot = !!(
|
||||
(parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
|
||||
(vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
|
||||
);
|
||||
// Any static slot children from the parent may have changed during parent's
|
||||
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
||||
// update is necessary to ensure correctness.
|
||||
var needsForceUpdate = !!(
|
||||
renderChildren || // has new static slots
|
||||
vm.$options._renderChildren || // has old static slots
|
||||
parentVnode.data.scopedSlots || // has new scoped slots
|
||||
vm.$scopedSlots !== emptyObject // has old scoped slots
|
||||
hasDynamicScopedSlot
|
||||
);
|
||||
|
||||
vm.$options._parentVnode = parentVnode;
|
||||
@ -7020,7 +7203,7 @@
|
||||
updateComponentListeners(vm, listeners, oldListeners);
|
||||
|
||||
// resolve slots + force update if has children
|
||||
if (hasChildren) {
|
||||
if (needsForceUpdate) {
|
||||
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
||||
vm.$forceUpdate();
|
||||
}
|
||||
@ -7085,6 +7268,20 @@
|
||||
|
||||
/* */
|
||||
|
||||
// Async edge case fix requires storing an event listener's attach timestamp.
|
||||
var getNow = Date.now;
|
||||
|
||||
// Determine what event timestamp the browser is using. Annoyingly, the
|
||||
// timestamp can either be hi-res ( relative to poge load) or low-res
|
||||
// (relative to UNIX epoch), so in order to compare time we have to use the
|
||||
// same timestamp type when saving the flush timestamp.
|
||||
if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
|
||||
// if the low-res timestamp which is bigger than the event timestamp
|
||||
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,
|
||||
// and we need to use the hi-res version for event listeners as well.
|
||||
getNow = function () { return performance.now(); };
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a kept-alive component that was activated during patch.
|
||||
* The queue will be processed after the entire tree has been patched.
|
||||
@ -7495,6 +7692,31 @@
|
||||
|
||||
/* */
|
||||
|
||||
function bindDynamicKeys (baseObj, values) {
|
||||
for (var i = 0; i < values.length; i += 2) {
|
||||
var key = values[i];
|
||||
if (typeof key === 'string' && key) {
|
||||
baseObj[values[i]] = values[i + 1];
|
||||
} else if (key !== '' && key !== null) {
|
||||
// null is a speical value for explicitly removing a binding
|
||||
warn(
|
||||
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
||||
this
|
||||
);
|
||||
}
|
||||
}
|
||||
return baseObj
|
||||
}
|
||||
|
||||
// helper to dynamically append modifier runtime markers to event names.
|
||||
// ensure only append when value is already string, otherwise it will be cast
|
||||
// to string and cause the type check to miss.
|
||||
function prependModifier (value, symbol) {
|
||||
return typeof value === 'string' ? symbol + value : value
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
function installRenderHelpers (target) {
|
||||
target._o = markOnce;
|
||||
target._n = toNumber;
|
||||
@ -7511,6 +7733,8 @@
|
||||
target._e = createEmptyVNode;
|
||||
target._u = resolveScopedSlots;
|
||||
target._g = bindObjectListeners;
|
||||
target._d = bindDynamicKeys;
|
||||
target._p = prependModifier;
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -7527,7 +7751,7 @@
|
||||
} else {
|
||||
res = {};
|
||||
for (var key in slots) {
|
||||
if (slots[key]) {
|
||||
if (slots[key] && key[0] !== '$') {
|
||||
res[key] = normalizeScopedSlot(slots[key]);
|
||||
}
|
||||
}
|
||||
@ -7539,6 +7763,7 @@
|
||||
}
|
||||
}
|
||||
res._normalized = true;
|
||||
res.$stable = slots && slots.$stable;
|
||||
return res
|
||||
}
|
||||
|
||||
@ -8039,8 +8264,8 @@
|
||||
}
|
||||
};
|
||||
|
||||
function waitForSsrPrefetch (vm, resolve, reject) {
|
||||
var handlers = vm.$options.ssrPrefetch;
|
||||
function waitForServerPrefetch (vm, resolve, reject) {
|
||||
var handlers = vm.$options.serverPrefetch;
|
||||
if (isDef(handlers)) {
|
||||
if (!Array.isArray(handlers)) { handlers = [handlers]; }
|
||||
try {
|
||||
@ -8196,7 +8421,7 @@
|
||||
|
||||
var reject = context.done;
|
||||
|
||||
waitForSsrPrefetch(child, resolve, reject);
|
||||
waitForServerPrefetch(child, resolve, reject);
|
||||
}
|
||||
|
||||
function renderAsyncComponent (node, isRoot, context) {
|
||||
@ -8428,7 +8653,7 @@
|
||||
var resolve = function () {
|
||||
renderNode(component._render(), true, context);
|
||||
};
|
||||
waitForSsrPrefetch(component, resolve, done);
|
||||
waitForServerPrefetch(component, resolve, done);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -773,7 +773,7 @@ var LIFECYCLE_HOOKS = [
|
||||
'activated',
|
||||
'deactivated',
|
||||
'errorCaptured',
|
||||
'ssrPrefetch'
|
||||
'serverPrefetch'
|
||||
];
|
||||
|
||||
/* */
|
||||
@ -2790,13 +2790,16 @@ function pluckModuleFunction (
|
||||
: []
|
||||
}
|
||||
|
||||
function addProp (el, name, value, range) {
|
||||
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value }, range));
|
||||
function addProp (el, name, value, range, dynamic) {
|
||||
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
function addAttr (el, name, value, range) {
|
||||
(el.attrs || (el.attrs = [])).push(rangeSetItem({ name: name, value: value }, range));
|
||||
function addAttr (el, name, value, range, dynamic) {
|
||||
var attrs = dynamic
|
||||
? (el.dynamicAttrs || (el.dynamicAttrs = []))
|
||||
: (el.attrs || (el.attrs = []));
|
||||
attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
@ -2812,13 +2815,27 @@ function addDirective (
|
||||
rawName,
|
||||
value,
|
||||
arg,
|
||||
isDynamicArg,
|
||||
modifiers,
|
||||
range
|
||||
) {
|
||||
(el.directives || (el.directives = [])).push(rangeSetItem({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers }, range));
|
||||
(el.directives || (el.directives = [])).push(rangeSetItem({
|
||||
name: name,
|
||||
rawName: rawName,
|
||||
value: value,
|
||||
arg: arg,
|
||||
isDynamicArg: isDynamicArg,
|
||||
modifiers: modifiers
|
||||
}, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
function prependModifierMarker (symbol, name, dynamic) {
|
||||
return dynamic
|
||||
? ("_p(" + name + ",\"" + symbol + "\")")
|
||||
: symbol + name // mark the event as captured
|
||||
}
|
||||
|
||||
function addHandler (
|
||||
el,
|
||||
name,
|
||||
@ -2826,7 +2843,8 @@ function addHandler (
|
||||
modifiers,
|
||||
important,
|
||||
warn,
|
||||
range
|
||||
range,
|
||||
dynamic
|
||||
) {
|
||||
modifiers = modifiers || emptyObject;
|
||||
// warn prevent and passive modifier
|
||||
@ -2845,11 +2863,17 @@ function addHandler (
|
||||
// normalize click.right and click.middle since they don't actually fire
|
||||
// this is technically browser-specific, but at least for now browsers are
|
||||
// the only target envs that have right/middle clicks.
|
||||
if (name === 'click') {
|
||||
if (modifiers.right) {
|
||||
if (modifiers.right) {
|
||||
if (dynamic) {
|
||||
name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
|
||||
} else if (name === 'click') {
|
||||
name = 'contextmenu';
|
||||
delete modifiers.right;
|
||||
} else if (modifiers.middle) {
|
||||
}
|
||||
} else if (modifiers.middle) {
|
||||
if (dynamic) {
|
||||
name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
|
||||
} else if (name === 'click') {
|
||||
name = 'mouseup';
|
||||
}
|
||||
}
|
||||
@ -2857,16 +2881,16 @@ function addHandler (
|
||||
// check capture modifier
|
||||
if (modifiers.capture) {
|
||||
delete modifiers.capture;
|
||||
name = '!' + name; // mark the event as captured
|
||||
name = prependModifierMarker('!', name, dynamic);
|
||||
}
|
||||
if (modifiers.once) {
|
||||
delete modifiers.once;
|
||||
name = '~' + name; // mark the event as once
|
||||
name = prependModifierMarker('~', name, dynamic);
|
||||
}
|
||||
/* istanbul ignore if */
|
||||
if (modifiers.passive) {
|
||||
delete modifiers.passive;
|
||||
name = '&' + name; // mark the event as passive
|
||||
name = prependModifierMarker('&', name, dynamic);
|
||||
}
|
||||
|
||||
var events;
|
||||
@ -2877,7 +2901,7 @@ function addHandler (
|
||||
events = el.events || (el.events = {});
|
||||
}
|
||||
|
||||
var newHandler = rangeSetItem({ value: value.trim() }, range);
|
||||
var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
||||
if (modifiers !== emptyObject) {
|
||||
newHandler.modifiers = modifiers;
|
||||
}
|
||||
@ -2947,6 +2971,20 @@ function getAndRemoveAttr (
|
||||
return val
|
||||
}
|
||||
|
||||
function getAndRemoveAttrByRegex (
|
||||
el,
|
||||
name
|
||||
) {
|
||||
var list = el.attrsList;
|
||||
for (var i = 0, l = list.length; i < l; i++) {
|
||||
var attr = list[i];
|
||||
if (name.test(attr.name)) {
|
||||
list.splice(i, 1);
|
||||
return attr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function rangeSetItem (
|
||||
item,
|
||||
range
|
||||
@ -3498,12 +3536,15 @@ var dirRE = /^v-|^@|^:|^\./;
|
||||
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
||||
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
||||
var stripParensRE = /^\(|\)$/g;
|
||||
var dynamicArgRE = /^\[.*\]$/;
|
||||
|
||||
var argRE = /:(.*)$/;
|
||||
var bindRE = /^:|^\.|^v-bind:/;
|
||||
var propBindRE = /^\./;
|
||||
var modifierRE = /\.[^.]+/g;
|
||||
|
||||
var slotRE = /^v-slot(:|$)|^#/;
|
||||
|
||||
var lineBreakRE = /[\r\n]/;
|
||||
var whitespaceRE = /\s+/g;
|
||||
|
||||
@ -3518,6 +3559,7 @@ var postTransforms;
|
||||
var platformIsPreTag;
|
||||
var platformMustUseProp;
|
||||
var platformGetTagNamespace;
|
||||
var maybeComponent;
|
||||
|
||||
function createASTElement (
|
||||
tag,
|
||||
@ -3548,6 +3590,7 @@ function parse (
|
||||
platformMustUseProp = options.mustUseProp || no;
|
||||
platformGetTagNamespace = options.getTagNamespace || no;
|
||||
var isReservedTag = options.isReservedTag || no;
|
||||
maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
||||
|
||||
transforms = pluckModuleFunction(options.modules, 'transformNode');
|
||||
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
||||
@ -4029,10 +4072,7 @@ function processSlotContent (el) {
|
||||
true
|
||||
);
|
||||
}
|
||||
el.slotScope = (
|
||||
slotScope ||
|
||||
getAndRemoveAttr(el, 'slot-scope')
|
||||
);
|
||||
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
||||
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
||||
/* istanbul ignore if */
|
||||
if (el.attrsMap['v-for']) {
|
||||
@ -4051,12 +4091,95 @@ function processSlotContent (el) {
|
||||
var slotTarget = getBindingAttr(el, 'slot');
|
||||
if (slotTarget) {
|
||||
el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
||||
el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
||||
// preserve slot as an attribute for native shadow DOM compat
|
||||
// only for non-scoped slots.
|
||||
if (el.tag !== 'template' && !el.slotScope) {
|
||||
addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
||||
}
|
||||
}
|
||||
|
||||
// 2.6 v-slot syntax
|
||||
{
|
||||
if (el.tag === 'template') {
|
||||
// v-slot on <template>
|
||||
var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
||||
if (slotBinding) {
|
||||
{
|
||||
if (el.slotTarget || el.slotScope) {
|
||||
warn$1(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
}
|
||||
var ref = getSlotName(slotBinding);
|
||||
var name = ref.name;
|
||||
var dynamic = ref.dynamic;
|
||||
el.slotTarget = name;
|
||||
el.slotTargetDynamic = dynamic;
|
||||
el.slotScope = slotBinding.value || "_"; // force it into a scoped slot for perf
|
||||
}
|
||||
} else {
|
||||
// v-slot on component, denotes default slot
|
||||
var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
|
||||
if (slotBinding$1) {
|
||||
{
|
||||
if (!maybeComponent(el)) {
|
||||
warn$1(
|
||||
"v-slot can only be used on components or <template>.",
|
||||
slotBinding$1
|
||||
);
|
||||
}
|
||||
if (el.slotScope || el.slotTarget) {
|
||||
warn$1(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
if (el.scopedSlots) {
|
||||
warn$1(
|
||||
"To avoid scope ambiguity, the default slot should also use " +
|
||||
"<template> syntax when there are other named slots.",
|
||||
slotBinding$1
|
||||
);
|
||||
}
|
||||
}
|
||||
// add the component's children to its default slot
|
||||
var slots = el.scopedSlots || (el.scopedSlots = {});
|
||||
var ref$1 = getSlotName(slotBinding$1);
|
||||
var name$1 = ref$1.name;
|
||||
var dynamic$1 = ref$1.dynamic;
|
||||
var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
||||
slotContainer.slotTargetDynamic = dynamic$1;
|
||||
slotContainer.children = el.children;
|
||||
slotContainer.slotScope = slotBinding$1.value || "_";
|
||||
// remove children as they are returned from scopedSlots now
|
||||
el.children = [];
|
||||
// mark el non-plain so data gets generated
|
||||
el.plain = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSlotName (binding) {
|
||||
var name = binding.name.replace(slotRE, '');
|
||||
if (!name) {
|
||||
if (binding.name[0] !== '#') {
|
||||
name = 'default';
|
||||
} else {
|
||||
warn$1(
|
||||
"v-slot shorthand syntax requires a slot name.",
|
||||
binding
|
||||
);
|
||||
}
|
||||
}
|
||||
return dynamicArgRE.test(name)
|
||||
// dynamic [name]
|
||||
? { name: name.slice(1, -1), dynamic: true }
|
||||
// static name
|
||||
: { name: ("\"" + name + "\""), dynamic: false }
|
||||
}
|
||||
|
||||
// handle <slot/> outlets
|
||||
@ -4086,7 +4209,7 @@ function processComponent (el) {
|
||||
|
||||
function processAttrs (el) {
|
||||
var list = el.attrsList;
|
||||
var i, l, name, rawName, value, modifiers, isProp, syncGen;
|
||||
var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
||||
for (i = 0, l = list.length; i < l; i++) {
|
||||
name = rawName = list[i].name;
|
||||
value = list[i].value;
|
||||
@ -4105,7 +4228,10 @@ function processAttrs (el) {
|
||||
if (bindRE.test(name)) { // v-bind
|
||||
name = name.replace(bindRE, '');
|
||||
value = parseFilters(value);
|
||||
isProp = false;
|
||||
isDynamic = dynamicArgRE.test(name);
|
||||
if (isDynamic) {
|
||||
name = name.slice(1, -1);
|
||||
}
|
||||
if (
|
||||
value.trim().length === 0
|
||||
) {
|
||||
@ -4114,57 +4240,79 @@ function processAttrs (el) {
|
||||
);
|
||||
}
|
||||
if (modifiers) {
|
||||
if (modifiers.prop) {
|
||||
isProp = true;
|
||||
if (modifiers.prop && !isDynamic) {
|
||||
name = camelize(name);
|
||||
if (name === 'innerHtml') { name = 'innerHTML'; }
|
||||
}
|
||||
if (modifiers.camel) {
|
||||
if (modifiers.camel && !isDynamic) {
|
||||
name = camelize(name);
|
||||
}
|
||||
if (modifiers.sync) {
|
||||
syncGen = genAssignmentCode(value, "$event");
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (camelize(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i]
|
||||
);
|
||||
if (hyphenate(name) !== camelize(name)) {
|
||||
if (!isDynamic) {
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (hyphenate(name))),
|
||||
("update:" + (camelize(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i]
|
||||
);
|
||||
if (hyphenate(name) !== camelize(name)) {
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (hyphenate(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// handler w/ dynamic event name
|
||||
addHandler(
|
||||
el,
|
||||
("\"update:\"+(" + name + ")"),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i],
|
||||
true // dynamic
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isProp || (
|
||||
if ((modifiers && modifiers.prop) || (
|
||||
!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
|
||||
)) {
|
||||
addProp(el, name, value, list[i]);
|
||||
addProp(el, name, value, list[i], isDynamic);
|
||||
} else {
|
||||
addAttr(el, name, value, list[i]);
|
||||
addAttr(el, name, value, list[i], isDynamic);
|
||||
}
|
||||
} else if (onRE.test(name)) { // v-on
|
||||
name = name.replace(onRE, '');
|
||||
addHandler(el, name, value, modifiers, false, warn$1, list[i]);
|
||||
isDynamic = dynamicArgRE.test(name);
|
||||
if (isDynamic) {
|
||||
name = name.slice(1, -1);
|
||||
}
|
||||
addHandler(el, name, value, modifiers, false, warn$1, list[i], isDynamic);
|
||||
} else { // normal directives
|
||||
name = name.replace(dirRE, '');
|
||||
// parse arg
|
||||
var argMatch = name.match(argRE);
|
||||
var arg = argMatch && argMatch[1];
|
||||
isDynamic = false;
|
||||
if (arg) {
|
||||
name = name.slice(0, -(arg.length + 1));
|
||||
if (dynamicArgRE.test(arg)) {
|
||||
arg = arg.slice(1, -1);
|
||||
isDynamic = true;
|
||||
}
|
||||
}
|
||||
addDirective(el, name, rawName, value, arg, modifiers, list[i]);
|
||||
addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
||||
if (name === 'model') {
|
||||
checkForAliasModel(el, value);
|
||||
}
|
||||
@ -4615,23 +4763,32 @@ function genHandlers (
|
||||
events,
|
||||
isNative
|
||||
) {
|
||||
var res = isNative ? 'nativeOn:{' : 'on:{';
|
||||
var prefix = isNative ? 'nativeOn:' : 'on:';
|
||||
var staticHandlers = "";
|
||||
var dynamicHandlers = "";
|
||||
for (var name in events) {
|
||||
res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
|
||||
var handlerCode = genHandler(events[name]);
|
||||
if (events[name] && events[name].dynamic) {
|
||||
dynamicHandlers += name + "," + handlerCode + ",";
|
||||
} else {
|
||||
staticHandlers += "\"" + name + "\":" + handlerCode + ",";
|
||||
}
|
||||
}
|
||||
staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
|
||||
if (dynamicHandlers) {
|
||||
return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
|
||||
} else {
|
||||
return prefix + staticHandlers
|
||||
}
|
||||
return res.slice(0, -1) + '}'
|
||||
}
|
||||
|
||||
function genHandler (
|
||||
name,
|
||||
handler
|
||||
) {
|
||||
function genHandler (handler) {
|
||||
if (!handler) {
|
||||
return 'function(){}'
|
||||
}
|
||||
|
||||
if (Array.isArray(handler)) {
|
||||
return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
|
||||
return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
|
||||
}
|
||||
|
||||
var isMethodPath = simplePathRE.test(handler.value);
|
||||
@ -4685,7 +4842,7 @@ function genHandler (
|
||||
}
|
||||
|
||||
function genKeyFilter (keys) {
|
||||
return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
||||
return ("if(('keyCode' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
||||
}
|
||||
|
||||
function genFilterCode (key) {
|
||||
@ -4947,11 +5104,11 @@ function genData$2 (el, state) {
|
||||
}
|
||||
// attributes
|
||||
if (el.attrs) {
|
||||
data += "attrs:{" + (genProps(el.attrs)) + "},";
|
||||
data += "attrs:" + (genProps(el.attrs)) + ",";
|
||||
}
|
||||
// DOM props
|
||||
if (el.props) {
|
||||
data += "domProps:{" + (genProps(el.props)) + "},";
|
||||
data += "domProps:" + (genProps(el.props)) + ",";
|
||||
}
|
||||
// event handlers
|
||||
if (el.events) {
|
||||
@ -4981,6 +5138,12 @@ function genData$2 (el, state) {
|
||||
}
|
||||
}
|
||||
data = data.replace(/,$/, '') + '}';
|
||||
// v-bind dynamic argument wrap
|
||||
// v-bind with dynamic arguments must be applied using the same v-bind object
|
||||
// merge helper so that class/style/mustUseProp attrs are handled correctly.
|
||||
if (el.dynamicAttrs) {
|
||||
data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
|
||||
}
|
||||
// v-bind data wrap
|
||||
if (el.wrapData) {
|
||||
data = el.wrapData(data);
|
||||
@ -5009,7 +5172,7 @@ function genDirectives (el, state) {
|
||||
}
|
||||
if (needRuntime) {
|
||||
hasRuntime = true;
|
||||
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
||||
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
||||
}
|
||||
}
|
||||
if (hasRuntime) {
|
||||
@ -5035,9 +5198,10 @@ function genScopedSlots (
|
||||
slots,
|
||||
state
|
||||
) {
|
||||
var hasDynamicKeys = Object.keys(slots).some(function (key) { return slots[key].slotTargetDynamic; });
|
||||
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
|
||||
return genScopedSlot(key, slots[key], state)
|
||||
}).join(',')) + "])")
|
||||
}).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
|
||||
}
|
||||
|
||||
function genScopedSlot (
|
||||
@ -5182,15 +5346,23 @@ function genComponent (
|
||||
}
|
||||
|
||||
function genProps (props) {
|
||||
var res = '';
|
||||
var staticProps = "";
|
||||
var dynamicProps = "";
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var prop = props[i];
|
||||
/* istanbul ignore if */
|
||||
{
|
||||
res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
|
||||
var value = transformSpecialNewlines(prop.value);
|
||||
if (prop.dynamic) {
|
||||
dynamicProps += (prop.name) + "," + value + ",";
|
||||
} else {
|
||||
staticProps += "\"" + (prop.name) + "\":" + value + ",";
|
||||
}
|
||||
}
|
||||
return res.slice(0, -1)
|
||||
staticProps = "{" + (staticProps.slice(0, -1)) + "}";
|
||||
if (dynamicProps) {
|
||||
return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
|
||||
} else {
|
||||
return staticProps
|
||||
}
|
||||
}
|
||||
|
||||
// #3895, #4268
|
||||
@ -6699,13 +6871,14 @@ function isWhitespace (node) {
|
||||
|
||||
function resolveScopedSlots (
|
||||
fns, // see flow/vnode
|
||||
hasDynamicKeys,
|
||||
res
|
||||
) {
|
||||
res = res || {};
|
||||
res = res || { $stable: !hasDynamicKeys };
|
||||
for (var i = 0; i < fns.length; i++) {
|
||||
var slot = fns[i];
|
||||
if (Array.isArray(slot)) {
|
||||
resolveScopedSlots(slot, res);
|
||||
resolveScopedSlots(slot, hasDynamicKeys, res);
|
||||
} else {
|
||||
res[slot.key] = slot.fn;
|
||||
}
|
||||
@ -6726,12 +6899,22 @@ function updateChildComponent (
|
||||
) {
|
||||
|
||||
// determine whether component has slot children
|
||||
// we need to do this before overwriting $options._renderChildren
|
||||
var hasChildren = !!(
|
||||
// we need to do this before overwriting $options._renderChildren.
|
||||
|
||||
// check if there are dynamic scopedSlots (hand-written or compiled but with
|
||||
// dynamic slot names). Static scoped slots compiled from template has the
|
||||
// "$stable" marker.
|
||||
var hasDynamicScopedSlot = !!(
|
||||
(parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
|
||||
(vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
|
||||
);
|
||||
// Any static slot children from the parent may have changed during parent's
|
||||
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
||||
// update is necessary to ensure correctness.
|
||||
var needsForceUpdate = !!(
|
||||
renderChildren || // has new static slots
|
||||
vm.$options._renderChildren || // has old static slots
|
||||
parentVnode.data.scopedSlots || // has new scoped slots
|
||||
vm.$scopedSlots !== emptyObject // has old scoped slots
|
||||
hasDynamicScopedSlot
|
||||
);
|
||||
|
||||
vm.$options._parentVnode = parentVnode;
|
||||
@ -6770,7 +6953,7 @@ function updateChildComponent (
|
||||
updateComponentListeners(vm, listeners, oldListeners);
|
||||
|
||||
// resolve slots + force update if has children
|
||||
if (hasChildren) {
|
||||
if (needsForceUpdate) {
|
||||
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
||||
vm.$forceUpdate();
|
||||
}
|
||||
@ -6835,6 +7018,20 @@ function callHook (vm, hook) {
|
||||
|
||||
/* */
|
||||
|
||||
// Async edge case fix requires storing an event listener's attach timestamp.
|
||||
var getNow = Date.now;
|
||||
|
||||
// Determine what event timestamp the browser is using. Annoyingly, the
|
||||
// timestamp can either be hi-res ( relative to poge load) or low-res
|
||||
// (relative to UNIX epoch), so in order to compare time we have to use the
|
||||
// same timestamp type when saving the flush timestamp.
|
||||
if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
|
||||
// if the low-res timestamp which is bigger than the event timestamp
|
||||
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,
|
||||
// and we need to use the hi-res version for event listeners as well.
|
||||
getNow = function () { return performance.now(); };
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a kept-alive component that was activated during patch.
|
||||
* The queue will be processed after the entire tree has been patched.
|
||||
@ -7245,6 +7442,31 @@ function bindObjectListeners (data, value) {
|
||||
|
||||
/* */
|
||||
|
||||
function bindDynamicKeys (baseObj, values) {
|
||||
for (var i = 0; i < values.length; i += 2) {
|
||||
var key = values[i];
|
||||
if (typeof key === 'string' && key) {
|
||||
baseObj[values[i]] = values[i + 1];
|
||||
} else if (key !== '' && key !== null) {
|
||||
// null is a speical value for explicitly removing a binding
|
||||
warn(
|
||||
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
||||
this
|
||||
);
|
||||
}
|
||||
}
|
||||
return baseObj
|
||||
}
|
||||
|
||||
// helper to dynamically append modifier runtime markers to event names.
|
||||
// ensure only append when value is already string, otherwise it will be cast
|
||||
// to string and cause the type check to miss.
|
||||
function prependModifier (value, symbol) {
|
||||
return typeof value === 'string' ? symbol + value : value
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
function installRenderHelpers (target) {
|
||||
target._o = markOnce;
|
||||
target._n = toNumber;
|
||||
@ -7261,6 +7483,8 @@ function installRenderHelpers (target) {
|
||||
target._e = createEmptyVNode;
|
||||
target._u = resolveScopedSlots;
|
||||
target._g = bindObjectListeners;
|
||||
target._d = bindDynamicKeys;
|
||||
target._p = prependModifier;
|
||||
}
|
||||
|
||||
/* */
|
||||
@ -7277,7 +7501,7 @@ function normalizeScopedSlots (
|
||||
} else {
|
||||
res = {};
|
||||
for (var key in slots) {
|
||||
if (slots[key]) {
|
||||
if (slots[key] && key[0] !== '$') {
|
||||
res[key] = normalizeScopedSlot(slots[key]);
|
||||
}
|
||||
}
|
||||
@ -7289,6 +7513,7 @@ function normalizeScopedSlots (
|
||||
}
|
||||
}
|
||||
res._normalized = true;
|
||||
res.$stable = slots && slots.$stable;
|
||||
return res
|
||||
}
|
||||
|
||||
@ -7789,8 +8014,8 @@ var normalizeRender = function (vm) {
|
||||
}
|
||||
};
|
||||
|
||||
function waitForSsrPrefetch (vm, resolve, reject) {
|
||||
var handlers = vm.$options.ssrPrefetch;
|
||||
function waitForServerPrefetch (vm, resolve, reject) {
|
||||
var handlers = vm.$options.serverPrefetch;
|
||||
if (isDef(handlers)) {
|
||||
if (!Array.isArray(handlers)) { handlers = [handlers]; }
|
||||
try {
|
||||
@ -7946,7 +8171,7 @@ function renderComponentInner (node, isRoot, context) {
|
||||
|
||||
var reject = context.done;
|
||||
|
||||
waitForSsrPrefetch(child, resolve, reject);
|
||||
waitForServerPrefetch(child, resolve, reject);
|
||||
}
|
||||
|
||||
function renderAsyncComponent (node, isRoot, context) {
|
||||
@ -8178,7 +8403,7 @@ function createRenderFunction (
|
||||
var resolve = function () {
|
||||
renderNode(component._render(), true, context);
|
||||
};
|
||||
waitForSsrPrefetch(component, resolve, done);
|
||||
waitForServerPrefetch(component, resolve, done);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8397,8 +8622,12 @@ var TemplateRenderer = function TemplateRenderer (options) {
|
||||
this.inject = options.inject !== false;
|
||||
// if no template option is provided, the renderer is created
|
||||
// as a utility object for rendering assets like preload links and scripts.
|
||||
this.parsedTemplate = options.template
|
||||
? parseTemplate(options.template)
|
||||
|
||||
var template = options.template;
|
||||
this.parsedTemplate = template
|
||||
? typeof template === 'string'
|
||||
? parseTemplate(template)
|
||||
: template
|
||||
: null;
|
||||
|
||||
// function used to serialize initial state JSON
|
||||
@ -8431,12 +8660,17 @@ TemplateRenderer.prototype.bindRenderFns = function bindRenderFns (context) {
|
||||
};
|
||||
|
||||
// render synchronously given rendered app content and render context
|
||||
TemplateRenderer.prototype.renderSync = function renderSync (content, context) {
|
||||
TemplateRenderer.prototype.render = function render (content, context) {
|
||||
var template = this.parsedTemplate;
|
||||
if (!template) {
|
||||
throw new Error('renderSync cannot be called without a template.')
|
||||
throw new Error('render cannot be called without a template.')
|
||||
}
|
||||
context = context || {};
|
||||
|
||||
if (typeof template === 'function') {
|
||||
return template(content, context)
|
||||
}
|
||||
|
||||
if (this.inject) {
|
||||
return (
|
||||
template.head(context) +
|
||||
@ -8695,14 +8929,26 @@ function createRenderer (ref) {
|
||||
}, cb);
|
||||
try {
|
||||
render(component, write, context, function (err) {
|
||||
if (err) {
|
||||
return cb(err)
|
||||
}
|
||||
if (context && context.rendered) {
|
||||
context.rendered(context);
|
||||
}
|
||||
if (template) {
|
||||
result = templateRenderer.renderSync(result, context);
|
||||
}
|
||||
if (err) {
|
||||
cb(err);
|
||||
try {
|
||||
var res = templateRenderer.render(result, context);
|
||||
if (typeof res !== 'string') {
|
||||
// function template returning promise
|
||||
res
|
||||
.then(function (html) { return cb(null, html); })
|
||||
.catch(cb);
|
||||
} else {
|
||||
cb(null, res);
|
||||
}
|
||||
} catch (e) {
|
||||
cb(e);
|
||||
}
|
||||
} else {
|
||||
cb(null, result);
|
||||
}
|
||||
@ -8732,6 +8978,8 @@ function createRenderer (ref) {
|
||||
});
|
||||
}
|
||||
return renderStream
|
||||
} else if (typeof template === 'function') {
|
||||
throw new Error("function template is only supported in renderToString.")
|
||||
} else {
|
||||
var templateStream = templateRenderer.createStream(context);
|
||||
renderStream.on('error', function (err) {
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vue-server-renderer",
|
||||
"version": "2.6.0-beta.1",
|
||||
"version": "2.6.0-beta.2",
|
||||
"description": "server renderer for Vue 2.0",
|
||||
"main": "index.js",
|
||||
"types": "types/index.d.ts",
|
||||
|
@ -829,7 +829,7 @@
|
||||
'activated',
|
||||
'deactivated',
|
||||
'errorCaptured',
|
||||
'ssrPrefetch'
|
||||
'serverPrefetch'
|
||||
];
|
||||
|
||||
/* */
|
||||
@ -1915,13 +1915,16 @@
|
||||
: []
|
||||
}
|
||||
|
||||
function addProp (el, name, value, range) {
|
||||
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value }, range));
|
||||
function addProp (el, name, value, range, dynamic) {
|
||||
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
function addAttr (el, name, value, range) {
|
||||
(el.attrs || (el.attrs = [])).push(rangeSetItem({ name: name, value: value }, range));
|
||||
function addAttr (el, name, value, range, dynamic) {
|
||||
var attrs = dynamic
|
||||
? (el.dynamicAttrs || (el.dynamicAttrs = []))
|
||||
: (el.attrs || (el.attrs = []));
|
||||
attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
@ -1937,13 +1940,27 @@
|
||||
rawName,
|
||||
value,
|
||||
arg,
|
||||
isDynamicArg,
|
||||
modifiers,
|
||||
range
|
||||
) {
|
||||
(el.directives || (el.directives = [])).push(rangeSetItem({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers }, range));
|
||||
(el.directives || (el.directives = [])).push(rangeSetItem({
|
||||
name: name,
|
||||
rawName: rawName,
|
||||
value: value,
|
||||
arg: arg,
|
||||
isDynamicArg: isDynamicArg,
|
||||
modifiers: modifiers
|
||||
}, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
function prependModifierMarker (symbol, name, dynamic) {
|
||||
return dynamic
|
||||
? ("_p(" + name + ",\"" + symbol + "\")")
|
||||
: symbol + name // mark the event as captured
|
||||
}
|
||||
|
||||
function addHandler (
|
||||
el,
|
||||
name,
|
||||
@ -1951,7 +1968,8 @@
|
||||
modifiers,
|
||||
important,
|
||||
warn,
|
||||
range
|
||||
range,
|
||||
dynamic
|
||||
) {
|
||||
modifiers = modifiers || emptyObject;
|
||||
// warn prevent and passive modifier
|
||||
@ -1970,11 +1988,17 @@
|
||||
// normalize click.right and click.middle since they don't actually fire
|
||||
// this is technically browser-specific, but at least for now browsers are
|
||||
// the only target envs that have right/middle clicks.
|
||||
if (name === 'click') {
|
||||
if (modifiers.right) {
|
||||
if (modifiers.right) {
|
||||
if (dynamic) {
|
||||
name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
|
||||
} else if (name === 'click') {
|
||||
name = 'contextmenu';
|
||||
delete modifiers.right;
|
||||
} else if (modifiers.middle) {
|
||||
}
|
||||
} else if (modifiers.middle) {
|
||||
if (dynamic) {
|
||||
name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
|
||||
} else if (name === 'click') {
|
||||
name = 'mouseup';
|
||||
}
|
||||
}
|
||||
@ -1982,16 +2006,16 @@
|
||||
// check capture modifier
|
||||
if (modifiers.capture) {
|
||||
delete modifiers.capture;
|
||||
name = '!' + name; // mark the event as captured
|
||||
name = prependModifierMarker('!', name, dynamic);
|
||||
}
|
||||
if (modifiers.once) {
|
||||
delete modifiers.once;
|
||||
name = '~' + name; // mark the event as once
|
||||
name = prependModifierMarker('~', name, dynamic);
|
||||
}
|
||||
/* istanbul ignore if */
|
||||
if (modifiers.passive) {
|
||||
delete modifiers.passive;
|
||||
name = '&' + name; // mark the event as passive
|
||||
name = prependModifierMarker('&', name, dynamic);
|
||||
}
|
||||
|
||||
var events;
|
||||
@ -2002,7 +2026,7 @@
|
||||
events = el.events || (el.events = {});
|
||||
}
|
||||
|
||||
var newHandler = rangeSetItem({ value: value.trim() }, range);
|
||||
var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
||||
if (modifiers !== emptyObject) {
|
||||
newHandler.modifiers = modifiers;
|
||||
}
|
||||
@ -2072,6 +2096,20 @@
|
||||
return val
|
||||
}
|
||||
|
||||
function getAndRemoveAttrByRegex (
|
||||
el,
|
||||
name
|
||||
) {
|
||||
var list = el.attrsList;
|
||||
for (var i = 0, l = list.length; i < l; i++) {
|
||||
var attr = list[i];
|
||||
if (name.test(attr.name)) {
|
||||
list.splice(i, 1);
|
||||
return attr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function rangeSetItem (
|
||||
item,
|
||||
range
|
||||
@ -2690,12 +2728,15 @@
|
||||
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
||||
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
||||
var stripParensRE = /^\(|\)$/g;
|
||||
var dynamicArgRE = /^\[.*\]$/;
|
||||
|
||||
var argRE = /:(.*)$/;
|
||||
var bindRE = /^:|^\.|^v-bind:/;
|
||||
var propBindRE = /^\./;
|
||||
var modifierRE = /\.[^.]+/g;
|
||||
|
||||
var slotRE = /^v-slot(:|$)|^#/;
|
||||
|
||||
var lineBreakRE = /[\r\n]/;
|
||||
var whitespaceRE = /\s+/g;
|
||||
|
||||
@ -2710,6 +2751,7 @@
|
||||
var platformIsPreTag;
|
||||
var platformMustUseProp;
|
||||
var platformGetTagNamespace;
|
||||
var maybeComponent;
|
||||
|
||||
function createASTElement (
|
||||
tag,
|
||||
@ -2740,6 +2782,7 @@
|
||||
platformMustUseProp = options.mustUseProp || no;
|
||||
platformGetTagNamespace = options.getTagNamespace || no;
|
||||
var isReservedTag = options.isReservedTag || no;
|
||||
maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
||||
|
||||
transforms = pluckModuleFunction(options.modules, 'transformNode');
|
||||
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
||||
@ -3221,10 +3264,7 @@
|
||||
true
|
||||
);
|
||||
}
|
||||
el.slotScope = (
|
||||
slotScope ||
|
||||
getAndRemoveAttr(el, 'slot-scope')
|
||||
);
|
||||
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
||||
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
||||
/* istanbul ignore if */
|
||||
if (el.attrsMap['v-for']) {
|
||||
@ -3243,12 +3283,95 @@
|
||||
var slotTarget = getBindingAttr(el, 'slot');
|
||||
if (slotTarget) {
|
||||
el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
||||
el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
||||
// preserve slot as an attribute for native shadow DOM compat
|
||||
// only for non-scoped slots.
|
||||
if (el.tag !== 'template' && !el.slotScope) {
|
||||
addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
||||
}
|
||||
}
|
||||
|
||||
// 2.6 v-slot syntax
|
||||
{
|
||||
if (el.tag === 'template') {
|
||||
// v-slot on <template>
|
||||
var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
||||
if (slotBinding) {
|
||||
{
|
||||
if (el.slotTarget || el.slotScope) {
|
||||
warn$1(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
}
|
||||
var ref = getSlotName(slotBinding);
|
||||
var name = ref.name;
|
||||
var dynamic = ref.dynamic;
|
||||
el.slotTarget = name;
|
||||
el.slotTargetDynamic = dynamic;
|
||||
el.slotScope = slotBinding.value || "_"; // force it into a scoped slot for perf
|
||||
}
|
||||
} else {
|
||||
// v-slot on component, denotes default slot
|
||||
var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
|
||||
if (slotBinding$1) {
|
||||
{
|
||||
if (!maybeComponent(el)) {
|
||||
warn$1(
|
||||
"v-slot can only be used on components or <template>.",
|
||||
slotBinding$1
|
||||
);
|
||||
}
|
||||
if (el.slotScope || el.slotTarget) {
|
||||
warn$1(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
if (el.scopedSlots) {
|
||||
warn$1(
|
||||
"To avoid scope ambiguity, the default slot should also use " +
|
||||
"<template> syntax when there are other named slots.",
|
||||
slotBinding$1
|
||||
);
|
||||
}
|
||||
}
|
||||
// add the component's children to its default slot
|
||||
var slots = el.scopedSlots || (el.scopedSlots = {});
|
||||
var ref$1 = getSlotName(slotBinding$1);
|
||||
var name$1 = ref$1.name;
|
||||
var dynamic$1 = ref$1.dynamic;
|
||||
var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
||||
slotContainer.slotTargetDynamic = dynamic$1;
|
||||
slotContainer.children = el.children;
|
||||
slotContainer.slotScope = slotBinding$1.value || "_";
|
||||
// remove children as they are returned from scopedSlots now
|
||||
el.children = [];
|
||||
// mark el non-plain so data gets generated
|
||||
el.plain = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSlotName (binding) {
|
||||
var name = binding.name.replace(slotRE, '');
|
||||
if (!name) {
|
||||
if (binding.name[0] !== '#') {
|
||||
name = 'default';
|
||||
} else {
|
||||
warn$1(
|
||||
"v-slot shorthand syntax requires a slot name.",
|
||||
binding
|
||||
);
|
||||
}
|
||||
}
|
||||
return dynamicArgRE.test(name)
|
||||
// dynamic [name]
|
||||
? { name: name.slice(1, -1), dynamic: true }
|
||||
// static name
|
||||
: { name: ("\"" + name + "\""), dynamic: false }
|
||||
}
|
||||
|
||||
// handle <slot/> outlets
|
||||
@ -3278,7 +3401,7 @@
|
||||
|
||||
function processAttrs (el) {
|
||||
var list = el.attrsList;
|
||||
var i, l, name, rawName, value, modifiers, isProp, syncGen;
|
||||
var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
||||
for (i = 0, l = list.length; i < l; i++) {
|
||||
name = rawName = list[i].name;
|
||||
value = list[i].value;
|
||||
@ -3297,7 +3420,10 @@
|
||||
if (bindRE.test(name)) { // v-bind
|
||||
name = name.replace(bindRE, '');
|
||||
value = parseFilters(value);
|
||||
isProp = false;
|
||||
isDynamic = dynamicArgRE.test(name);
|
||||
if (isDynamic) {
|
||||
name = name.slice(1, -1);
|
||||
}
|
||||
if (
|
||||
value.trim().length === 0
|
||||
) {
|
||||
@ -3306,57 +3432,79 @@
|
||||
);
|
||||
}
|
||||
if (modifiers) {
|
||||
if (modifiers.prop) {
|
||||
isProp = true;
|
||||
if (modifiers.prop && !isDynamic) {
|
||||
name = camelize(name);
|
||||
if (name === 'innerHtml') { name = 'innerHTML'; }
|
||||
}
|
||||
if (modifiers.camel) {
|
||||
if (modifiers.camel && !isDynamic) {
|
||||
name = camelize(name);
|
||||
}
|
||||
if (modifiers.sync) {
|
||||
syncGen = genAssignmentCode(value, "$event");
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (camelize(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i]
|
||||
);
|
||||
if (hyphenate(name) !== camelize(name)) {
|
||||
if (!isDynamic) {
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (hyphenate(name))),
|
||||
("update:" + (camelize(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i]
|
||||
);
|
||||
if (hyphenate(name) !== camelize(name)) {
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (hyphenate(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// handler w/ dynamic event name
|
||||
addHandler(
|
||||
el,
|
||||
("\"update:\"+(" + name + ")"),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i],
|
||||
true // dynamic
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isProp || (
|
||||
if ((modifiers && modifiers.prop) || (
|
||||
!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
|
||||
)) {
|
||||
addProp(el, name, value, list[i]);
|
||||
addProp(el, name, value, list[i], isDynamic);
|
||||
} else {
|
||||
addAttr(el, name, value, list[i]);
|
||||
addAttr(el, name, value, list[i], isDynamic);
|
||||
}
|
||||
} else if (onRE.test(name)) { // v-on
|
||||
name = name.replace(onRE, '');
|
||||
addHandler(el, name, value, modifiers, false, warn$1, list[i]);
|
||||
isDynamic = dynamicArgRE.test(name);
|
||||
if (isDynamic) {
|
||||
name = name.slice(1, -1);
|
||||
}
|
||||
addHandler(el, name, value, modifiers, false, warn$1, list[i], isDynamic);
|
||||
} else { // normal directives
|
||||
name = name.replace(dirRE, '');
|
||||
// parse arg
|
||||
var argMatch = name.match(argRE);
|
||||
var arg = argMatch && argMatch[1];
|
||||
isDynamic = false;
|
||||
if (arg) {
|
||||
name = name.slice(0, -(arg.length + 1));
|
||||
if (dynamicArgRE.test(arg)) {
|
||||
arg = arg.slice(1, -1);
|
||||
isDynamic = true;
|
||||
}
|
||||
}
|
||||
addDirective(el, name, rawName, value, arg, modifiers, list[i]);
|
||||
addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
||||
if (name === 'model') {
|
||||
checkForAliasModel(el, value);
|
||||
}
|
||||
@ -3934,23 +4082,32 @@
|
||||
events,
|
||||
isNative
|
||||
) {
|
||||
var res = isNative ? 'nativeOn:{' : 'on:{';
|
||||
var prefix = isNative ? 'nativeOn:' : 'on:';
|
||||
var staticHandlers = "";
|
||||
var dynamicHandlers = "";
|
||||
for (var name in events) {
|
||||
res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
|
||||
var handlerCode = genHandler(events[name]);
|
||||
if (events[name] && events[name].dynamic) {
|
||||
dynamicHandlers += name + "," + handlerCode + ",";
|
||||
} else {
|
||||
staticHandlers += "\"" + name + "\":" + handlerCode + ",";
|
||||
}
|
||||
}
|
||||
staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
|
||||
if (dynamicHandlers) {
|
||||
return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
|
||||
} else {
|
||||
return prefix + staticHandlers
|
||||
}
|
||||
return res.slice(0, -1) + '}'
|
||||
}
|
||||
|
||||
function genHandler (
|
||||
name,
|
||||
handler
|
||||
) {
|
||||
function genHandler (handler) {
|
||||
if (!handler) {
|
||||
return 'function(){}'
|
||||
}
|
||||
|
||||
if (Array.isArray(handler)) {
|
||||
return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
|
||||
return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
|
||||
}
|
||||
|
||||
var isMethodPath = simplePathRE.test(handler.value);
|
||||
@ -4004,7 +4161,7 @@
|
||||
}
|
||||
|
||||
function genKeyFilter (keys) {
|
||||
return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
||||
return ("if(('keyCode' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
||||
}
|
||||
|
||||
function genFilterCode (key) {
|
||||
@ -4266,11 +4423,11 @@
|
||||
}
|
||||
// attributes
|
||||
if (el.attrs) {
|
||||
data += "attrs:{" + (genProps(el.attrs)) + "},";
|
||||
data += "attrs:" + (genProps(el.attrs)) + ",";
|
||||
}
|
||||
// DOM props
|
||||
if (el.props) {
|
||||
data += "domProps:{" + (genProps(el.props)) + "},";
|
||||
data += "domProps:" + (genProps(el.props)) + ",";
|
||||
}
|
||||
// event handlers
|
||||
if (el.events) {
|
||||
@ -4300,6 +4457,12 @@
|
||||
}
|
||||
}
|
||||
data = data.replace(/,$/, '') + '}';
|
||||
// v-bind dynamic argument wrap
|
||||
// v-bind with dynamic arguments must be applied using the same v-bind object
|
||||
// merge helper so that class/style/mustUseProp attrs are handled correctly.
|
||||
if (el.dynamicAttrs) {
|
||||
data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
|
||||
}
|
||||
// v-bind data wrap
|
||||
if (el.wrapData) {
|
||||
data = el.wrapData(data);
|
||||
@ -4328,7 +4491,7 @@
|
||||
}
|
||||
if (needRuntime) {
|
||||
hasRuntime = true;
|
||||
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
||||
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
||||
}
|
||||
}
|
||||
if (hasRuntime) {
|
||||
@ -4354,9 +4517,10 @@
|
||||
slots,
|
||||
state
|
||||
) {
|
||||
var hasDynamicKeys = Object.keys(slots).some(function (key) { return slots[key].slotTargetDynamic; });
|
||||
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
|
||||
return genScopedSlot(key, slots[key], state)
|
||||
}).join(',')) + "])")
|
||||
}).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
|
||||
}
|
||||
|
||||
function genScopedSlot (
|
||||
@ -4501,15 +4665,23 @@
|
||||
}
|
||||
|
||||
function genProps (props) {
|
||||
var res = '';
|
||||
var staticProps = "";
|
||||
var dynamicProps = "";
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var prop = props[i];
|
||||
/* istanbul ignore if */
|
||||
{
|
||||
res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
|
||||
var value = transformSpecialNewlines(prop.value);
|
||||
if (prop.dynamic) {
|
||||
dynamicProps += (prop.name) + "," + value + ",";
|
||||
} else {
|
||||
staticProps += "\"" + (prop.name) + "\":" + value + ",";
|
||||
}
|
||||
}
|
||||
return res.slice(0, -1)
|
||||
staticProps = "{" + (staticProps.slice(0, -1)) + "}";
|
||||
if (dynamicProps) {
|
||||
return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
|
||||
} else {
|
||||
return staticProps
|
||||
}
|
||||
}
|
||||
|
||||
// #3895, #4268
|
||||
|
@ -787,7 +787,7 @@ var LIFECYCLE_HOOKS = [
|
||||
'activated',
|
||||
'deactivated',
|
||||
'errorCaptured',
|
||||
'ssrPrefetch'
|
||||
'serverPrefetch'
|
||||
];
|
||||
|
||||
/* */
|
||||
@ -1880,13 +1880,16 @@ function pluckModuleFunction (
|
||||
: []
|
||||
}
|
||||
|
||||
function addProp (el, name, value, range) {
|
||||
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value }, range));
|
||||
function addProp (el, name, value, range, dynamic) {
|
||||
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
function addAttr (el, name, value, range) {
|
||||
(el.attrs || (el.attrs = [])).push(rangeSetItem({ name: name, value: value }, range));
|
||||
function addAttr (el, name, value, range, dynamic) {
|
||||
var attrs = dynamic
|
||||
? (el.dynamicAttrs || (el.dynamicAttrs = []))
|
||||
: (el.attrs || (el.attrs = []));
|
||||
attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
@ -1902,13 +1905,27 @@ function addDirective (
|
||||
rawName,
|
||||
value,
|
||||
arg,
|
||||
isDynamicArg,
|
||||
modifiers,
|
||||
range
|
||||
) {
|
||||
(el.directives || (el.directives = [])).push(rangeSetItem({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers }, range));
|
||||
(el.directives || (el.directives = [])).push(rangeSetItem({
|
||||
name: name,
|
||||
rawName: rawName,
|
||||
value: value,
|
||||
arg: arg,
|
||||
isDynamicArg: isDynamicArg,
|
||||
modifiers: modifiers
|
||||
}, range));
|
||||
el.plain = false;
|
||||
}
|
||||
|
||||
function prependModifierMarker (symbol, name, dynamic) {
|
||||
return dynamic
|
||||
? ("_p(" + name + ",\"" + symbol + "\")")
|
||||
: symbol + name // mark the event as captured
|
||||
}
|
||||
|
||||
function addHandler (
|
||||
el,
|
||||
name,
|
||||
@ -1916,7 +1933,8 @@ function addHandler (
|
||||
modifiers,
|
||||
important,
|
||||
warn,
|
||||
range
|
||||
range,
|
||||
dynamic
|
||||
) {
|
||||
modifiers = modifiers || emptyObject;
|
||||
// warn prevent and passive modifier
|
||||
@ -1935,11 +1953,17 @@ function addHandler (
|
||||
// normalize click.right and click.middle since they don't actually fire
|
||||
// this is technically browser-specific, but at least for now browsers are
|
||||
// the only target envs that have right/middle clicks.
|
||||
if (name === 'click') {
|
||||
if (modifiers.right) {
|
||||
if (modifiers.right) {
|
||||
if (dynamic) {
|
||||
name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
|
||||
} else if (name === 'click') {
|
||||
name = 'contextmenu';
|
||||
delete modifiers.right;
|
||||
} else if (modifiers.middle) {
|
||||
}
|
||||
} else if (modifiers.middle) {
|
||||
if (dynamic) {
|
||||
name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
|
||||
} else if (name === 'click') {
|
||||
name = 'mouseup';
|
||||
}
|
||||
}
|
||||
@ -1947,16 +1971,16 @@ function addHandler (
|
||||
// check capture modifier
|
||||
if (modifiers.capture) {
|
||||
delete modifiers.capture;
|
||||
name = '!' + name; // mark the event as captured
|
||||
name = prependModifierMarker('!', name, dynamic);
|
||||
}
|
||||
if (modifiers.once) {
|
||||
delete modifiers.once;
|
||||
name = '~' + name; // mark the event as once
|
||||
name = prependModifierMarker('~', name, dynamic);
|
||||
}
|
||||
/* istanbul ignore if */
|
||||
if (modifiers.passive) {
|
||||
delete modifiers.passive;
|
||||
name = '&' + name; // mark the event as passive
|
||||
name = prependModifierMarker('&', name, dynamic);
|
||||
}
|
||||
|
||||
var events;
|
||||
@ -1967,7 +1991,7 @@ function addHandler (
|
||||
events = el.events || (el.events = {});
|
||||
}
|
||||
|
||||
var newHandler = rangeSetItem({ value: value.trim() }, range);
|
||||
var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
||||
if (modifiers !== emptyObject) {
|
||||
newHandler.modifiers = modifiers;
|
||||
}
|
||||
@ -2324,13 +2348,14 @@ var dirRE = /^v-|^@|^:|^\./;
|
||||
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
||||
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
||||
var stripParensRE = /^\(|\)$/g;
|
||||
var dynamicArgRE = /^\[.*\]$/;
|
||||
|
||||
var argRE = /:(.*)$/;
|
||||
var bindRE = /^:|^\.|^v-bind:/;
|
||||
var propBindRE = /^\./;
|
||||
var modifierRE = /\.[^.]+/g;
|
||||
|
||||
var scopedSlotShorthandRE = /^:?\(.*\)$/;
|
||||
var slotRE = /^v-slot(:|$)|^#/;
|
||||
|
||||
var lineBreakRE = /[\r\n]/;
|
||||
var whitespaceRE = /\s+/g;
|
||||
@ -2859,27 +2884,7 @@ function processSlotContent (el) {
|
||||
true
|
||||
);
|
||||
}
|
||||
el.slotScope = (
|
||||
slotScope ||
|
||||
getAndRemoveAttr(el, 'slot-scope')
|
||||
);
|
||||
if (process.env.NEW_SLOT_SYNTAX) {
|
||||
// new in 2.6: slot-props and its shorthand works the same as slot-scope
|
||||
// when used on <template> containers
|
||||
el.slotScope = el.slotScope || getAndRemoveAttr(el, 'slot-props');
|
||||
// 2.6 shorthand syntax
|
||||
var shorthand = getAndRemoveAttrByRegex(el, scopedSlotShorthandRE);
|
||||
if (shorthand) {
|
||||
if (process.env.NODE_ENV !== 'production' && el.slotScope) {
|
||||
warn$1(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
el.slotTarget = getScopedSlotShorthandName(shorthand);
|
||||
el.slotScope = shorthand.value;
|
||||
}
|
||||
}
|
||||
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
||||
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
||||
/* istanbul ignore if */
|
||||
if (process.env.NODE_ENV !== 'production' && el.attrsMap['v-for']) {
|
||||
@ -2892,58 +2897,101 @@ function processSlotContent (el) {
|
||||
);
|
||||
}
|
||||
el.slotScope = slotScope;
|
||||
} else if (process.env.NEW_SLOT_SYNTAX) {
|
||||
// 2.6: slot-props on component, denotes default slot
|
||||
slotScope = getAndRemoveAttr(el, 'slot-props');
|
||||
var shorthand$1 = getAndRemoveAttrByRegex(el, scopedSlotShorthandRE);
|
||||
if (slotScope || shorthand$1) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!maybeComponent(el)) {
|
||||
warn$1(
|
||||
"slot-props cannot be used on non-component elements.",
|
||||
el.rawAttrsMap['slot-props'] || el.rawAttrsMap['()']
|
||||
);
|
||||
}
|
||||
if (slotScope && shorthand$1) {
|
||||
warn$1(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
}
|
||||
// add the component's children to its default slot
|
||||
var slots = el.scopedSlots || (el.scopedSlots = {});
|
||||
var target = shorthand$1 ? getScopedSlotShorthandName(shorthand$1) : "\"default\"";
|
||||
var slotContainer = slots[target] = createASTElement('template', [], el);
|
||||
slotContainer.children = el.children;
|
||||
slotContainer.slotScope = shorthand$1 ? shorthand$1.value : slotScope;
|
||||
// remove children as they are returned from scopedSlots now
|
||||
el.children = [];
|
||||
// mark el non-plain so data gets generated
|
||||
el.plain = false;
|
||||
}
|
||||
}
|
||||
|
||||
// slot="xxx"
|
||||
var slotTarget = getBindingAttr(el, 'slot');
|
||||
if (slotTarget) {
|
||||
el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
||||
el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
||||
// preserve slot as an attribute for native shadow DOM compat
|
||||
// only for non-scoped slots.
|
||||
if (el.tag !== 'template' && !el.slotScope) {
|
||||
addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
||||
}
|
||||
}
|
||||
|
||||
// 2.6 v-slot syntax
|
||||
if (process.env.NEW_SLOT_SYNTAX) {
|
||||
if (el.tag === 'template') {
|
||||
// v-slot on <template>
|
||||
var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
||||
if (slotBinding) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (el.slotTarget || el.slotScope) {
|
||||
warn$1(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
}
|
||||
var ref = getSlotName(slotBinding);
|
||||
var name = ref.name;
|
||||
var dynamic = ref.dynamic;
|
||||
el.slotTarget = name;
|
||||
el.slotTargetDynamic = dynamic;
|
||||
el.slotScope = slotBinding.value || "_"; // force it into a scoped slot for perf
|
||||
}
|
||||
} else {
|
||||
// v-slot on component, denotes default slot
|
||||
var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
|
||||
if (slotBinding$1) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!maybeComponent(el)) {
|
||||
warn$1(
|
||||
"v-slot can only be used on components or <template>.",
|
||||
slotBinding$1
|
||||
);
|
||||
}
|
||||
if (el.slotScope || el.slotTarget) {
|
||||
warn$1(
|
||||
"Unexpected mixed usage of different slot syntaxes.",
|
||||
el
|
||||
);
|
||||
}
|
||||
if (el.scopedSlots) {
|
||||
warn$1(
|
||||
"To avoid scope ambiguity, the default slot should also use " +
|
||||
"<template> syntax when there are other named slots.",
|
||||
slotBinding$1
|
||||
);
|
||||
}
|
||||
}
|
||||
// add the component's children to its default slot
|
||||
var slots = el.scopedSlots || (el.scopedSlots = {});
|
||||
var ref$1 = getSlotName(slotBinding$1);
|
||||
var name$1 = ref$1.name;
|
||||
var dynamic$1 = ref$1.dynamic;
|
||||
var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
||||
slotContainer.slotTargetDynamic = dynamic$1;
|
||||
slotContainer.children = el.children;
|
||||
slotContainer.slotScope = slotBinding$1.value || "_";
|
||||
// remove children as they are returned from scopedSlots now
|
||||
el.children = [];
|
||||
// mark el non-plain so data gets generated
|
||||
el.plain = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getScopedSlotShorthandName (ref) {
|
||||
var name = ref.name;
|
||||
|
||||
return name.charAt(0) === ':'
|
||||
// dynamic :(name)
|
||||
? name.slice(2, -1) || "\"default\""
|
||||
// static (name)
|
||||
: ("\"" + (name.slice(1, -1) || "default") + "\"")
|
||||
function getSlotName (binding) {
|
||||
var name = binding.name.replace(slotRE, '');
|
||||
if (!name) {
|
||||
if (binding.name[0] !== '#') {
|
||||
name = 'default';
|
||||
} else if (process.env.NODE_ENV !== 'production') {
|
||||
warn$1(
|
||||
"v-slot shorthand syntax requires a slot name.",
|
||||
binding
|
||||
);
|
||||
}
|
||||
}
|
||||
return dynamicArgRE.test(name)
|
||||
// dynamic [name]
|
||||
? { name: name.slice(1, -1), dynamic: true }
|
||||
// static name
|
||||
: { name: ("\"" + name + "\""), dynamic: false }
|
||||
}
|
||||
|
||||
// handle <slot/> outlets
|
||||
@ -2973,7 +3021,7 @@ function processComponent (el) {
|
||||
|
||||
function processAttrs (el) {
|
||||
var list = el.attrsList;
|
||||
var i, l, name, rawName, value, modifiers, isProp, syncGen;
|
||||
var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
||||
for (i = 0, l = list.length; i < l; i++) {
|
||||
name = rawName = list[i].name;
|
||||
value = list[i].value;
|
||||
@ -2992,7 +3040,10 @@ function processAttrs (el) {
|
||||
if (bindRE.test(name)) { // v-bind
|
||||
name = name.replace(bindRE, '');
|
||||
value = parseFilters(value);
|
||||
isProp = false;
|
||||
isDynamic = dynamicArgRE.test(name);
|
||||
if (isDynamic) {
|
||||
name = name.slice(1, -1);
|
||||
}
|
||||
if (
|
||||
process.env.NODE_ENV !== 'production' &&
|
||||
value.trim().length === 0
|
||||
@ -3002,57 +3053,79 @@ function processAttrs (el) {
|
||||
);
|
||||
}
|
||||
if (modifiers) {
|
||||
if (modifiers.prop) {
|
||||
isProp = true;
|
||||
if (modifiers.prop && !isDynamic) {
|
||||
name = camelize(name);
|
||||
if (name === 'innerHtml') { name = 'innerHTML'; }
|
||||
}
|
||||
if (modifiers.camel) {
|
||||
if (modifiers.camel && !isDynamic) {
|
||||
name = camelize(name);
|
||||
}
|
||||
if (modifiers.sync) {
|
||||
syncGen = genAssignmentCode(value, "$event");
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (camelize(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i]
|
||||
);
|
||||
if (hyphenate(name) !== camelize(name)) {
|
||||
if (!isDynamic) {
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (hyphenate(name))),
|
||||
("update:" + (camelize(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i]
|
||||
);
|
||||
if (hyphenate(name) !== camelize(name)) {
|
||||
addHandler(
|
||||
el,
|
||||
("update:" + (hyphenate(name))),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// handler w/ dynamic event name
|
||||
addHandler(
|
||||
el,
|
||||
("\"update:\"+(" + name + ")"),
|
||||
syncGen,
|
||||
null,
|
||||
false,
|
||||
warn$1,
|
||||
list[i],
|
||||
true // dynamic
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isProp || (
|
||||
if ((modifiers && modifiers.prop) || (
|
||||
!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
|
||||
)) {
|
||||
addProp(el, name, value, list[i]);
|
||||
addProp(el, name, value, list[i], isDynamic);
|
||||
} else {
|
||||
addAttr(el, name, value, list[i]);
|
||||
addAttr(el, name, value, list[i], isDynamic);
|
||||
}
|
||||
} else if (onRE.test(name)) { // v-on
|
||||
name = name.replace(onRE, '');
|
||||
addHandler(el, name, value, modifiers, false, warn$1, list[i]);
|
||||
isDynamic = dynamicArgRE.test(name);
|
||||
if (isDynamic) {
|
||||
name = name.slice(1, -1);
|
||||
}
|
||||
addHandler(el, name, value, modifiers, false, warn$1, list[i], isDynamic);
|
||||
} else { // normal directives
|
||||
name = name.replace(dirRE, '');
|
||||
// parse arg
|
||||
var argMatch = name.match(argRE);
|
||||
var arg = argMatch && argMatch[1];
|
||||
isDynamic = false;
|
||||
if (arg) {
|
||||
name = name.slice(0, -(arg.length + 1));
|
||||
if (dynamicArgRE.test(arg)) {
|
||||
arg = arg.slice(1, -1);
|
||||
isDynamic = true;
|
||||
}
|
||||
}
|
||||
addDirective(el, name, rawName, value, arg, modifiers, list[i]);
|
||||
addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
||||
if (process.env.NODE_ENV !== 'production' && name === 'model') {
|
||||
checkForAliasModel(el, value);
|
||||
}
|
||||
@ -3639,23 +3712,32 @@ function genHandlers (
|
||||
events,
|
||||
isNative
|
||||
) {
|
||||
var res = isNative ? 'nativeOn:{' : 'on:{';
|
||||
var prefix = isNative ? 'nativeOn:' : 'on:';
|
||||
var staticHandlers = "";
|
||||
var dynamicHandlers = "";
|
||||
for (var name in events) {
|
||||
res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
|
||||
var handlerCode = genHandler(events[name]);
|
||||
if (events[name] && events[name].dynamic) {
|
||||
dynamicHandlers += name + "," + handlerCode + ",";
|
||||
} else {
|
||||
staticHandlers += "\"" + name + "\":" + handlerCode + ",";
|
||||
}
|
||||
}
|
||||
staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
|
||||
if (dynamicHandlers) {
|
||||
return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
|
||||
} else {
|
||||
return prefix + staticHandlers
|
||||
}
|
||||
return res.slice(0, -1) + '}'
|
||||
}
|
||||
|
||||
function genHandler (
|
||||
name,
|
||||
handler
|
||||
) {
|
||||
function genHandler (handler) {
|
||||
if (!handler) {
|
||||
return 'function(){}'
|
||||
}
|
||||
|
||||
if (Array.isArray(handler)) {
|
||||
return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
|
||||
return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
|
||||
}
|
||||
|
||||
var isMethodPath = simplePathRE.test(handler.value);
|
||||
@ -3709,7 +3791,7 @@ function genHandler (
|
||||
}
|
||||
|
||||
function genKeyFilter (keys) {
|
||||
return ("if(!('button' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
||||
return ("if(('keyCode' in $event)&&" + (keys.map(genFilterCode).join('&&')) + ")return null;")
|
||||
}
|
||||
|
||||
function genFilterCode (key) {
|
||||
@ -3972,11 +4054,11 @@ function genData$2 (el, state) {
|
||||
}
|
||||
// attributes
|
||||
if (el.attrs) {
|
||||
data += "attrs:{" + (genProps(el.attrs)) + "},";
|
||||
data += "attrs:" + (genProps(el.attrs)) + ",";
|
||||
}
|
||||
// DOM props
|
||||
if (el.props) {
|
||||
data += "domProps:{" + (genProps(el.props)) + "},";
|
||||
data += "domProps:" + (genProps(el.props)) + ",";
|
||||
}
|
||||
// event handlers
|
||||
if (el.events) {
|
||||
@ -4006,6 +4088,12 @@ function genData$2 (el, state) {
|
||||
}
|
||||
}
|
||||
data = data.replace(/,$/, '') + '}';
|
||||
// v-bind dynamic argument wrap
|
||||
// v-bind with dynamic arguments must be applied using the same v-bind object
|
||||
// merge helper so that class/style/mustUseProp attrs are handled correctly.
|
||||
if (el.dynamicAttrs) {
|
||||
data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
|
||||
}
|
||||
// v-bind data wrap
|
||||
if (el.wrapData) {
|
||||
data = el.wrapData(data);
|
||||
@ -4034,7 +4122,7 @@ function genDirectives (el, state) {
|
||||
}
|
||||
if (needRuntime) {
|
||||
hasRuntime = true;
|
||||
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
||||
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
||||
}
|
||||
}
|
||||
if (hasRuntime) {
|
||||
@ -4062,9 +4150,10 @@ function genScopedSlots (
|
||||
slots,
|
||||
state
|
||||
) {
|
||||
var hasDynamicKeys = Object.keys(slots).some(function (key) { return slots[key].slotTargetDynamic; });
|
||||
return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
|
||||
return genScopedSlot(key, slots[key], state)
|
||||
}).join(',')) + "])")
|
||||
}).join(',')) + "]" + (hasDynamicKeys ? ",true" : "") + ")")
|
||||
}
|
||||
|
||||
function genScopedSlot (
|
||||
@ -4209,15 +4298,23 @@ function genComponent (
|
||||
}
|
||||
|
||||
function genProps (props) {
|
||||
var res = '';
|
||||
var staticProps = "";
|
||||
var dynamicProps = "";
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var prop = props[i];
|
||||
/* istanbul ignore if */
|
||||
{
|
||||
res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
|
||||
var value = transformSpecialNewlines(prop.value);
|
||||
if (prop.dynamic) {
|
||||
dynamicProps += (prop.name) + "," + value + ",";
|
||||
} else {
|
||||
staticProps += "\"" + (prop.name) + "\":" + value + ",";
|
||||
}
|
||||
}
|
||||
return res.slice(0, -1)
|
||||
staticProps = "{" + (staticProps.slice(0, -1)) + "}";
|
||||
if (dynamicProps) {
|
||||
return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
|
||||
} else {
|
||||
return staticProps
|
||||
}
|
||||
}
|
||||
|
||||
// #3895, #4268
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vue-template-compiler",
|
||||
"version": "2.6.0-beta.1",
|
||||
"version": "2.6.0-beta.2",
|
||||
"description": "template compiler for Vue 2.0",
|
||||
"main": "index.js",
|
||||
"unpkg": "browser.js",
|
||||
|
Loading…
Reference in New Issue
Block a user