MCPcopy
hub / github.com/jaweii/Vue-Layout / getSlotContent

Function getSlotContent

src/components/template/index.js:45–67  ·  view source on GitHub ↗
(slots)

Source from the content-addressed store, hash-verified

43}
44
45var getSlotContent = function(slots) {
46 let inner = ''
47 let components = JSON.parse(JSON.stringify(_Vue.$store.state.components))
48 Object.keys(slots).forEach(slot => {
49 slots[slot].forEach(({ id }) => {
50 let component = components.find(component => component.info.id === id)
51 let children = []
52 Object.keys(component.slots).forEach(slot => {
53 component.slots[slot].forEach(item => children.push(item))
54 })
55
56 component.attributes.slot = component.slot //设置当前组件的slot ,getTemplate中根据这个属性设置模板的slot,不存在则不设置
57 component = getTemplate(component.info, component.attributes, component.slots)
58
59 //为嵌套的组件添加id属性 具备id属性 才能选中后属性视图内容变更
60 if (component.template.indexOf(`id="${id}"`) == -1)
61 component.template = component.template.replace(' ', ` id="${id}" `)
62
63 inner += component.template
64 })
65 })
66 return inner
67}
68var getStringTypeAttr = function(attributes) {
69
70 // value为空的不添加到模板中

Callers 15

handleFunction · 0.90
handleFunction · 0.90
handleFunction · 0.90
handleFunction · 0.90
handleFunction · 0.90
handleFunction · 0.90
handleFunction · 0.90
handleFunction · 0.90
handleFunction · 0.90
handleFunction · 0.90
handleFunction · 0.90
handleFunction · 0.90

Calls 1

getTemplateFunction · 0.85

Tested by

no test coverage detected