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

75
Views
Diferencia entre @click="variable.someFunction" y @click="variable.someFunction()"

Tengo una pregunta sobre @click en vue.

Si mi componente se ve así, dice que this es nulo:

 //testcomponent.vue <template> <button @click="variable.someFunction">Click me</button> </template> <script> const default_layout = "default"; export default { name: "TestComponent", data() { return { variable: { value: "test", someFunction() { console.log(this) } } } } } </script>

Si cambio el código del botón a:

 <button @click="variable.someFunction()">Click me</button>

Dice que this es:

 { someFunction: ƒ someFunction() value: "test" }

No pude encontrar ninguna documentación sobre este problema, ¿alguien sabe por qué vue admite ambas definiciones, pero tiene un comportamiento diferente?

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!