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

206
Views
En Vue 3.* ¿cómo pasar el objeto ref en sí mismo a un controlador de eventos con sintaxis de plantilla?
<script setup> import { ref } from 'vue' const foo = ref(1) function changeSth(sth, val) { sth.val = val; // an error trigger, because ref object is unwrapped, sth is just a plain value } </script> <template> <button @click="changeSth(foo, 2)">click me change sth.</button> </template>

Quiero pasar el objeto ref foo a la función changeSth 。 para poder reutilizar changeSth para hacer algo como changeSth(foo) changeSth(bar) . Pero ahora solo puedo obtener el valor del objeto ref. Entonces, cómo pasar el objeto ref en sí mismo al controlador de eventos como changeSth con sintaxis de plantilla.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Intenta lo siguiente:

 <template> <button @click="changeSth('foo', 2)">click me change sth.</button> {{ foo }} </template> <script setup> import { ref } from 'vue' const foo = ref(1) function changeSth(sth, val) { this[sth] = val } </script>
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!