Skip to content

Commit 2d6b502

Browse files
authored
chore: tooltip type fix (#3242)
1 parent 04f72ed commit 2d6b502

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

components/tooltip/Tooltip.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default defineComponent({
5656
},
5757
},
5858
methods: {
59-
handleVisibleChange(visible) {
59+
handleVisibleChange(visible: boolean) {
6060
if (!hasProp(this, 'visible')) {
6161
this.sVisible = this.isNoTitle() ? false : visible;
6262
}
@@ -85,7 +85,7 @@ export default defineComponent({
8585
// Fix Tooltip won't hide at disabled button
8686
// mouse events don't trigger at disabled button in Chrome
8787
// https://github.com/react-component/tooltip/issues/18
88-
getDisabledCompatibleChildren(ele) {
88+
getDisabledCompatibleChildren(ele: any) {
8989
if (
9090
((typeof ele.type === 'object' &&
9191
(ele.type.__ANT_BUTTON === true ||
@@ -143,7 +143,7 @@ export default defineComponent({
143143
},
144144

145145
// 动态设置动画点
146-
onPopupAlign(domNode, align) {
146+
onPopupAlign(domNode: HTMLElement, align: any) {
147147
const placements = this.getPlacements();
148148
// 当前返回的位置
149149
const placement = Object.keys(placements).filter(

components/tooltip/placements.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@ const autoAdjustOverflowDisabled = {
1212

1313
const targetOffset = [0, 0];
1414

15-
export function getOverflowOptions(autoAdjustOverflow) {
15+
interface PlacementsConfig {
16+
arrowPointAtCenter: boolean;
17+
arrowWidth?: number;
18+
verticalArrowShift?: number;
19+
horizontalArrowShift?: number;
20+
autoAdjustOverflow?: boolean | Object;
21+
}
22+
23+
export function getOverflowOptions(autoAdjustOverflow: boolean | Object) {
1624
if (typeof autoAdjustOverflow === 'boolean') {
1725
return autoAdjustOverflow ? autoAdjustOverflowEnabled : autoAdjustOverflowDisabled;
1826
}
@@ -22,7 +30,7 @@ export function getOverflowOptions(autoAdjustOverflow) {
2230
};
2331
}
2432

25-
export default function getPlacements(config) {
33+
export default function getPlacements(config: PlacementsConfig) {
2634
const {
2735
arrowWidth = 5,
2836
horizontalArrowShift = 16,

0 commit comments

Comments
 (0)