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

287
Views
¿Cómo pasar valor a v-model con emit?

Estoy tratando de pasar el valor de un campo de selección al modelo v, pero el código solo funciona en un campo de texto v.

 <script> export default { name: 'FormSelect', props: { modelValue: { type: [String, Number], default: '', }, label: { type: String, default: '', }, items: { type: Array, }, }, model: { prop: 'modelValue', event: 'change', }, }; </script>
 <template> <div> <v-select :label="label" v-bind:value="modelValue" @input.native="$emit('change', $event.target.value)" :items="items" ></v-select> </div> </template>

 <template> <div class="form"> <v-flex xs10 sm8 md6 lg5> <v-card> <FormTitle /> <ModalFormMessage /> <v-form ref="form" class="d-flex flex-column"> <FormSelect v-model="vulnerabilities.vulnerability" label="Vulnerability" :items="items.vulnerability" /> <FormInputs v-model="vulnerabilities.evidence" label="Eevidence" type="file" /> <FormInputs v-model="vulnerabilities.solution" label="Solution" type="text" /> <FormBtns /> </v-form> </v-card> </v-flex> </div> </template>

En el campo de selección no devuelve el valor seleccionado, ¿cómo puedo hacer que el valor que selecciono se pase al modelo v en el componente secundario también?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Debe emitir un evento con input de nombre:

 @input="$emit('input', $event.target.value)"
about 4 years ago · Juan Pablo Isaza Report

0

lo resolvi de la siguiente manera

 methods: { changeSelect: function () { this.$emit('input', this.modelValue); }, },
 <template> <div> <v-select :label="label" @input="changeSelect()" v-model="modelValue" :items="items" ></v-select> <p>{{ modelValue }}</p> </div> </template>

about 4 years ago · Juan Pablo Isaza Report
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!