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

Function handle

src/components/template/Common/Br.js:3–36  ·  view source on GitHub ↗
(_attr, _slots)

Source from the content-addressed store, hash-verified

1import { getTemplate, getSlotContent, getStringTypeAttr } from '@/components/template'
2
3var 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}
37export default handle

Callers

nothing calls this directly

Calls 2

getSlotContentFunction · 0.90
getStringTypeAttrFunction · 0.90

Tested by

no test coverage detected