Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

147
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda