search

Home  >  Q&A  >  body text

javascript - vue2.0 dynamically loads multiple identical components, enters different values ​​into the data in the components, and when closing the non-last component, the value destroyed is the last component value.

vue2.0 dynamically loads multiple identical components, enters different values ​​into the data in the components, and when closing the non-last component, the value destroyed is the last component value.

Component loading method:
component is an array. Get the component to be rendered through a custom event and push it into the component.
<component :is='component[index].component' :params='component[index].params'/>

Close the component:
this.component.splice(i,1);

黄舟黄舟2697 days ago1395

reply all(1)I'll reply

  • 世界只因有你

    世界只因有你2017-07-05 11:02:36

    this.component.splice(i,1);
    After destroying the first one, the second one becomes the first one and the third one becomes the second one

    reply
    0
  • Cancelreply