Skip to content

Commit a632412

Browse files
committed
fix(tooltip): 新增适配以前的api, state 等等
1 parent 038b77d commit a632412

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

packages/renderless/src/tooltip/new-vue.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@ import { handlePopEvent, handleRefEvent, toggleShow } from './new-index'
22
import { userPopper, useTimer } from '@opentiny/vue-hooks'
33
import { guid } from '@opentiny/utils'
44

5-
export const api = ['state', 'handlePopEvent', 'handleRefEvent']
5+
export const api = [
6+
'state',
7+
'handlePopEvent',
8+
'handleRefEvent',
9+
'show',
10+
'hide',
11+
'updatePopper',
12+
'setExpectedState',
13+
'debounceClose'
14+
]
615

716
export const renderless = (
817
props,
@@ -11,7 +20,7 @@ export const renderless = (
1120
) => {
1221
const api = {} as any
1322
const popperVmRef = {}
14-
const { showPopper, updatePopper, popperElm, referenceElm } = userPopper({
23+
const { showPopper, updatePopper, popperElm, referenceElm, currentPlacement } = userPopper({
1524
emit,
1625
props,
1726
nextTick,
@@ -31,6 +40,8 @@ export const renderless = (
3140
showPopper,
3241
popperElm,
3342
referenceElm,
43+
// 适配以前用法
44+
currentPlacement,
3445
tooltipId: guid('tiny-tooltip-', 4),
3546
showContent: inject('showContent', null),
3647
tipsMaxWidth: inject('tips-max-width', null)
@@ -50,7 +61,13 @@ export const renderless = (
5061
cancelDelayHide,
5162
delayHideAfter,
5263
handlePopEvent: handlePopEvent({ props, api }),
53-
handleRefEvent: handleRefEvent({ props, api })
64+
handleRefEvent: handleRefEvent({ props, api }),
65+
// 适配以前用法
66+
show: delayShow,
67+
hide: delayHide,
68+
updatePopper,
69+
setExpectedState: () => {},
70+
debounceClose: delayHide
5471
})
5572
watch(
5673
() => props.modelValue,

0 commit comments

Comments
 (0)