Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

256
Views
How to programmatically cut and paste Vue component with all data and methods

I have zone that contain a lot of elements.
This elements generated with Vue.compile( ) and creating new instance:

const instance = Vue.extend(resizableBox);
let completeElem = new instance (
        {
          propsData: {
            ...
          },
          parent: this,
          store
        }
    );

    let compiledHTML = Vue.compile(this.html); // some html string

    completeElem.$slots.innerNode = [completeElem.$createElement(compiledHTML)];
    completeElem.$mount('.replaceMe');

Generated HTML:

<div class="zone">
    <div class="resizer" style="left: 0px; top: 20px">
        <div class="handlers">...</div>
        <div class="textNode">
            <span>IT'S TEXT</span>
        </div>
    </div>
</div>

I need to cut generated node with all methods and data in. And then paste it in different place.
I can't use render func, because all my elements are movable (in zone bounds) and i can spawn new from list (with drag&drop api).
I can't recreate new instance for every move, because i need writed data

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!