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
<script>
export default {
name: 'RenderCustomComponent',
/* eslint-disable */
props: {
/**
* @description v-model双向绑定的值
*/
value: {
required: true
},
/**
* @description 传入的组件名
*/
componentName: {
required: true
},
/**
* @description 传入的自定义参数
*/
props: {
default: null
},
/**
* @description 传入的行数据
*/
scope: {
default: null
},
handler: {
default: null
}
},
/* eslint-enable */
render(h) {
const self = this
const events = {}
if (self.handler) {
Object.keys(self.handler).forEach(x => {
events[x] = (e) => {
self.$emit(x, e)
}
})
}
events['changeData'] = function(event, a) {
self.$emit('input', event, a)
}
events['addSign'] = (addrow) => {
self.$emit('addSign', addrow)
}
events['clickRowFun'] = (item, scope) => {
self.$emit('clickRowFun', item, scope)
}
events['componentData'] = (addrow, val) => {
self.$emit('componentData', addrow, val)
}
return h(self.componentName, {
props: {
value: self.value,
scope: self.scope,
...self.props
},
on: events
})
}
}
</script>