Skip to content

Commit

Permalink
fix(portal): fix portal placeholder text
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Feb 26, 2020
1 parent d52ffaa commit 4397528
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/runtime-core/src/components/Portal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ export const PortalImpl = {
pc: patchChildren,
pbc: patchBlockChildren,
m: move,
c: insertComment,
o: { querySelector, setElementText }
o: { insert, querySelector, setElementText, createComment }
}: RendererInternals
) {
const targetSelector = n2.props && n2.props.target
const { patchFlag, shapeFlag, children } = n2
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) {
warn(
`Current renderer does not support string target for Portals. ` +
Expand Down Expand Up @@ -61,6 +62,7 @@ export const PortalImpl = {
warn('Invalid Portal target on mount:', target, `(${typeof target})`)
}
} else {
n2.el = n1.el
// update content
const target = (n2.target = n1.target)!
if (patchFlag === PatchFlags.TEXT) {
Expand Down Expand Up @@ -106,8 +108,6 @@ export const PortalImpl = {
}
}
}
// insert an empty node as the placeholder for the portal
insertComment(n1, n2, container, anchor)
}
}

Expand Down

0 comments on commit 4397528

Please sign in to comment.