forked from opentiny/tiny-vue
fix(modal): fix last modal not disappear (#2021)
This commit is contained in:
parent
77969c4b1c
commit
9fb965d3e3
|
@ -38,8 +38,6 @@ import type {
|
|||
|
||||
const DragClass = 'is__drag'
|
||||
|
||||
let timer: number
|
||||
|
||||
const emitZoom = ({ params, parent, emit, event }: IModalEmitZoomParam): void => {
|
||||
let { $listeners, events = {} } = parent
|
||||
if ($listeners.zoom) {
|
||||
|
@ -156,16 +154,16 @@ export const selfClickEvent =
|
|||
}
|
||||
}
|
||||
|
||||
export const mouseEnterEvent = () => (): void => {
|
||||
clearTimeout(timer)
|
||||
export const mouseEnterEvent = (state) => (): void => {
|
||||
clearTimeout(state.timer)
|
||||
}
|
||||
|
||||
export const mouseLeaveEvent =
|
||||
({ api, props }: Pick<IModalRenderlessParams, 'api' | 'props'>) =>
|
||||
({ api, props, state }: Pick<IModalRenderlessParams, 'api' | 'props' | 'state'>) =>
|
||||
(): void => {
|
||||
api.addMsgQueue()
|
||||
|
||||
timer = window.setTimeout(
|
||||
state.timer = window.setTimeout(
|
||||
() => {
|
||||
api.close('close')
|
||||
},
|
||||
|
@ -269,7 +267,7 @@ export const open =
|
|||
if (state.isMsg) {
|
||||
api.addMsgQueue()
|
||||
|
||||
timer = window.setTimeout(
|
||||
state.timer = window.setTimeout(
|
||||
() => {
|
||||
api.close(params.type)
|
||||
},
|
||||
|
|
|
@ -87,7 +87,8 @@ export const renderless = (
|
|||
prevEvent: null,
|
||||
options: [],
|
||||
theme: props.tiny_theme,
|
||||
boxStyle: computed(() => api.computedBoxStyle())
|
||||
boxStyle: computed(() => api.computedBoxStyle()),
|
||||
timer: 0
|
||||
})
|
||||
|
||||
Object.assign(api, {
|
||||
|
@ -101,8 +102,8 @@ export const renderless = (
|
|||
mounted: mounted({ api, parent, props, isMobileFirstMode, state }),
|
||||
beforeUnmouted: beforeUnmouted({ api, parent, isMobileFirstMode }),
|
||||
selfClickEvent: selfClickEvent({ api, parent, props }),
|
||||
mouseEnterEvent: mouseEnterEvent(),
|
||||
mouseLeaveEvent: mouseLeaveEvent({ api, props }),
|
||||
mouseEnterEvent: mouseEnterEvent(state),
|
||||
mouseLeaveEvent: mouseLeaveEvent({ api, props, state }),
|
||||
updateZindex: updateZindex({ state, props }),
|
||||
handleEvent: handleEvent({ api, emit, parent, props, isMobileFirstMode }),
|
||||
closeEvent: closeEvent(api),
|
||||
|
|
Loading…
Reference in New Issue