MCPcopy Create free account
hub / github.com/didi/mpx / genVnodeTree

Function genVnodeTree

packages/core/src/dynamic/vnode/render.js:34–58  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

32 }
33
34 function genVnodeTree (node) {
35 if (node.type === 1) {
36 // wxs 模块不需要动态渲染
37 if (node.tag === 'wxs') {
38 return createEmptyNode()
39 } else if (node.for && !node.forProcessed) {
40 return genFor(node)
41 } else if (node.if && !node.ifProcessed) {
42 return genIf(node)
43 } else if (node.tag === 'slot') {
44 return genSlot(node)
45 } else {
46 const data = genData(node)
47 let children = genChildren(node)
48 // 运行时组件的子组件都通过 slots 属性传递,样式规则在当前组件内匹配后挂载
49 if (node.dynamic) {
50 data.slots = resolveSlot(children.map(item => genVnodeWithStaticCss(deepCloneNode(item))))
51 children = []
52 }
53 return createNode(node.tag, data, children)
54 }
55 } else if (node.type === 3) {
56 return genText(node)
57 }
58 }
59
60 function evalExps (exps) {
61 const interpreter = new Interpreter(contextScope)

Callers 5

_gFunction · 0.85
genNodeFunction · 0.85
genForFunction · 0.85
genIfFunction · 0.85
_genVnodeTreeFunction · 0.85

Calls 11

createEmptyNodeFunction · 0.85
genSlotFunction · 0.85
genDataFunction · 0.85
genChildrenFunction · 0.85
resolveSlotFunction · 0.85
genVnodeWithStaticCssFunction · 0.85
deepCloneNodeFunction · 0.85
createNodeFunction · 0.85
genTextFunction · 0.85
genForFunction · 0.70
genIfFunction · 0.70

Tested by

no test coverage detected