Skip to content

Commit

Permalink
fix(Modal): prevent attrs inherit
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamincanac committed Mar 10, 2022
1 parent da3ed26 commit 850c766
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions docs/pages/examples.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
Toggle modal!
</UButton>

<UModal v-model="isModalOpen">
<UModal v-model="isModalOpen" @submit.prevent="onSubmit">
<div class="sm:flex sm:items-start">
<div class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10">
<UIcon name="heroicons-outline:exclamation" class="h-6 w-6 text-red-600" aria-hidden="true" />
Expand All @@ -56,7 +56,7 @@
</div>
</div>
<div class="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
<button type="button" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm" @click="open = false">
<button type="submit" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm" @click="open = false">
Deactivate
</button>
<button ref="cancelButtonRef" type="button" class="mt-3 w-full inline-flex justify-center rounded-md border u-border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium u-text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:w-auto sm:text-sm" @click="open = false">
Expand Down Expand Up @@ -175,6 +175,10 @@
Card:
</div>

<UCard @submit.prevent="onSubmit">
<UButton type="submit" label="Submit" class="ml-auto" />
</UCard>

<UCard body-class="flex">
<div class="flex-1 px-4 py-5 sm:p-6 space-y-3">
<UFormGroup label="Email" name="email" required>
Expand Down Expand Up @@ -269,6 +273,11 @@ function onClick () {
console.warn('click')
}
function onSubmit () {
// eslint-disable-next-line no-console
console.warn('submit')
}
const dropdownItems = [
[{
label: 'Edit',
Expand Down
1 change: 1 addition & 0 deletions src/runtime/components/overlays/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default {
TransitionChild,
Card
},
inheritAttrs: false,
props: {
modelValue: {
type: Boolean,
Expand Down

1 comment on commit 850c766

@vercel
Copy link

@vercel vercel bot commented on 850c766 Mar 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

Please sign in to comment.