-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(modal): when many instances are activated at same time, `on-mask-…
…click` will be triggered on every modal even only one mask is clicked #3147
- Loading branch information
Showing
6 changed files
with
129 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<markdown> | ||
# Mask click debug | ||
</markdown> | ||
|
||
<template> | ||
<n-space justify="center"> | ||
<NButton type="primary" @click="showModalOne = true"> | ||
Show Modal One | ||
</NButton> | ||
</n-space> | ||
<n-modal | ||
:show="showModalOne" | ||
preset="dialog" | ||
title="Modal One" | ||
type="success" | ||
@mask-click="handleCloseOne" | ||
> | ||
<n-space vertical justify="center"> | ||
<NButton type="info" @click="showModalTwo = true"> | ||
Show Modal Two | ||
</NButton> | ||
<n-image | ||
width="100" | ||
src="https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg" | ||
preview-src="https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg" | ||
/> | ||
try to show the second modal | ||
</n-space> | ||
</n-modal> | ||
<n-modal | ||
:show="showModalTwo" | ||
preset="dialog" | ||
title="Modal Two" | ||
type="info" | ||
@mask-click="handleCloseTwo" | ||
> | ||
try to click the mask | ||
</n-modal> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { ref } from 'vue' | ||
import { NSpace, NButton, NModal, NImage } from 'naive-ui' | ||
export default { | ||
name: 'App', | ||
components: { | ||
NSpace, | ||
NButton, | ||
NModal, | ||
NImage | ||
}, | ||
setup () { | ||
const showModalOne = ref(false) | ||
const showModalTwo = ref(false) | ||
function handleCloseOne () { | ||
showModalOne.value = false | ||
} | ||
function handleCloseTwo () { | ||
showModalTwo.value = false | ||
} | ||
return { | ||
showModalOne, | ||
showModalTwo, | ||
handleCloseOne, | ||
handleCloseTwo | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters