(slots)
| 43 | } |
| 44 | |
| 45 | var 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 | } |
| 68 | var getStringTypeAttr = function(attributes) { |
| 69 | |
| 70 | // value为空的不添加到模板中 |
no test coverage detected