You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
839 B
42 lines
839 B
<template>
|
|
<component :is="getComponent(item.type)" v-bind="getBindData(item)" v-model="obverseValue"
|
|
v-on="resolveListeners(item.ons)" :_config="item" />
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
|
name: 'Proxy',
|
|
inject: ['getComponent', 'getBindData', "getFormData", 'parent'],
|
|
props: {
|
|
value: {},
|
|
item: Object
|
|
},
|
|
computed: {
|
|
obverseValue: {
|
|
get() {
|
|
return this.value
|
|
},
|
|
set(value) {
|
|
this.$emit("update:value", value)
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
resolveListeners(callbacks) {
|
|
if (!callbacks) return;
|
|
|
|
const result = {};
|
|
|
|
for (const key in callbacks) {
|
|
result[key] = (...args) => callbacks[key](...args, {
|
|
data: this.getFormData(),
|
|
formList: this.parent.formList
|
|
})
|
|
}
|
|
|
|
return result
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|