Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(popover): Fixed extra 4px margin that appears when title is empty #3104

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/web-vue/components/popover/popover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
>
<slot />
<template #content>
<div :class="`${prefixCls}-title`">
<div v-if="title || titleSlot" :class="`${prefixCls}-title`">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arco vue 最初依赖的 vue 3.1 版本还不支持 useSlots,这里从兼容性考虑,可以更换为 v-if="title || $slots.title"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经按照要求修改,上次提交忘记提交了样式文件,抱歉

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个bug下一次发版能合进去吗

<slot name="title">{{ title }}</slot>
</div>
<div :class="`${prefixCls}-content`">
Expand All @@ -29,7 +29,7 @@

<script lang="ts">
import type { PropType } from 'vue';
import { computed, CSSProperties, defineComponent, ref } from 'vue';
import { computed, CSSProperties, defineComponent, ref, useSlots } from 'vue';
import { getPrefixCls } from '../_utils/global-config';
import type { TriggerEvent, TriggerPosition } from '../_utils/constant';
import Trigger from '../trigger';
Expand Down Expand Up @@ -146,6 +146,8 @@ export default defineComponent({
setup(props, { emit }) {
const prefixCls = getPrefixCls('popover');

const titleSlot = !!useSlots().title;

const _popupVisible = ref(props.defaultPopupVisible);
const computedPopupVisible = computed(
() => props.popupVisible ?? _popupVisible.value
Expand Down Expand Up @@ -173,6 +175,7 @@ export default defineComponent({
contentCls,
arrowCls,
handlePopupVisibleChange,
titleSlot,
};
},
});
Expand Down