diff --git a/.workbuddy/memory/2026-07-31.md b/.workbuddy/memory/2026-07-31.md index ebab83f..46bc476 100644 --- a/.workbuddy/memory/2026-07-31.md +++ b/.workbuddy/memory/2026-07-31.md @@ -95,3 +95,14 @@ - 样式:新增 scoped `.top-theme-icon`,`::before` 浅灰圆形背景 `#f2f3f5`,默认 `scale(0.6) opacity(0)`,hover/focus 弹性放大到 `scale(1)`,图标 `z-index:1` 压在上层。 - 调整:用户反馈 T 恤图标在顶栏中上下不居中,把 `.top-theme-icon` 由 `display:flex; height:100%` 改为 `display:inline-flex; vertical-align:middle; width:32px; height:32px`,使其与右侧头像/用户名在同一水平中线。 - 注意:该组件受 `website.setting.theme` 控制(之前曾设为 false 隐藏),若顶栏未显示主题图标,需确认 website.js 中 `setting.theme` 为 true。 + +## 顶栏头像触发下拉菜单(hover) + +- **需求**: 鼠标移到头像(top-bar__img)也能触发下拉,行为与点用户名一致。 +- **文件**: `src/page/index/top/index.vue` +- **改动**: + 1. 把 `` 从 el-dropdown 外的同级节点,移入 el-dropdown 触发区(``)内。 + 2. 给 `` 加 `trigger="hover"`,让头像+姓名整体支持 hover 触发。 + 3. scoped 样式新增 `.top-user__trigger`(inline-flex / padding 4px 8px / hover 浅灰背景 rgba(0,0,0,0.04)),并把 `.top-bar__img` 自身 `margin` 改为 `0 5px 0 0` 配合新容器。 +- **效果**: 鼠标悬停在头像或姓名任一处都会展开下拉;保留 `:hide-on-click="false"`(菜单内点击不收起,el-tooltip 等仍可交互)。 +- **注意**: 若用户后续希望「hover 触发」仅作用于头像、不影响姓名点击行为,需把姓名部分移出 el-dropdown 触发区;当前实现是统一行为。 diff --git a/src/page/index/top/index.vue b/src/page/index/top/index.vue index 6a5c513..3ba4f62 100644 --- a/src/page/index/top/index.vue +++ b/src/page/index/top/index.vue @@ -33,9 +33,9 @@
- - - + + + {{ userInfo.real_name }} @@ -361,4 +361,22 @@ export default { }; - + diff --git a/src/styles/top.scss b/src/styles/top.scss index beb2abc..64ae25c 100644 --- a/src/styles/top.scss +++ b/src/styles/top.scss @@ -120,7 +120,7 @@ height: variables.$top_height; margin: 0 7px; font-size: 16px; - top: -2px; + top: -4px; .el-badge__content.is-fixed { top: 12px;