-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdialogbox.vue
60 lines (54 loc) · 2.03 KB
/
dialogbox.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!--<template>-->
<!--<div v-show="show" class="vmc-dialog-wrapper">-->
<!--<overlay></overlay>-->
<!--<div class="vmc-dialog">-->
<!--<div class="dialog-head" v-child:header></div>-->
<!--<div class="dialog-body vmc-1px-top" v-child:content></div>-->
<!--<div class="dialog-foot vmc-1px-top" v-child:footer></div>-->
<!--</div>-->
<!--</div>-->
<!--</template>-->
<script type="text/jsx">
import Overlay from '../overlay';
export default {
props: {
show: Boolean
},
render(h) {
var children = {
header: null,
content: null,
footer: null
};
var className = {
header: 'dialog-head',
content: 'dialog-body vmc-1px-top',
footer: 'dialog-foot vmc-1px-top'
};
var slots = this.$slots.default;
if (slots && slots.length) {
slots.forEach(vNode => {
var name = vNode.data && vNode.data.attrs && vNode.data.attrs.name;
if (name && children[name] !== undefined) {
var data = vNode.data;
var staticClass = data.staticClass;
staticClass = staticClass ? ' ' + staticClass : '';
staticClass = className[name] + staticClass;
data = Object.assign({}, data, { staticClass });
children[name] = h(vNode.tag, data, vNode.children);
}
});
}
return (
<div class="vmc-dialog-wrapper" v-show={this.show}>
<Overlay></Overlay>
<div class="vmc-dialog">
{children.header}
{children.content}
{children.footer}
</div>
</div>
);
}
}
</script>