Repository navigation
Expand file tree
/
Copy pathtable.vue
More file actions
68 lines (61 loc) · 1.39 KB
/
Copy pathtable.vue
File metadata and controls
68 lines (61 loc) · 1.39 KB
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
61
62
63
64
65
66
67
68
<template>
<table class="layui-table" :lay-skin="skin" :lay-even="even" :lay-size="size">
<lay-table-colgroup :children="colgroup"></lay-table-colgroup>
<lay-table-header :children="header"></lay-table-header>
<tbody>
<lay-table-tr v-for="item in data" :children="tr" :data="item"></lay-table-tr>
<div style="display: none">
<slot></slot>
</div>
</tbody>
</table>
</template>
<script>
import LayTableColgroup from './table-colgroup'
import LayTableHeader from './table-header'
import LayTableTr from './table-tr'
import LayTableColumn from './table-column'
export default {
name: "LayTable",
components: {
LayTableColgroup,
LayTableHeader,
LayTableTr,
LayTableColumn
},
data() {
return {
children: [],
colgroup: [],
header: [],
tr: []
}
},
props: {
data: {
type: Array,
default() {
return []
}
},
skin: {
type: String
},
even: Boolean,
size: String
},
provide() {
return {
rootTable: this
};
},
mounted() {
this.children = this.$slots.default.map(o => o.child)
this.colgroup = this.children.filter(o => o.prop).map(o => o.width || '')
this.header = this.children.filter(o => o.prop).map(o => o.label || '')
this.tr = this.children.filter(o => o.prop)
}
}
</script>
<style scoped>
</style>