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

146
Vistas
Ant Design Vue: Modal Component will not work with the Composition API

I'm using Vue3 with Ant Design Vue and would like create a 'Modal' component that I can reuse throughout the app.

Something very simple like so:

<template>
    <a-button type="primary" @click="showModal">Open</a-button>
    <a-modal v-model="visible" wrap-class-name="full-modal-to-xl">
        <p>Some contents...</p>
        <p>Some contents...</p>
        <p>Some contents...</p>
    </a-modal>
</template>

<script lang="ts">
import { ref, defineComponent } from "vue";

export default defineComponent({
    setup() {
        const visible = ref(false);

        const showModal = () => {
            visible.value = true;
        };
        return { visible, showModal };
    },
});
</script>

But it simply will not work...(no console log, or error).

It does seem to work when you pass visible as a prop, but I really do not want to do that. This should work just as well...

What am I missing?

EDIT: Solution (but not really a solution) Using the Composition API is not feasible with Ant it seems.

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

0

The modal's v-model needs to be on its visible prop:

<a-modal v-model:visible="visible">
                    👆

demo

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