- API 路由统一: 移除 /api/h5/,统一 /api/pms/ 入口 - 二进制改名: api-server -> pms-api(与服务名一致) - nginx: 合并 /api/ + /pms/api/ 为 /api/pms/ - 新增 docs/API.md 接口文档 - 后端: CabinetDetail 增加 rssi/pow_fail/address/soc 等字段 - Redis 管道批量读取仓体实时数据(SOC/电压/电流/功率) - DB: 所有 TIMESTAMP 列改为 DATETIME(修复类型不匹配) - 用户管理: 新增创建时间/修改时间列,状态改用 Switch - 角色管理/用户管理: 操作按钮改为图标 - PC 设备详情: 基本信息补全 RSSI/ICCID/电源/地址 - PC 卡片: 通道统计改用 Lucide 图标,颜色统一 - PC 二维码: canvas 渲染,含编号文字,支持右键下载 - H5: 按 uni-app 规范修正导航(navigateTo 替代 reLaunch) - H5: 详情页加返回导航条 - H5: 扫码支持摄像头(jsQR)+ ?id= 参数 - H5: 底部 tabBar 在所有页面常显 - H5: 首页统计改为 6 项(设备/通道/空闲/充电/充满/故障) - H5: 下拉刷新 / 上拉加载 - 产品首页: 添加业务联系 - 文档: 清理过时文件,补充缺失规范章节
4.0 KiB
4.0 KiB
title, impact, impactDescription, type, tags
| title | impact | impactDescription | type | tags | |||||
|---|---|---|---|---|---|---|---|---|---|
| Mouse Button Modifiers Represent Intent, Not Physical Buttons | LOW | Mouse modifiers .left/.right/.middle may not match physical buttons on left-handed mice or other input devices | gotcha |
|
Mouse Button Modifiers Represent Intent, Not Physical Buttons
Impact: LOW - Vue's mouse button modifiers (.left, .right, .middle) are named based on a typical right-handed mouse layout, but they actually represent "main", "secondary", and "auxiliary" pointing device triggers. This means they may not correspond to physical button positions on left-handed mice, trackpads, or other input devices.
Task Checklist
- Understand that
.leftmeans "primary/main" action, not physical left button - Understand that
.rightmeans "secondary" action (usually context menu) - Consider accessibility when relying on specific mouse buttons
- Don't assume users have a traditional right-handed mouse
Potentially Confusing:
<template>
<!-- Documentation says "left click only" but... -->
<div @click.left="handlePrimaryAction">
<!-- On left-handed mouse: fires on physical RIGHT button -->
<!-- On trackpad: fires on single-finger tap -->
<!-- On touch screen: fires on tap -->
</div>
</template>
Clear Understanding:
<template>
<!-- Think of it as "primary action" -->
<div @click.left="handlePrimaryAction">
Primary action (main button)
</div>
<!-- Think of it as "secondary/context action" -->
<div @click.right="handleSecondaryAction">
Secondary action (context menu button)
</div>
<!-- Think of it as "auxiliary action" -->
<div @click.middle="handleAuxiliaryAction">
Auxiliary action (scroll wheel click)
</div>
</template>
What the Modifiers Actually Mean
// Vue modifier → MouseEvent.button value → Actual meaning
// .left → button === 0 → "Main button" (primary action)
// .right → button === 2 → "Secondary button" (context menu)
// .middle → button === 1 → "Auxiliary button" (middle click)
// The browser handles remapping for:
// - Left-handed mouse settings
// - Trackpad gestures
// - Touch devices
// - Stylus/pen input
Device Behaviors
<!-- How different devices trigger these modifiers -->
<!-- Traditional right-handed mouse -->
<!-- .left = physical left button -->
<!-- .right = physical right button -->
<!-- .middle = scroll wheel press -->
<!-- Left-handed mouse (swapped in OS settings) -->
<!-- .left = physical RIGHT button (remapped by OS) -->
<!-- .right = physical LEFT button (remapped by OS) -->
<!-- .middle = scroll wheel press -->
<!-- Trackpad -->
<!-- .left = single-finger tap/click -->
<!-- .right = two-finger tap/click (or corner click) -->
<!-- .middle = three-finger tap (if configured) -->
<!-- Touch screen -->
<!-- .left = tap -->
<!-- .right = long press (context menu) -->
<!-- .middle = typically not available -->
Best Practice: Semantic Naming in Comments
<template>
<!-- Use comments to clarify intent -->
<!-- Primary action (select item) -->
<div @click.left="selectItem">
<!-- Context menu action -->
<div @click.right.prevent="showContextMenu">
<!-- Open in new tab (auxiliary/middle click convention) -->
<a @click.middle="openInNewTab" href="...">
</template>
Accessibility Considerations
<template>
<!-- Don't require specific mouse buttons for essential actions -->
<!-- BETTER: Provide keyboard alternatives -->
<div
@click.left="select"
@click.right.prevent="showMenu"
@keydown.enter="select"
@keydown.space="select"
@contextmenu.prevent="showMenu"
tabindex="0"
role="button"
>
Accessible interactive element
</div>
</template>