fix(portal): fix portal placeholder text
This commit is contained in:
parent
d52ffaa202
commit
439752822c
@ -27,13 +27,14 @@ export const PortalImpl = {
|
|||||||
pc: patchChildren,
|
pc: patchChildren,
|
||||||
pbc: patchBlockChildren,
|
pbc: patchBlockChildren,
|
||||||
m: move,
|
m: move,
|
||||||
c: insertComment,
|
o: { insert, querySelector, setElementText, createComment }
|
||||||
o: { querySelector, setElementText }
|
|
||||||
}: RendererInternals
|
}: RendererInternals
|
||||||
) {
|
) {
|
||||||
const targetSelector = n2.props && n2.props.target
|
const targetSelector = n2.props && n2.props.target
|
||||||
const { patchFlag, shapeFlag, children } = n2
|
const { patchFlag, shapeFlag, children } = n2
|
||||||
if (n1 == null) {
|
if (n1 == null) {
|
||||||
|
// insert an empty node as the placeholder for the portal
|
||||||
|
insert((n2.el = createComment(`portal`)), container, anchor)
|
||||||
if (__DEV__ && isString(targetSelector) && !querySelector) {
|
if (__DEV__ && isString(targetSelector) && !querySelector) {
|
||||||
warn(
|
warn(
|
||||||
`Current renderer does not support string target for Portals. ` +
|
`Current renderer does not support string target for Portals. ` +
|
||||||
@ -61,6 +62,7 @@ export const PortalImpl = {
|
|||||||
warn('Invalid Portal target on mount:', target, `(${typeof target})`)
|
warn('Invalid Portal target on mount:', target, `(${typeof target})`)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
n2.el = n1.el
|
||||||
// update content
|
// update content
|
||||||
const target = (n2.target = n1.target)!
|
const target = (n2.target = n1.target)!
|
||||||
if (patchFlag === PatchFlags.TEXT) {
|
if (patchFlag === PatchFlags.TEXT) {
|
||||||
@ -106,8 +108,6 @@ export const PortalImpl = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// insert an empty node as the placeholder for the portal
|
|
||||||
insertComment(n1, n2, container, anchor)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user