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

189
Views
Cómo integrar un componente secundario en un bucle y recuperar los valores del modelo v en vue3

Para crear un formulario genérico con componente padre/hijo, creo este archivo ts.

 model: "IUser", resource: 'users', fields: { firstname: { type: 'text', name: 'firstname', add: true, list: true, edit: true, label: 'Prenom', value: '' }, lastname: { type: 'text', name: 'lastname', add: true, list: true, edit: true, label: 'Nom', value: '' }, } }

Y llamé componentes secundarios a su padre

Componente principal

 <el-form :model="formData" :rules="rules" > <div v-for="(item, name, index) in models.fields" :key="index"> name:{{ item.name }} {{ index }} <Text v-if="item.type === 'text'" :label="item.label" v-model="values[index]" :ruleName= "item.name" /> </div> <button @click="SendData()"></button> </el-form>

componente hijo

 <div class="col-md-6 fv-row"> <label class="required fs-6 fw-bold mb-2" >{{label}}</label > <el-form-item :prop="ruleName"> <el-input v-model="input" @input="$emit(`update:${ruleName}`, input)" /> </el-form-item> </div>

pero no puedo tener los valores del modelo v del niño al padre. ¿Tienes solución?

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!