(e: MouseEvent)
| 251 | // 点击外部关闭 | Close on click outside |
| 252 | useEffect(() => { |
| 253 | const handleClickOutside = (e: MouseEvent) => { |
| 254 | if (menuRef.current && !menuRef.current.contains(e.target as Node)) { |
| 255 | onClose(); |
| 256 | } |
| 257 | }; |
| 258 | |
| 259 | const handleEscape = (e: KeyboardEvent) => { |
| 260 | if (e.key === 'Escape') { |