Skip to content

Commit

Permalink
fix(float-button): error when using with popover, closes #5933
Browse files Browse the repository at this point in the history
  • Loading branch information
jizai1125 committed May 13, 2024
1 parent a6d4b11 commit 5b8bfae
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## NEXT_VERSION

### Fixes

- Fix `n-float-button` error when using with `popover` component, closes [#5933](https://github.com/tusen-ai/naive-ui/issues/5933).

## 2.38.2

`2024-05-03`
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## NEXT_VERSION

### Fixes

- 修复 `n-float-button``popover` 一起使用会报错, 关闭 [#5933](https://github.com/tusen-ai/naive-ui/issues/5933)

## 2.38.2

`2024-05-03`
Expand Down
34 changes: 18 additions & 16 deletions src/float-button/src/FloatButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export default defineComponent({
} = this
const dirs: DirectiveArguments = [[mousemoveoutside, this.handleMouseleave]]
onRender?.()
return withDirectives(
return (
<div
class={[
`${mergedClsPrefix}-float-button`,
Expand All @@ -227,19 +227,22 @@ export default defineComponent({
role="button"
>
<div class={`${mergedClsPrefix}-float-button__fill`} aria-hidden></div>
<div class={`${mergedClsPrefix}-float-button__body`}>
{$slots.default?.()}
{resolveWrappedSlot($slots.description, (children) => {
if (children) {
return (
<div class={`${mergedClsPrefix}-float-button__description`}>
{children}
</div>
)
}
return null
})}
</div>
{withDirectives(
<div class={`${mergedClsPrefix}-float-button__body`}>
{$slots.default?.()}
{resolveWrappedSlot($slots.description, (children) => {
if (children) {
return (
<div class={`${mergedClsPrefix}-float-button__description`}>
{children}
</div>
)
}
return null
})}
</div>,
dirs
)}
{menuTrigger ? (
<div class={`${mergedClsPrefix}-float-button__close`}>
<NBaseIcon clsPrefix={mergedClsPrefix}>
Expand All @@ -258,8 +261,7 @@ export default defineComponent({
{resolveSlot($slots.menu, () => [])}
</div>
) : null}
</div>,
dirs
</div>
)
}
})

0 comments on commit 5b8bfae

Please sign in to comment.