GithubHelp home page GithubHelp logo

Comments (3)

GavinZhuLei avatar GavinZhuLei commented on July 22, 2024

@Sailiy 对的,目前的问题就是在组件逐渐增加的时候会持续在v-for中添加组件,暂时没有想到更好的解决办法,有好的想法可以一起交流

from vue-form-making.

Sailiy avatar Sailiy commented on July 22, 2024

你们可以考虑使用render方法,只要组件在全局或者局部注册过的输入组件名都能被渲染出来
我这里的拖动是自己写的,还有一些小问题,
官方文档:https://cn.vuejs.org/v2/guide/render-function.html
主要代码文件:https://github.com/Sailiy/vv-form-design/blob/master/src/views/Editor/EditMain.vue

render: function (h) { // h 为 createElement 函数,接受三个参数 return h('el-form', { props: { labelWidth: '80px' }, nativeOn: { dragover: this.handleOnRootDragOver, drop: this.handleOnRootDrop }, ref: 'FForm' }, this.allComponents.map((component, index) => { if (!component.hasOwnProperty('isActive')) this.$set(component, 'isActive', false) return h(component.name, { directives: [ { name: 'masking' } ], attrs: { 'data-index': index, draggable: true }, class: { active: component.isActive }, nativeOn: { click: (e) => { this.handleItemClick(e, index) }, dragstart: this.childrenDragStart }, ref: 'formItem' + index }) })) }

from vue-form-making.

GavinZhuLei avatar GavinZhuLei commented on July 22, 2024

后面可以考虑使用render

from vue-form-making.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.