修复:签到按钮点击无效
daily-sign-in.js 之前是懒加载,但模块在顶层设置了 window.openDailySignInModal 等全局函数,且 bindDailySignInControls() 注册事件委托。由于模块从未被触发加载,签到按钮点击无响应。 恢复为静态导入,问题和 Alpine 组件一样。chat.js 从 170KB 增至 184KB(原 308KB,↓40%)
This commit is contained in:
@@ -205,10 +205,6 @@ const _redPacket = createLazyModule(
|
|||||||
() => import("./chat-room/red-packet-panel.js"),
|
() => import("./chat-room/red-packet-panel.js"),
|
||||||
(mod) => mod.bindRedPacketPanelControls()
|
(mod) => mod.bindRedPacketPanelControls()
|
||||||
);
|
);
|
||||||
const _dailySignIn = createLazyModule(
|
|
||||||
() => import("./chat-room/daily-sign-in.js"),
|
|
||||||
(mod) => mod.bindDailySignInControls()
|
|
||||||
);
|
|
||||||
const _mobileDrawer = createLazyModule(
|
const _mobileDrawer = createLazyModule(
|
||||||
() => import("./chat-room/mobile-drawer.js"),
|
() => import("./chat-room/mobile-drawer.js"),
|
||||||
(mod) => mod.bindMobileDrawerControls()
|
(mod) => mod.bindMobileDrawerControls()
|
||||||
@@ -289,6 +285,9 @@ import { fortunePanel, bindFortunePanelControls } from "./chat-room/fortune-pane
|
|||||||
import { lotteryPanel, bindLotteryPanelControls, closeLotteryPanel, openLotteryPanel, showLotteryMsg } from "./chat-room/lottery-panel.js";
|
import { lotteryPanel, bindLotteryPanelControls, closeLotteryPanel, openLotteryPanel, showLotteryMsg } from "./chat-room/lottery-panel.js";
|
||||||
import { gomokuPanel, bindGomokuPanelControls } from "./chat-room/gomoku-panel.js";
|
import { gomokuPanel, bindGomokuPanelControls } from "./chat-room/gomoku-panel.js";
|
||||||
|
|
||||||
|
// ─── 事件委托模块(需要立即注册事件监听,静态导入)─────────────────────
|
||||||
|
import { bindDailySignInControls } from "./chat-room/daily-sign-in.js";
|
||||||
|
|
||||||
// ─── 轻量核心模块(保持静态导入)────────────────────
|
// ─── 轻量核心模块(保持静态导入)────────────────────
|
||||||
import { escapeHtml, escapeHtmlWithLineBreaks, normalizeSafeChatUrl } from "./chat-room/html.js";
|
import { escapeHtml, escapeHtmlWithLineBreaks, normalizeSafeChatUrl } from "./chat-room/html.js";
|
||||||
import { bindGlobalDialogControls } from "./chat-room/dialog.js";
|
import { bindGlobalDialogControls } from "./chat-room/dialog.js";
|
||||||
@@ -433,7 +432,6 @@ if (typeof window !== "undefined") {
|
|||||||
bindChatBotControls: (...args) => _chatBot.wrap('bindChatBotControls')(...args),
|
bindChatBotControls: (...args) => _chatBot.wrap('bindChatBotControls')(...args),
|
||||||
clearChatBotContext: (...args) => _chatBot.wrap('clearChatBotContext')(...args),
|
clearChatBotContext: (...args) => _chatBot.wrap('clearChatBotContext')(...args),
|
||||||
sendToChatBot: (...args) => _chatBot.wrap('sendToChatBot')(...args),
|
sendToChatBot: (...args) => _chatBot.wrap('sendToChatBot')(...args),
|
||||||
bindDailySignInControls: (...args) => _dailySignIn.wrap('bindDailySignInControls')(...args),
|
|
||||||
applyFontSize: (...args) => _fontSize.wrap('applyFontSize')(...args),
|
applyFontSize: (...args) => _fontSize.wrap('applyFontSize')(...args),
|
||||||
bindChatFontSizeControl: (...args) => _fontSize.wrap('bindChatFontSizeControl')(...args),
|
bindChatFontSizeControl: (...args) => _fontSize.wrap('bindChatFontSizeControl')(...args),
|
||||||
CHAT_FONT_SIZE_STORAGE_KEY: undefined,
|
CHAT_FONT_SIZE_STORAGE_KEY: undefined,
|
||||||
@@ -790,4 +788,5 @@ if (typeof window !== "undefined") {
|
|||||||
bindFortunePanelControls();
|
bindFortunePanelControls();
|
||||||
bindLotteryPanelControls();
|
bindLotteryPanelControls();
|
||||||
bindGomokuPanelControls();
|
bindGomokuPanelControls();
|
||||||
|
bindDailySignInControls();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user