refactor: move

This commit is contained in:
xiaojunnuo
2021-02-08 00:21:36 +08:00
parent cfb1034450
commit 82f86d9556
150 changed files with 14691 additions and 2059 deletions
@@ -0,0 +1,33 @@
<script>
import { h, resolveComponent } from 'vue'
import _ from 'lodash-es'
export default {
name: 'component-render',
props: {
name: {
type: String,
default: 'a-input'
},
children: {
type: Array
},
on: {
type: Object
}
},
setup (props, context) {
const attrs = {
...context.$attrs
}
_.forEach(props.on, (value, key) => {
attrs[key] = value
if (typeof value === 'string') {
// eslint-disable-next-line no-eval
attrs[key] = eval(value)
}
})
const comp = resolveComponent(props.name)
return () => h(comp, context.$attrs, props.children)
}
}
</script>