index.vue
825 Bytes
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
<script>
export default {
name: 'SchemaTable',
props: {
value: {
type: Array,
default() {
return [];
},
},
schema: {
required: true,
type: Object,
default() {
return {};
},
},
size: String,
},
data() {
return {
model: this.value,
};
},
watch: {
value(val = []) {
this.model = val;
},
model: {
handler(val) {
this.$emit('input', val);
},
deep: true,
},
},
render(h) {
const schema = this.schema || {};
const _props = schema.props || {};
const _on = schema.on || this.$listeners || {};
return h('eagle-table', { props: { value: this.model, size: this.size, columns: schema.items, ..._props }, on: _on, scopedSlots: this.$scopedSlots });
},
};
</script>