Skip to content

Commit

Permalink
feat(Tooltip): 增加 updatePopperPosition 方法
Browse files Browse the repository at this point in the history
  • Loading branch information
ocean-gao committed Oct 21, 2024
1 parent 16fc6c1 commit ac1e075
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions components/tooltip/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
type PropType,
computed,
defineComponent,
ref,
} from 'vue';
import { isNil } from 'lodash-es';
import { useVModel } from '@vueuse/core';
Expand Down Expand Up @@ -62,6 +63,8 @@ export default defineComponent({
currentValue.value = val;
};

const popperElRef = ref(null);

function getPopperSlots() {
return {
trigger: ctx.slots.default,
Expand Down Expand Up @@ -159,11 +162,18 @@ export default defineComponent({
return _props;
});

ctx.expose({
updatePopperPosition() {
popperElRef.value?.updatePopperPosition();
},
});

return () => {
return (
<Popper
{...popperPropsRef.value}
v-model={currentValue.value}
ref={popperElRef}
popperClass={[
prefixCls,
`${prefixCls}-${props.mode}`,
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/components/popper/passive.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<FSpace>
<FForm :labelWidth="100">
<FForm :labelWidth="150">
<FFormItem label="是否显示:">
<FRadioGroup
v-model="visible"
Expand Down
2 changes: 1 addition & 1 deletion docs/.vitepress/components/tooltip/passive.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<FSpace>
<FForm :labelWidth="100">
<FForm :labelWidth="150">
<FFormItem label="是否显示:">
<FRadioGroup
v-model="visible"
Expand Down

0 comments on commit ac1e075

Please sign in to comment.