Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

288
Vistas
Vue 3 - can i avoid using .value everywhere?

I'm quite new to Vue 3 and i'm struggling a lot to understand some concepts of the composition API. I'm trying to port a library i'm using from vue 2 to vue 3, and in a parent element a reactive property called layout is passed to children components.

So in the parent component i'm returning layout to the children like this:

setup(props){
    const layout = ref({'width': 10, ... })
    return {
        layout,
        ...
    }
}

The problem is that, in order to access width or any other reactive value in layout from any children component i need to use the syntax layout.value.width. This is quite a problem because through the whole project layout is referenced with layout.width, this means that i need to add a .value to every reference to layout and do the same for all the other reactive variables i'm passing to my children components. Is there any way to avoid this or am i just not getting some important concepts from the composition api?

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

There are at least two ways:

  1. Yes. You can work without the .value. You have to use the vue experimental version

or

  1. You can create a reactive variable, like:
<script setup>
import { reactive } from 'vue'

const layout = reactive({'width': 10, ... })
</script>
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda