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

319
Views
¿Por qué la variable reactiva vue actualiza la propiedad _value en lugar de la propiedad value?

Así que estoy aprendiendo vue 3 con la API de composición y quiero cambiar la propiedad .value de una variable 'filteredProjects' de la respuesta de axios así...

 const filteredProjects = ref(null)
onMounted(async () => {
 await api.get("/project").then(response => filteredProjects.value = response.data);
})
console.log(filteredProjects.value)

Probé console.log(filteredProjects.value) pero devolvió un valor nulo, así que revisé la variable sin la propiedad .value console.log(filteredProjects) y descubrí que los datos de respuesta de la API se están configurando en la propiedad _value en lugar de . valor. Este es el resultado de la consola.

 RefImpl {__v_isShallow: false, dep: undefined, __v_isRef: true, _rawValue: null, _value: null}
dep: Set(1) {ReactiveEffect}
__v_isRef: true
__v_isShallow: false
_rawValue: {data: Array(13), message: 'successfully get data'}
_value: Proxy {data: Array(13), message: 'successfully get data'}
value: (...)
[[Prototype]]: Object
almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

En Vue.js, cuando utilizas una variable reactiva, como las creadas con ref o reactive, la biblioteca agrega una propiedad adicional llamada _value a la variable reactiva. Esto se hace para evitar conflictos con el propio nombre "value" y para garantizar que la variable sea reactiva correctamente.

almost 4 years ago · Santiago Trujillo 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!