渲染器renderer源码解析
# 概览
# 源码解析
function createRenderer(options){
return baseCreateRenderer(options)
}
function baseCreateRenderer(options,createHydrationFns){
const target = shared.getGlobalThis();
target.__VUE__ = true;
let isFlushing = false;
const render=(vnode,container,namespace)=>{
if(vnode == null){
if(container._vnode){
unmount(container._vnode,null,null,true)
}
}else{
patch(container._vnode||null,vnode,container,null,null,null,namespace)
}
container._vnode = vnode;
if(!isFlushing){
isFlushing = true;
flushPreFlushCbs();
flushPostFlushCbs();
isFlushing = false;
}
}
return {
render,
hydrate,
createApp:createAppAPI(render,hydrate)
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
编辑 (opens new window)
上次更新: 2025/09/22, 10:14:36