Create a new instance of vue-moveable

Viewed 108

want to create a new instance of vue-moveable whenever I drop an element on a certain div. Below is a screenshot of my code. https://user-images.githubusercontent.com/20570511/103152952-2a441d80-478d-11eb-98bc-9850d420353c.png

var ComponentClass = Vue.extend(Moveable)
    var instance = new ComponentClass({
      propsData: {
        moveable: this.moveable,
      }
    })
  instance.ondrag = this.handleDrag;
  instance.onresize = this.handleResize;
  instance.onScale = this.handleScale;
  instance.onRotate = this.handleRotate;
  instance.onWarp = this.handleWarp;
  instance.onPinch = this.handlePinch;
  instance.$slots.default = ['Sample Text Goes Here']
  instance.$mount() // pass nothing
  this.$refs.page.appendChild(instance.$el)

Vue-moveable repo: https://github.com/probil/vue-moveable

The code by the left is the actual code I wrote for creating a new instance of vue-moveable. Any help on how to get around this would be helpful.

https://user-images.githubusercontent.com/20570511/103153046-d6860400-478d-11eb-8753-3620170f1fe1.png

Green Circle is for the hardcoded vue-moveable, Red Circle is for the dynamic vue-moveable.

0 Answers
Related