forked from opentiny/tiny-vue
fix(auto-tip): [auto-tip] Fix the issue where the placement configuration always has old values (#1774)
This commit is contained in:
parent
78d02c90fb
commit
61c3abf44a
|
@ -48,12 +48,13 @@ export const api = [
|
|||
'focusHandler'
|
||||
]
|
||||
|
||||
const initState = ({ reactive, showPopper, popperElm, referenceElm, props, inject, popperJS }) =>
|
||||
const initState = ({ reactive, showPopper, popperElm, referenceElm, props, inject, popperJS, currentPlacement }) =>
|
||||
reactive({
|
||||
popperJS,
|
||||
showPopper,
|
||||
popperElm,
|
||||
referenceElm,
|
||||
currentPlacement,
|
||||
timeout: null,
|
||||
focusing: false,
|
||||
expectedState: undefined,
|
||||
|
@ -85,8 +86,19 @@ export const renderless = (
|
|||
|
||||
Object.assign(popperParam, { slots, onBeforeUnmount, onDeactivated, watch })
|
||||
|
||||
const { showPopper, updatePopper, popperElm, referenceElm, doDestroy, popperJS } = userPopper(popperParam as any)
|
||||
const state: ITooltipState = initState({ reactive, showPopper, popperElm, referenceElm, props, inject, popperJS })
|
||||
const { showPopper, updatePopper, popperElm, referenceElm, doDestroy, popperJS, currentPlacement } = userPopper(
|
||||
popperParam as any
|
||||
)
|
||||
const state: ITooltipState = initState({
|
||||
reactive,
|
||||
showPopper,
|
||||
popperElm,
|
||||
referenceElm,
|
||||
props,
|
||||
inject,
|
||||
popperJS,
|
||||
currentPlacement
|
||||
})
|
||||
|
||||
Object.assign(api, {
|
||||
state,
|
||||
|
|
|
@ -67,6 +67,7 @@ const mouseenterHandler = (e) => {
|
|||
|
||||
tooltipContent.value = currentTarget.boundingValue?.content || currentTarget.textContent
|
||||
tooltip.state.referenceElm = currentTarget
|
||||
tooltip.state.currentPlacement = getPlacement(currentTarget)
|
||||
|
||||
if (popperElm) {
|
||||
popperElm.classList.replace(
|
||||
|
|
Loading…
Reference in New Issue