0

I have a form which is built using custom components which is available for us to use. NOTE: I do not have access to the custom components , adding @input solution will not work for me. Is there any way i can get value from my custom components without making change in the component?

  <section class="container__content">
   <div>Details</div>
      <div class="personal-info">
        <textfield type="text" label="Name" placeholder="Shweta"></textfield>
         <textfield type="text" label="ID" placeholder="sm1234"></textfield>
       </div>

Shweta
  • 305
  • 1
  • 3
  • 17

1 Answers1

0

If i understand you properly you need the $refs object. [https://v2.vuejs.org/v2/guide/components-edge-cases.html#Accessing-Child-Component-Instances-amp-Child-Elements][1] [1]: https://v2.vuejs.org/v2/guide/components-edge-cases.html#Accessing-Child-Component-Instances-amp-Child-Elements

basic code example:

<template>
<child ref="childA"></child>
<child ref="otherCHild></child>
</template>

this.$refs.childA.something
this.$refs.otherCHild.something

the two $refs variables will be the the value that is contained in the something variable in their respective children.

I use this in the utils libraries to keep an eye on changes that i want to trigger actions in the parent (like watching for upload completions or errors)

tony19
  • 125,647
  • 18
  • 229
  • 307
Goofballtech
  • 868
  • 8
  • 10