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

155
Views
Call functions dynamically in Vue 2

I have a dynamic form who change with the route param this.$route.params.editor and everything work fine but the submit function does not call the API (the calling function is in a separate file) because also the function is dynamic and change with the params
There are the form code:

methods: {
  save () {
    const editor = this.$route.params.editor
    this.$api[editor]().save(this.localData).then((res) => {
      this.localData = res
    }).catch(err => console.error(err))
  }
}

The result must be like this:

this.$api.material().save(this.localData)

or

this.$api.item().save(this.localData)

But the function must be obviusly dynamic

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!