修复手机端名单:单击/双击用户名均关闭抽屉,引入互斥定时器防止双击时抽屉提前关闭
This commit is contained in:
@@ -235,12 +235,25 @@
|
||||
<span class="user-name" style="${nameColor}">${username}</span>${badges}
|
||||
`;
|
||||
|
||||
// 单击/双击互斥:单击延迟 250ms 执行,双击取消单击定时器后直接执行双击逻辑
|
||||
let _clickTimer = null;
|
||||
item.onclick = () => {
|
||||
toUserSelect.value = username;
|
||||
document.getElementById('content').focus();
|
||||
if (_clickTimer) { return; }
|
||||
_clickTimer = setTimeout(() => {
|
||||
_clickTimer = null;
|
||||
toUserSelect.value = username;
|
||||
// 手机端:点击名字时关闭名单抽屉
|
||||
if (typeof closeMobileDrawer === 'function') { closeMobileDrawer(); }
|
||||
document.getElementById('content').focus();
|
||||
}, 250);
|
||||
};
|
||||
// 双击打开用户名片弹窗(全局统一入口);手机端同时关闭名单抽屉
|
||||
item.ondblclick = () => {
|
||||
// 取消尚未执行的单击定时器
|
||||
if (_clickTimer) { clearTimeout(_clickTimer); _clickTimer = null; }
|
||||
if (typeof closeMobileDrawer === 'function') { closeMobileDrawer(); }
|
||||
openUserCard(username);
|
||||
};
|
||||
// 双击打开用户名片弹窗(全局统一入口)
|
||||
item.ondblclick = () => openUserCard(username);
|
||||
targetContainer.appendChild(item);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user