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

142
Views
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
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!