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

117
Views
¿Hay alguna manera de desestructurar los accesorios de vue para que no tenga que pasar cada uno de ellos?

En pocas palabras, tengo un componente

 <Device> v-for="device in devices" :key="device.name" :device="device" :name="device.name" :number="device.number" :type="device.type" :status="device.status" :plan="device.plan" :plan_price="device.plan_price" :health="device.health" </Device>

Luego los defino en la sección de accesorios del componente.

 props: { type: { type: String, default: "" }, number: { type: String, default: "" }, name: { type: String, default: ""}, plan: { type: String, default: "" }, plan_price: { type: String, default: "" }, status: { type: Number, default: 0 }, health: { type: Number, default: 0 }, },

Me pregunto si hay una forma de pasar :device="device" sin tener que pasar cada propiedad individual. También quería evitar tener que usar device.name device.property en la plantilla dentro del componente. ¡Gracias por los consejos!

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

0

Puede usar v-bind para lograr algún tipo de desestructuración de objetos para accesorios.

 <Device> v-for="device in devices" :key="device.id" v-bind="device" </Device>
 props: { type: { type: String, default: "" }, number: { type: String, default: "" }, name: { type: String, default: ""}, plan: { type: String, default: "" }, plan_price: { type: String, default: "" }, status: { type: Number, default: 0 }, health: { type: Number, default: 0 }, }

Demostración: https://stackblitz.com/edit/vue-jngtah?file=src/App.vue

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!