mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
fix(dialog): enter animation not right
This commit is contained in:
parent
10aa0dd029
commit
4988961822
@ -2,6 +2,8 @@
|
||||
<n-modal
|
||||
v-model:show="show"
|
||||
appear
|
||||
:clicked="clicked"
|
||||
:click-position="clickPosition"
|
||||
:to="to"
|
||||
:mask-closable="maskClosable"
|
||||
@after-leave="handleAfterHide"
|
||||
@ -59,6 +61,14 @@ export default {
|
||||
onInternalAfterLeave: {
|
||||
type: Function,
|
||||
required: true
|
||||
},
|
||||
clicked: {
|
||||
type: Boolean,
|
||||
default: undefined
|
||||
},
|
||||
clickPosition: {
|
||||
type: Object,
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
data () {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Fragment, ref, h, reactive } from 'vue'
|
||||
import { createId, omit } from '../../_utils/vue'
|
||||
import DialogEnvironment from './DialogEnvironment.vue'
|
||||
import { useClicked, useClickPosition } from 'vooks'
|
||||
|
||||
export default {
|
||||
name: 'DialogProvider',
|
||||
@ -23,7 +24,9 @@ export default {
|
||||
setup () {
|
||||
const dialogListRef = ref([])
|
||||
return {
|
||||
dialogList: dialogListRef
|
||||
dialogList: dialogListRef,
|
||||
clicked: useClicked(),
|
||||
clickPosition: useClickPosition()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -64,6 +67,8 @@ export default {
|
||||
dialog,
|
||||
['destroy'],
|
||||
{
|
||||
clicked: this.clicked,
|
||||
clickPosition: this.clickPosition,
|
||||
to: dialog.to ?? this.to,
|
||||
ref: `n-dialog-${dialog.key}`,
|
||||
onInternalAfterLeave: this.handleAfterLeave
|
||||
|
@ -76,6 +76,14 @@ export default {
|
||||
type: Boolean,
|
||||
default: undefined
|
||||
},
|
||||
clicked: {
|
||||
type: Boolean,
|
||||
default: undefined
|
||||
},
|
||||
clickPosition: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
// deprecated
|
||||
onBeforeHide: {
|
||||
validator () {
|
||||
@ -99,13 +107,19 @@ export default {
|
||||
default: undefined
|
||||
}
|
||||
},
|
||||
setup () {
|
||||
setup (props) {
|
||||
const clickedRef = useClicked(64)
|
||||
const clickedPositionRef = useClickPosition()
|
||||
return {
|
||||
isMounted: useIsMounted(),
|
||||
containerRef: ref(null),
|
||||
mousePosition: computed(() => {
|
||||
const {
|
||||
clicked
|
||||
} = props
|
||||
if (clicked !== undefined) {
|
||||
if (clicked) return props.clickPosition
|
||||
}
|
||||
if (clickedRef.value) {
|
||||
return clickedPositionRef.value
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user