补充前端事件代理说明注释

This commit is contained in:
2026-04-25 10:04:30 +08:00
parent 308e5690fe
commit d012b3e73b
3 changed files with 8 additions and 0 deletions
@@ -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");