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

233
Vistas
Two way form data binding in vue 3 composition api

I'm starting my transition from options api to compositon api in vue.

And I have the following block of code where I'm trying to implement 2 way bind.

I'm using ant-design-vue library for slider input. And trying to bind the slider value to input field.

<template>
  <div>
    <a-row>
      <a-col :span="12">
        <a-slider v-model="inputValue1" :min="1" :max="20" />
      </a-col>
      <a-col :span="4">
        <a-input-number
          v-model="inputValue1"
          :min="1"
          :max="20"
          style="marginleft: 16px"
        />
      </a-col>
    </a-row>
  </div>
</template>
<script>
import { ref } from "vue";
export default {
  setup() {
    let inputValue1 = ref(8);
    return { inputValue1 };
  },
};
</script>

With the above code the value of inputValue1 doesn't change while inspecting in vue dev tool.

How do I work with two way binding in vue 3 composition api ?

Link to sandbox: https://stackblitz.com/edit/vue-pchhub?file=src%2FApp.vue

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Looks like you have to use v-model:value="..."for this to work.

<template>
  <div>
    <a-row>
      <a-col :span="12">
        <a-slider v-model:value="inputValue1" :min="1" :max="20" />
      </a-col>
      <a-col :span="4">
        <a-input-number
          v-model:value="inputValue1"
          :min="1"
          :max="20"
          style="marginleft: 16px"
        />
      </a-col>
    </a-row>
  </div>
</template>
<script>
import { ref } from "vue";
export default {
  setup() {
    let inputValue1 = ref(8);
    return { inputValue1 };
  },
};
</script>
about 4 years ago · Juan Pablo Isaza 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