补充前端事件代理说明注释
This commit is contained in:
@@ -10,6 +10,7 @@ let profileControlEventsBound = false;
|
||||
* @returns {void}
|
||||
*/
|
||||
function callGlobal(functionName, ...args) {
|
||||
// 头像与设置的大段业务仍在 Blade 内,模块阶段先集中桥接旧全局函数。
|
||||
if (typeof window[functionName] === "function") {
|
||||
window[functionName](...args);
|
||||
}
|
||||
@@ -31,6 +32,7 @@ export function bindProfileControls() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 头像选择器包含静态按钮和动态头像项,统一用 data-* 事件代理承接。
|
||||
if (event.target.closest("[data-avatar-picker-close]")) {
|
||||
event.preventDefault();
|
||||
callGlobal("closeAvatarPicker");
|
||||
@@ -56,6 +58,7 @@ export function bindProfileControls() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置弹窗的保存、验证码、微信绑定仍走原请求函数,避免迁移中改变接口行为。
|
||||
if (event.target.closest("[data-settings-save-password]")) {
|
||||
event.preventDefault();
|
||||
callGlobal("savePassword");
|
||||
|
||||
@@ -18,6 +18,7 @@ export function bindChatRightPanelControls() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 右侧名单和房间 tab 仍由 Blade 主脚本维护状态,这里只转发点击入口。
|
||||
const tabButton = event.target.closest("[data-chat-right-tab]");
|
||||
if (tabButton) {
|
||||
event.preventDefault();
|
||||
@@ -25,6 +26,7 @@ export function bindChatRightPanelControls() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 在线名单刷新函数仍在主聊天脚本中,后续渲染整体迁移后再收口到模块内。
|
||||
const refreshButton = event.target.closest("[data-chat-user-list-refresh]");
|
||||
if (refreshButton) {
|
||||
event.preventDefault();
|
||||
@@ -45,6 +47,7 @@ export function bindChatRightPanelControls() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 搜索输入高频触发,继续复用主脚本里的 RAF 节流渲染。
|
||||
window.scheduleFilterUserList?.();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ let vipControlEventsBound = false;
|
||||
* @returns {void}
|
||||
*/
|
||||
function callVipGlobal(functionName, ...args) {
|
||||
// VIP 业务函数暂留在 Blade 内,当前模块只统一按钮事件与旧函数调用边界。
|
||||
if (typeof window[functionName] === "function") {
|
||||
window[functionName](...args);
|
||||
}
|
||||
@@ -31,6 +32,7 @@ export function bindVipControls() {
|
||||
return;
|
||||
}
|
||||
|
||||
// VIP 内容由接口动态渲染,tab 和购买按钮通过 data-* 代理避免重复绑定。
|
||||
const tabButton = event.target.closest("[data-vip-tab]");
|
||||
if (tabButton) {
|
||||
event.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user