fix(calendar-view): fix popper cant mouse enter (#3218)

This commit is contained in:
申君健 2025-03-28 02:00:03 -07:00 committed by GitHub
parent db2499761e
commit 6fee367dad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 26 deletions

View File

@ -57,18 +57,17 @@ export const handleMouseenter =
($event, val) => {
const tooltip = vm.$refs.tooltip
tooltip.state.referenceElm = $event.target
tooltip.state.popperElm && (tooltip.state.popperElm.style.display = 'none')
tooltip.doDestroy()
state.eventTipContent = val
state.eventTipVisible = true
setTimeout(tooltip.updatePopper, 20)
setTimeout(tooltip.show(), 20)
}
export const handleMouseleave =
({ state }) =>
({ vm }) =>
() => {
state.eventTipVisible = false
const tooltip = vm.$refs.tooltip
tooltip.setExpectedState(false)
tooltip.debounceClose()
}
export const isSelectedDate =

View File

@ -120,7 +120,6 @@ const initState = ({ reactive, props, computed, api, images, modesIcon }) => {
showMonth: false,
showSelectedDateEvents: false,
multiSelect: computed(() => props.multiSelect),
eventTipVisible: false,
cascaderVisible: false,
eventTipContent: {},
activeYear: props.year,
@ -287,7 +286,7 @@ const initApi = ({ vm, api, state, t, props, emit, nextTick }) => {
goPrevMonth: throttle(50, true, goPrevMonth({ state })),
goNextMonth: throttle(50, true, goNextMonth({ state })),
handleMouseenter: handleMouseenter({ vm, state }),
handleMouseleave: handleMouseleave({ state }),
handleMouseleave: handleMouseleave({ vm }),
isSelectedDate: isSelectedDate({ state }),
isStartOrEndDay: isStartOrEndDay({ state }),
getDayBgColor: getDayBgColor({ props }),

View File

@ -1,13 +1,6 @@
<template>
<div data-tag="tiny-calendar-view" class="w-full h-auto">
<tiny-tooltip
ref="tooltip"
v-model="state.eventTipVisible"
popper-class="absolute max-w-[theme(spacing.80)]"
:manual="true"
effect="light"
placement="right"
>
<tiny-tooltip ref="tooltip" popper-class="absolute max-w-[theme(spacing.80)]" effect="light" placement="right">
<template #content>
<div class="p-2 max-h-[80vh] overflow-auto">
<div class="px-1.5 mb-1.5 border-l-2 border-color-brand">{{ state.eventTipContent.title }}</div>

View File

@ -58,8 +58,8 @@
day.isLast || day.isNext
? 'is-next-or-last'
: isToday(day) || isSelectedDate(day)
? 'is-selected'
: '',
? 'is-selected'
: '',
day.disabled ? 'is-disabled' : ''
]"
>
@ -212,14 +212,7 @@
</ul>
</div>
</div>
<tiny-tooltip
ref="tooltip"
v-model="state.eventTipVisible"
popper-class="tiny-calendar-view-tooltip"
:manual="true"
effect="light"
placement="right"
>
<tiny-tooltip ref="tooltip" popper-class="tiny-calendar-view-tooltip" effect="light" placement="right">
<template #content>
<div class="tooltip-main">
<div class="title">{{ state.eventTipContent.title }}</div>