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

146
Views
Vue: la propiedad calculada creada dinámicamente no se encuentra en la actualización de la página

Tengo estas propiedades calculadas en un componente:

 computed: { messageText: { get() { return this.getMessageProp('messageText') // Maps to a vuex getter }, set(value) { this.setMessageProp(['messageText', value]) // Maps to a vuex mutation } }, location: { get() { return this.getMessageProp('location') }, set(value) { this.setMessageProp(['location', value]) } } }

Esto funciona en la actualización del navegador. Como puede ver es un poco repetitivo (Hay algunos más en otros componentes).

Traté de crearlos dinámicamente así:

 data() { return { stepProps: { messageText: {}, location: {}, } } }, created() { Object.keys(this.stepProps).forEach((key) => { if (!this.$options.computed[key]) { this.$options.computed[key] = { get() { return this.getMessageProp(key) }, set(value) { this.setMessageProp([key, value]) } } } }) }

Pero no funciona en la actualización del navegador. me sale el error:

 Property or method "messageText" is not defined on the instance but referenced during render....

Funciona al cambiar componentes (estoy usando el enrutador Vue)

¿Cómo puedo hacer que esto, o algo similar, funcione? En última instancia, quería ponerlo en una mezcla para reutilizarlo en otros componentes.

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!