Skip to content

Commit be4044f

Browse files
committed
fix(tooltip): fix 检视意见
1 parent 9dfb5d9 commit be4044f

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const toggleShow =
2929
({ state, props, emit, api }) =>
3030
(isShow: boolean) => {
3131
// 智能识别模式
32-
if (props.visible === 'auto' && state.referenceElm) {
32+
if (props.visible === 'auto' && state.referenceElm?.firstElementChild) {
3333
const { clientWidth, scrollWidth } = state.referenceElm.firstElementChild
3434
if (scrollWidth <= clientWidth) {
3535
return

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ export const renderless = (
6969
}
7070
})
7171

72-
vm.$on('tooltip-update', updatePopper())
72+
// 历史遗留
73+
vm.$on('tooltip-update', (el?: HTMLElement) => {
74+
if (el) state.popperElm = el
75+
if (props.modelValue) updatePopper()
76+
})
77+
onUnmounted(() => vm.$off('tooltip-update'))
7378

7479
return api
7580
}

packages/vue/src/tooltip/src/tooltip.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
v-bind="$attrs"
66
style="display: inline-block"
77
:tabindex="tabindex"
8-
:aria-describeby="state.tooltipId"
8+
:aria-describedby="state.tooltipId"
99
@mouseenter="handleRefEvent('mouseenter')"
1010
@mouseleave="handleRefEvent('mouseleave')"
1111
>

0 commit comments

Comments
 (0)