Skip to content

Commit

Permalink
fix(projects): fix ThemeButton tooltip trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Nov 7, 2023
1 parent 56e7dc3 commit 196710d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 1 addition & 5 deletions src/components/common/menu-toggler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,13 @@ interface Props {
}
defineProps<Props>();
function getPopupContainer(triggerNode: HTMLElement) {
return triggerNode.parentElement!;
}
</script>

<template>
<ButtonIcon
:tooltip-content="collapsed ? $t('icon.expand') : $t('icon.collapse')"
tooltip-placement="right"
:get-popup-container="getPopupContainer"
trigger-parent
>
<SvgIcon v-if="collapsed" icon="line-md:menu-fold-right" />
<SvgIcon v-else icon="line-md:menu-fold-left" />
Expand Down
11 changes: 7 additions & 4 deletions src/components/custom/button-icon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,22 @@ interface Props {
*/
tooltipPlacement?: TooltipPlacement;
/**
* get popup container
* @param triggerNode
* trigger tooltip on parent
*/
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
triggerParent?: boolean;
}
withDefaults(defineProps<Props>(), {
const props = withDefaults(defineProps<Props>(), {
cls: 'h-full text-icon',
icon: '',
tooltipContent: '',
tooltipPlacement: 'bottom',
getPopupContainer: () => document.body
});
function getPopupContainer(triggerNode: HTMLElement) {
return props.triggerParent ? triggerNode.parentElement! : document.body;
}
</script>

<template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const app = useAppStore();
<ButtonIcon
icon="majesticons:color-swatch-line"
:tooltip-content="$t('icon.themeConfig')"
trigger-parent
@click="app.openThemeDrawer"
/>
</template>
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/modules/global-menu/vertical-menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ function handleClickMenu(menuInfo: MenuInfo) {
<div class="h-full overflow-y-auto">
<AMenu
mode="inline"
:inline-collapsed="app.siderCollapse"
:items="routeStore.antdMenus"
:selected-keys="selectedKeys"
:open-keys="openKeys"
:inline-collapsed="app.siderCollapse"
class="menu w-full"
@click="handleClickMenu"
/>
Expand Down

0 comments on commit 196710d

Please sign in to comment.