Skip to content

Commit

Permalink
fix: 修复popper的arrow位置计算问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wanchun committed Jan 21, 2022
1 parent 39c2c7b commit 4440d96
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/popper/popper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default defineComponent({
const renderContentCopy = () => {
if (visible.value && !transitionVisible.value) {
return contentStyle.value ? (
<div style={contentStyle.value} />
<div style={contentStyle.value} />
) : (
<Content />
);
Expand Down
8 changes: 5 additions & 3 deletions components/popper/usePopper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default (props: PopperProps, emit: any) => {
const placement = ref(props.placement);
const transitionVisible = ref(visible.value);
watch(visible, (val) => {
// 关闭时直接关闭
if (!val) {
transitionVisible.value = val;
}
Expand All @@ -37,9 +38,10 @@ export default (props: PopperProps, emit: any) => {
let instance: ReturnType<typeof createPopper> | null;

const updateInstance = () => {
transitionVisible.value = false;
instance.update().then(() => {
nextTick(() => {
// 需要在下一帧等copy渲染完毕,有大小体积之后再计算一次
nextTick(() => {
transitionVisible.value = false;
instance.update().then(() => {
transitionVisible.value = true;
});
});
Expand Down

0 comments on commit 4440d96

Please sign in to comment.