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

123
Views
API de composición - Vue 3 - Cómo llamar a una función dentro de la plantilla para obtener un valor devuelto

En mi plantilla estoy usando el siguiente código:

 <template> {{ getScope(scope.row, itemIn.field) }} </template>

En la API de opciones que estoy usando:

 methods: { getScope(data, key) { const str_spl = key.split(".") if(str_spl.length == 2) { return data[str_spl[0]][str_spl[1]] } else { return data[key] } }, }

Ahora quiero pasar a un método Composition API . Creé el siguiente código, pero no puedo devolverlo como lo hice con la Options API . ¿Como arreglar?

 setup() { getScope(data, key) { const str_spl = key.split(".") if(str_spl.length == 2) { return data[str_spl[0]][str_spl[1]] } else { return data[key] } } return { getScope, }; }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

En la API de composición, debe declarar los métodos como funciones:

 const getScope = (data, key) => { const str_spl = key.split(".") if(str_spl.length == 2) { return data[str_spl[0]][str_spl[1]] } else { return data[key] } }

o

 function getScope(data, key) { ...
about 4 years ago · Juan Pablo Isaza Report
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!