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

136
Views
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 answers
Answer question

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 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!