tusen-ai / naive-ui

A Vue 3 Component Library. Fairly Complete. Theme Customizable. Uses TypeScript. Fast.

Home Page:https://www.naiveui.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

浮动按钮菜单--想要增加一个方位选择功能

ICanThis opened this issue · comments

问题的清晰而简明的描述

我想用浮动按钮做一个用户信息功能,但是目前只能将这个按钮置于页面底部,否则一旦信息过多就会有部分菜单被遮挡,如果将其置于页面底部的话,整体而言不太美观,所以我想将浮动按钮放到顶部,且希望菜单展开时是在按钮的下面展开。

建议的解决方案

希望能像tooltip的placement属性一样,可以指定出现的方位。如:

<n-float-button v-show="loginFlag" :right="40" type="primary" :top="userPosition" width="46" shape="circle"
                  menu-trigger="hover" placement="bottom"
                  :draggable="true">
    <n-icon size="28">
      <User/>
    </n-icon>
    <template #menu>
      <n-float-button @click="logout" shape="square" type="primary">
        <n-tooltip trigger="hover" placement="left">
          <template #trigger>
            <n-icon>
              <LogOut/>
            </n-icon>
          </template>
          <p>退出登录</p>
        </n-tooltip>
      </n-float-button>
    </template>
 </n-float-button>

希望能增加placement,可选择弹出位置,如bottom和top。

备选方案

No response

附加上下文

No response

验证

  • 阅读 贡献指南
  • 阅读 文档
  • 检查是否已经存在请求相同功能的问题,以避免创建重复的问题。

动态控制 right bottom

动态控制 right bottom

请问要如何设置bottom,手动移动到下方吗

动态控制 right bottom

请问要如何设置bottom,手动移动到下方吗

我加入了这些样式,达到了我的想法,现在移动到下方了:

.n-float-button[placement="bottom"] .n-float-button__menu {
    bottom: 0;
    top: 100%;
    padding-top: 16px;
}

.n-float-button[placement="bottom"] .n-float-button__menu > * {
    margin-bottom: 0;
}