Comments (2)
You shouldn't use a layout in the modal component. Layout can only be used for the root
(parent) page.
Also, you should use the methods close
, redirect
, and the visibility variable show
provided by the useModal()
method, to manage the state of the modal.
Please check the official example implementation.
<script setup>
import { Dialog, DialogPanel, DialogTitle, TransitionChild, TransitionRoot } from "@headlessui/vue";
import { CheckIcon } from "@heroicons/vue/24/outline";
import { useModal } from "momentum-modal";
const { show, close, redirect } = useModal();
</script>
<template>
<TransitionRoot :show="show" as="template">
<Dialog as="div" class="relative z-10" @close="close">
<TransitionChild
@after-leave="redirect"
as="template"
enter="ease-out duration-300"
enter-from="opacity-0"
enter-to="opacity-100"
leave="ease-in duration-200"
leave-from="opacity-100"
leave-to="opacity-0"
>
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" />
</TransitionChild>
</Dialog>
</TransitionRoot>
</template>
Check the video with the changes applied: https://share.cleanshot.com/9H6b8k.
from momentum-modal.
Hey,
Thanks for looking into this. Yeah, the layout doesn't make sense in the modal component. Though the other side effects I mentioned was also throwing me a bit. I guess I just needed to use close and redirect methods like you said. I guess this is the missing piece. Thanks! I'll close this now, and I will reopen if needed.
from momentum-modal.
Related Issues (20)
- Cannot read properties of null (reading 'props') HOT 4
- Modal/Slide-over resets form fields HOT 1
- How to show Modal from another Modal HOT 2
- Could not resolve "@inertiajs/vue3" HOT 3
- Possible to pass a URL to redirect function? HOT 1
- baseRoute component rerender every time
- Any example on how to use it with Svelte?
- Header X-Inertia-Modal-Redirect - CORS issue
- Call to a member function with() on null HOT 1
- Cannot read properties of null (reading 'props') HOT 1
- [Question] Possible to prevent reloading if already open?
- TypeScript typings HOT 1
- Problem with Inertia forms HOT 1
- Need to @click='close' when using links inside modals? HOT 4
- Modal 404s When Accessing Again
- Demo page incorrect password
- Refresh the baseRoute page data HOT 2
- Base Component resets state when opening the modal
- Please support inertia-laravel v1.0
- How to use preserve state on close correctly? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from momentum-modal.