提交 9016f7d5 编写于 作者: fxy060608's avatar fxy060608

chore: bump vue from 3.2.39 to 3.2.40

上级 a31dc465
......@@ -2723,7 +2723,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
const createHook = (lifecycle) => (hook, target = currentInstance) =>
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
(!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
injectHook(lifecycle, hook, target);
injectHook(lifecycle, (...args) => hook(...args), target);
const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
......@@ -2946,7 +2946,10 @@ function createSlots(slots, dynamicSlots) {
slots[slot.name] = slot.key
? (...args) => {
const res = slot.fn(...args);
res.key = slot.key;
// attach branch key so each conditional branch is considered a
// different fragment
if (res)
res.key = slot.key;
return res;
}
: slot.fn;
......@@ -4620,7 +4623,7 @@ function createHydrationFunctions(rendererInternals) {
const isFragmentStart = isComment(node) && node.data === '[';
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
const { type, ref, shapeFlag, patchFlag } = vnode;
const domType = node.nodeType;
let domType = node.nodeType;
vnode.el = node;
if (patchFlag === -2 /* PatchFlags.BAIL */) {
optimized = false;
......@@ -4661,10 +4664,12 @@ function createHydrationFunctions(rendererInternals) {
}
break;
case Static:
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ && domType !== 3 /* DOMNodeTypes.TEXT */) {
nextNode = onMismatch();
if (isFragmentStart) {
// entire template is static but SSRed as a fragment
node = nextSibling(node);
domType = node.nodeType;
}
else {
if (domType === 1 /* DOMNodeTypes.ELEMENT */ || domType === 3 /* DOMNodeTypes.TEXT */) {
// determine anchor, adopt content
nextNode = node;
// if the static vnode has its content stripped during build,
......@@ -4681,7 +4686,10 @@ function createHydrationFunctions(rendererInternals) {
}
nextNode = nextSibling(nextNode);
}
return nextNode;
return isFragmentStart ? nextSibling(nextNode) : nextNode;
}
else {
onMismatch();
}
break;
case Fragment:
......@@ -5040,7 +5048,7 @@ function baseCreateRenderer(options, createHydrationFns) {
setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
}
const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, forcePatchProp: hostForcePatchProp, // fixed by xxxxxx
createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP, cloneNode: hostCloneNode, insertStaticContent: hostInsertStaticContent } = options;
createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP, insertStaticContent: hostInsertStaticContent } = options;
// Note: functions inside this closure should use `const xxx = () => {}`
// style in order to prevent being inlined by minifiers.
const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = (process.env.NODE_ENV !== 'production') && isHmrUpdating ? false : !!n2.dynamicChildren) => {
......@@ -5167,61 +5175,49 @@ function baseCreateRenderer(options, createHydrationFns) {
const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
let el;
let vnodeHook;
const { type, props, shapeFlag, transition, patchFlag, dirs } = vnode;
if (!(process.env.NODE_ENV !== 'production') &&
vnode.el &&
hostCloneNode !== undefined &&
patchFlag === -1 /* PatchFlags.HOISTED */) {
// If a vnode has non-null el, it means it's being reused.
// Only static vnodes can be reused, so its mounted DOM nodes should be
// exactly the same, and we can simply do a clone here.
// only do this in production since cloned trees cannot be HMR updated.
el = vnode.el = hostCloneNode(vnode.el);
const { type, props, shapeFlag, transition, dirs } = vnode;
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
// mount children first, since some props may rely on child content
// being already rendered, e.g. `<select value>`
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
hostSetElementText(el, vnode.children);
}
else {
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
// mount children first, since some props may rely on child content
// being already rendered, e.g. `<select value>`
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
hostSetElementText(el, vnode.children);
}
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
}
if (dirs) {
invokeDirectiveHook(vnode, null, parentComponent, 'created');
}
// props
if (props) {
for (const key in props) {
if (key !== 'value' && !isReservedProp(key)) {
hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren,
// fixed by xxxxxx
vnode.hostInstance);
}
}
/**
* Special case for setting value on DOM elements:
* - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
* - it needs to be forced (#1471)
* #2353 proposes adding another renderer option to configure this, but
* the properties affects are so finite it is worth special casing it
* here to reduce the complexity. (Special casing it also should not
* affect non-DOM renderers)
*/
if ('value' in props) {
// fixed by xxxxxx
hostPatchProp(el, 'value', null, props.value, false, [], parentComponent, null, undefined,
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
}
if (dirs) {
invokeDirectiveHook(vnode, null, parentComponent, 'created');
}
// props
if (props) {
for (const key in props) {
if (key !== 'value' && !isReservedProp(key)) {
hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren,
// fixed by xxxxxx
vnode.hostInstance);
}
if ((vnodeHook = props.onVnodeBeforeMount)) {
invokeVNodeHook(vnodeHook, parentComponent, vnode);
}
}
// scopeId
setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
/**
* Special case for setting value on DOM elements:
* - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
* - it needs to be forced (#1471)
* #2353 proposes adding another renderer option to configure this, but
* the properties affects are so finite it is worth special casing it
* here to reduce the complexity. (Special casing it also should not
* affect non-DOM renderers)
*/
if ('value' in props) {
// fixed by xxxxxx
hostPatchProp(el, 'value', null, props.value, false, [], parentComponent, null, undefined,
// fixed by xxxxxx
vnode.hostInstance);
}
if ((vnodeHook = props.onVnodeBeforeMount)) {
invokeVNodeHook(vnodeHook, parentComponent, vnode);
}
}
// scopeId
setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
Object.defineProperty(el, '__vnode', {
value: vnode,
......@@ -5419,6 +5415,15 @@ function baseCreateRenderer(options, createHydrationFns) {
};
const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
if (oldProps !== newProps) {
if (oldProps !== EMPTY_OBJ) {
for (const key in oldProps) {
if (!isReservedProp(key) && !(key in newProps)) {
hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren,
// fixed by xxxxxx
vnode.hostInstance);
}
}
}
for (const key in newProps) {
// empty string is not valid prop
if (isReservedProp(key))
......@@ -5434,15 +5439,6 @@ function baseCreateRenderer(options, createHydrationFns) {
vnode.hostInstance);
}
}
if (oldProps !== EMPTY_OBJ) {
for (const key in oldProps) {
if (!isReservedProp(key) && !(key in newProps)) {
hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren,
// fixed by xxxxxx
vnode.hostInstance);
}
}
}
if ('value' in newProps) {
// fixed by xxxxxx
hostPatchProp(el, 'value', oldProps.value, newProps.value, false, [], parentComponent, null, undefined,
......@@ -6980,7 +6976,10 @@ function normalizeVNode(child) {
}
// optimized normalization for template-compiled render fns
function cloneIfMounted(child) {
return child.el === null || child.memo ? child : cloneVNode(child);
return (child.el === null && child.patchFlag !== -1 /* PatchFlags.HOISTED */) ||
child.memo
? child
: cloneVNode(child);
}
function normalizeChildren(vnode, children) {
let type = 0;
......@@ -7906,7 +7905,7 @@ function isMemoSame(cached, memo) {
}
// Core API ------------------------------------------------------------------
const version = "3.2.39";
const version = "3.2.40";
/**
* @internal only exposed in compat builds
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册