Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
Is there a way to parse a string that points to computed properties in Vue as code?

I hope something like this hasn't been asked before. I have searched and can't find an answer. I've created a Vue 2 app that takes props from a JSON file created with ArchieML.

I want to find out if it is possible to take a prop, that comes as a string, and run it as code? The complication comes as the string is actually a template literal that contains the names of computed properties that are calculated within the Vue component I'm passing the string into.

As an illustration, the following template literal is passed as a string as a prop to the Vue component. Please note this doesn't get passed to the component as a template literal but as a string.

`Revenue has increased by ${ amount } compared with last year`

Then, I have the following computed property in the component:

amount() {
   return this.thisYear - this.lastYear
}

The amount value needs to be computed in the component and the text for the template literal has to come as a prop in the form of a string. Is there a way to parse the text as code so that it picks up computed properties created in the component?

I'd appreciate any help!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda