Passing data from dynamic components as an object to parent component The 2019 Stack Overflow Developer Survey Results Are InUpdate parent model from child component VueVue.js - How to properly watch for nested dataPass data from Component into RootPass data object from parent to child componentVue js dynamic data componentVue.js passing props to a child of dynamic componentVue.js Update child component data from within parentVue how to pass child and parent component data to methodVue.js Child Component emit data into an parent objectVue: How do I render a dynamic component based on parent data?

What do hard-Brexiteers want with respect to the Irish border?

Why doesn't shell automatically fix "useless use of cat"?

Can we generate random numbers using irrational numbers like π and e?

How to translate "being like"?

Pokemon Turn Based battle (Python)

Geography at the pixel level

Match Roman Numerals

Can a rogue use sneak attack with weapons that have the thrown property even if they are not thrown?

What is preventing me from simply constructing a hash that's lower than the current target?

Why couldn't they take pictures of a closer black hole?

Are spiders unable to hurt humans, especially very small spiders?

How much of the clove should I use when using big garlic heads?

What do these terms in Caesar's Gallic wars mean?

How do I free up internal storage if I don't have any apps downloaded?

What is this sharp, curved notch on my knife for?

"as much details as you can remember"

What to do when moving next to a bird sanctuary with a loosely-domesticated cat?

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

Output the Arecibo Message

How to notate time signature switching consistently every measure

For what reasons would an animal species NOT cross a *horizontal* land bridge?

What does Linus Torvalds mean when he says that Git "never ever" tracks a file?

What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?

APIPA and LAN Broadcast Domain



Passing data from dynamic components as an object to parent component



The 2019 Stack Overflow Developer Survey Results Are InUpdate parent model from child component VueVue.js - How to properly watch for nested dataPass data from Component into RootPass data object from parent to child componentVue js dynamic data componentVue.js passing props to a child of dynamic componentVue.js Update child component data from within parentVue how to pass child and parent component data to methodVue.js Child Component emit data into an parent objectVue: How do I render a dynamic component based on parent data?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I have created a form that dynamically renders a group of inputs so I can add and remove that group of inputs depending on how many the end-user needs.



Like this:



enter image description here



I render the "item" inputs using dynamic components:



<component v-for="itemRow in itemRows" :is="itemRow"></component>


The data for the parent looks like this:



components: 
ItemRow
,
data()
return
retailer: "",
items: [],
itemRows: ['ItemRow','ItemRow', 'ItemRow'],
date: new Date(),




And the child component:



data() {
return
description: '',
price: 0,
count: 0



So what I want to do is to make an object of the child data and pass that object to the items array in the parent. How can I make that happen?










share|improve this question






























    1















    I have created a form that dynamically renders a group of inputs so I can add and remove that group of inputs depending on how many the end-user needs.



    Like this:



    enter image description here



    I render the "item" inputs using dynamic components:



    <component v-for="itemRow in itemRows" :is="itemRow"></component>


    The data for the parent looks like this:



    components: 
    ItemRow
    ,
    data()
    return
    retailer: "",
    items: [],
    itemRows: ['ItemRow','ItemRow', 'ItemRow'],
    date: new Date(),




    And the child component:



    data() {
    return
    description: '',
    price: 0,
    count: 0



    So what I want to do is to make an object of the child data and pass that object to the items array in the parent. How can I make that happen?










    share|improve this question


























      1












      1








      1








      I have created a form that dynamically renders a group of inputs so I can add and remove that group of inputs depending on how many the end-user needs.



      Like this:



      enter image description here



      I render the "item" inputs using dynamic components:



      <component v-for="itemRow in itemRows" :is="itemRow"></component>


      The data for the parent looks like this:



      components: 
      ItemRow
      ,
      data()
      return
      retailer: "",
      items: [],
      itemRows: ['ItemRow','ItemRow', 'ItemRow'],
      date: new Date(),




      And the child component:



      data() {
      return
      description: '',
      price: 0,
      count: 0



      So what I want to do is to make an object of the child data and pass that object to the items array in the parent. How can I make that happen?










      share|improve this question
















      I have created a form that dynamically renders a group of inputs so I can add and remove that group of inputs depending on how many the end-user needs.



      Like this:



      enter image description here



      I render the "item" inputs using dynamic components:



      <component v-for="itemRow in itemRows" :is="itemRow"></component>


      The data for the parent looks like this:



      components: 
      ItemRow
      ,
      data()
      return
      retailer: "",
      items: [],
      itemRows: ['ItemRow','ItemRow', 'ItemRow'],
      date: new Date(),




      And the child component:



      data() {
      return
      description: '',
      price: 0,
      count: 0



      So what I want to do is to make an object of the child data and pass that object to the items array in the parent. How can I make that happen?







      vue.js






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 11:01









      Laura

      8619




      8619










      asked Mar 8 at 10:55









      EmanjoEmanjo

      83




      83






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Emit an event from the child.



          In the parent subscribe to that event



          <component v-for="itemRow in itemRows" :is="itemRow" @onChange="updateRow"></component>


          You'll also need to pass the index to the child so the parent knows from which element it's receiving the event



          <component v-for="(itemRow, index) in itemRows" :is="itemRow" :index="index" @onChange="updateRow"></component>


          This means that you need to define a prop on the child component(s).



          Remember to update the array using Vue.set/this.$set, otherwise you're array won't be reactive.






          share|improve this answer























          • From when do I emit in the child? Using watch to see when something changes in the data properties?

            – Emanjo
            Mar 8 at 12:29











          • This depends on your use case. You can either watch the data or register to an onchange event on the input fields and fire it from that handler. It all depends on your use case.

            – Radu Diță
            Mar 8 at 12:31











          • Thank you so much!

            – Emanjo
            Mar 8 at 12:59











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061721%2fpassing-data-from-dynamic-components-as-an-object-to-parent-component%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          Emit an event from the child.



          In the parent subscribe to that event



          <component v-for="itemRow in itemRows" :is="itemRow" @onChange="updateRow"></component>


          You'll also need to pass the index to the child so the parent knows from which element it's receiving the event



          <component v-for="(itemRow, index) in itemRows" :is="itemRow" :index="index" @onChange="updateRow"></component>


          This means that you need to define a prop on the child component(s).



          Remember to update the array using Vue.set/this.$set, otherwise you're array won't be reactive.






          share|improve this answer























          • From when do I emit in the child? Using watch to see when something changes in the data properties?

            – Emanjo
            Mar 8 at 12:29











          • This depends on your use case. You can either watch the data or register to an onchange event on the input fields and fire it from that handler. It all depends on your use case.

            – Radu Diță
            Mar 8 at 12:31











          • Thank you so much!

            – Emanjo
            Mar 8 at 12:59















          0














          Emit an event from the child.



          In the parent subscribe to that event



          <component v-for="itemRow in itemRows" :is="itemRow" @onChange="updateRow"></component>


          You'll also need to pass the index to the child so the parent knows from which element it's receiving the event



          <component v-for="(itemRow, index) in itemRows" :is="itemRow" :index="index" @onChange="updateRow"></component>


          This means that you need to define a prop on the child component(s).



          Remember to update the array using Vue.set/this.$set, otherwise you're array won't be reactive.






          share|improve this answer























          • From when do I emit in the child? Using watch to see when something changes in the data properties?

            – Emanjo
            Mar 8 at 12:29











          • This depends on your use case. You can either watch the data or register to an onchange event on the input fields and fire it from that handler. It all depends on your use case.

            – Radu Diță
            Mar 8 at 12:31











          • Thank you so much!

            – Emanjo
            Mar 8 at 12:59













          0












          0








          0







          Emit an event from the child.



          In the parent subscribe to that event



          <component v-for="itemRow in itemRows" :is="itemRow" @onChange="updateRow"></component>


          You'll also need to pass the index to the child so the parent knows from which element it's receiving the event



          <component v-for="(itemRow, index) in itemRows" :is="itemRow" :index="index" @onChange="updateRow"></component>


          This means that you need to define a prop on the child component(s).



          Remember to update the array using Vue.set/this.$set, otherwise you're array won't be reactive.






          share|improve this answer













          Emit an event from the child.



          In the parent subscribe to that event



          <component v-for="itemRow in itemRows" :is="itemRow" @onChange="updateRow"></component>


          You'll also need to pass the index to the child so the parent knows from which element it's receiving the event



          <component v-for="(itemRow, index) in itemRows" :is="itemRow" :index="index" @onChange="updateRow"></component>


          This means that you need to define a prop on the child component(s).



          Remember to update the array using Vue.set/this.$set, otherwise you're array won't be reactive.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 8 at 11:05









          Radu DițăRadu Diță

          4,33811321




          4,33811321












          • From when do I emit in the child? Using watch to see when something changes in the data properties?

            – Emanjo
            Mar 8 at 12:29











          • This depends on your use case. You can either watch the data or register to an onchange event on the input fields and fire it from that handler. It all depends on your use case.

            – Radu Diță
            Mar 8 at 12:31











          • Thank you so much!

            – Emanjo
            Mar 8 at 12:59

















          • From when do I emit in the child? Using watch to see when something changes in the data properties?

            – Emanjo
            Mar 8 at 12:29











          • This depends on your use case. You can either watch the data or register to an onchange event on the input fields and fire it from that handler. It all depends on your use case.

            – Radu Diță
            Mar 8 at 12:31











          • Thank you so much!

            – Emanjo
            Mar 8 at 12:59
















          From when do I emit in the child? Using watch to see when something changes in the data properties?

          – Emanjo
          Mar 8 at 12:29





          From when do I emit in the child? Using watch to see when something changes in the data properties?

          – Emanjo
          Mar 8 at 12:29













          This depends on your use case. You can either watch the data or register to an onchange event on the input fields and fire it from that handler. It all depends on your use case.

          – Radu Diță
          Mar 8 at 12:31





          This depends on your use case. You can either watch the data or register to an onchange event on the input fields and fire it from that handler. It all depends on your use case.

          – Radu Diță
          Mar 8 at 12:31













          Thank you so much!

          – Emanjo
          Mar 8 at 12:59





          Thank you so much!

          – Emanjo
          Mar 8 at 12:59



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061721%2fpassing-data-from-dynamic-components-as-an-object-to-parent-component%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

          Алба-Юлія

          Захаров Федір Захарович