Skip to content

Commit

Permalink
feat(add): processText updte
Browse files Browse the repository at this point in the history
  • Loading branch information
gcclll committed Mar 26, 2021
1 parent c4feaf3 commit 636e870
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/runtime-core/src/index.ts
Expand Up @@ -32,7 +32,7 @@ export {
onBeforeUpdate,
onUpdated,
onBeforeUnmount,
onUnmount,
onUnmounted,
onRenderTracked,
onRenderTriggered,
onErrorCaptured
Expand Down
5 changes: 5 additions & 0 deletions packages/runtime-core/src/renderer.ts
Expand Up @@ -317,6 +317,7 @@ function baseCreateRenderer(
cloneNode: hostCloneNode,
createElement: hostCreateElement,
createText: hostCreateText,
setText: hostSetText,
setElementText: hostSetElementText,
nextSibling: hostNextSibling,
parentNode: hostParentNode
Expand Down Expand Up @@ -393,6 +394,10 @@ function baseCreateRenderer(
)
} else {
// has old vnode, need to diff
const el = (n2.el = n1.el!)
if (n2.children !== n1.children) {
hostSetText(el, n2.children as string)
}
}
}
// 4. TODO processCommentNode 处理注释节点
Expand Down

0 comments on commit 636e870

Please sign in to comment.