(_attr, _slots)
| 1 | import { getTemplate, getSlotContent, getStringTypeAttr } from '@/components/template' |
| 2 | |
| 3 | var handle = function(_attr, _slots) { |
| 4 | //定义默认属性 |
| 5 | let attributes = { |
| 6 | }, |
| 7 | slots = {} |
| 8 | |
| 9 | //覆盖默认属性 |
| 10 | Object.assign(slots, _slots) |
| 11 | Object.assign(attributes, _attr) |
| 12 | |
| 13 | //根据组件不同需要做的不同操作 |
| 14 | |
| 15 | |
| 16 | //获取插槽模板内容 |
| 17 | var subContent = getSlotContent(slots) || ' ' |
| 18 | //设置当前组件的slot |
| 19 | if (attributes.slot && attributes.slot !== 'default') { |
| 20 | attributes.slot = { |
| 21 | type: 'text', |
| 22 | value: attributes.slot |
| 23 | } |
| 24 | } else { |
| 25 | attributes.slot = { |
| 26 | type: 'text', |
| 27 | value: '' |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | //字符串模板操作 |
| 32 | let stringAttr = getStringTypeAttr(attributes) |
| 33 | let template = `<br ${stringAttr}/>` |
| 34 | |
| 35 | return { template, attributes, slots } |
| 36 | } |
| 37 | export default handle |
nothing calls this directly
no test coverage detected