Skip to content

Commit f0914e4

Browse files
author
lishiwen
committed
refactor: more appropriate naming for vnode
1 parent 647545e commit f0914e4

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

lib/m-vue.cjs.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ function processElement(vnode, container) {
9393
function processComponent(vnode, container) {
9494
mountComponent(vnode, container);
9595
}
96-
function mountComponent(vnode, container) {
97-
const instance = createComponentInstance(vnode);
96+
function mountComponent(initialVNode, container) {
97+
const instance = createComponentInstance(initialVNode);
9898
setupComponent(instance);
99-
setupRenderEffect(instance, container, vnode);
99+
setupRenderEffect(instance, container, initialVNode);
100100
}
101101
function mountElement(vnode, container) {
102102
// vnode type -> div/span
@@ -126,10 +126,10 @@ function addAttrs(vnode, container) {
126126
}
127127
}
128128
}
129-
function setupRenderEffect(instance, container, vnode) {
129+
function setupRenderEffect(instance, container, initialVNode) {
130130
const subTree = instance.render.call(instance.proxy);
131131
patch(subTree, container);
132-
vnode.el = subTree.el;
132+
initialVNode.el = subTree.el;
133133
}
134134

135135
function createApp(rootComponent) {

lib/m-vue.esm.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ function processElement(vnode, container) {
8989
function processComponent(vnode, container) {
9090
mountComponent(vnode, container);
9191
}
92-
function mountComponent(vnode, container) {
93-
const instance = createComponentInstance(vnode);
92+
function mountComponent(initialVNode, container) {
93+
const instance = createComponentInstance(initialVNode);
9494
setupComponent(instance);
95-
setupRenderEffect(instance, container, vnode);
95+
setupRenderEffect(instance, container, initialVNode);
9696
}
9797
function mountElement(vnode, container) {
9898
// vnode type -> div/span
@@ -122,10 +122,10 @@ function addAttrs(vnode, container) {
122122
}
123123
}
124124
}
125-
function setupRenderEffect(instance, container, vnode) {
125+
function setupRenderEffect(instance, container, initialVNode) {
126126
const subTree = instance.render.call(instance.proxy);
127127
patch(subTree, container);
128-
vnode.el = subTree.el;
128+
initialVNode.el = subTree.el;
129129
}
130130

131131
function createApp(rootComponent) {

src/runtime-core/render.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ function processComponent(vnode, container) {
2323
mountComponent(vnode, container);
2424
}
2525

26-
function mountComponent(vnode, container) {
27-
const instance = createComponentInstance(vnode);
26+
function mountComponent(initialVNode, container) {
27+
const instance = createComponentInstance(initialVNode);
2828
setupComponent(instance);
29-
setupRenderEffect(instance, container, vnode);
29+
setupRenderEffect(instance, container, initialVNode);
3030
}
3131

3232
function mountElement(vnode: any, container: any) {
@@ -62,9 +62,9 @@ function addAttrs(vnode, container) {
6262
}
6363
}
6464

65-
function setupRenderEffect(instance, container, vnode) {
65+
function setupRenderEffect(instance, container, initialVNode) {
6666
const subTree = instance.render.call(instance.proxy);
6767
patch(subTree, container);
6868

69-
vnode.el = subTree.el;
69+
initialVNode.el = subTree.el;
7070
}

0 commit comments

Comments
 (0)