vue3函数式创建组件

51 阅读1分钟
import DragDataSource from "@/components/DragDataSource"

const ReturnNewCom1 = function (propsInfo, on, el) {
    console.log('propsInfo', propsInfo)
    const arr = [propsInfo, propsInfo]
    const child = (data) => {
        return h(DragDataSource, {
            data: data.propsInfo, style: data.style, ...on
        });
    }

    /*    const newComponent = h('div', {
            data: propsInfo.propsInfo,
            style: propsInfo.style,
            ...on
        })*/

    const newComponent = h('div', arr.map(c => {
        return child(c)
    }))


    return newComponent
// render(newComponent,el)
}
render(box, this.$refs.container)