修复:签到按钮点击无效

daily-sign-in.js 之前是懒加载,但模块在顶层设置了 window.openDailySignInModal 等全局函数,且 bindDailySignInControls() 注册事件委托。由于模块从未被触发加载,签到按钮点击无响应。

恢复为静态导入,问题和 Alpine 组件一样。chat.js 从 170KB 增至 184KB(原 308KB,↓40%)
This commit is contained in:
pllx
2026-04-28 09:58:56 +08:00
parent eeb9dfbade
commit 790730e2c2
+4 -5
View File
@@ -205,10 +205,6 @@ const _redPacket = createLazyModule(
() => import("./chat-room/red-packet-panel.js"),
(mod) => mod.bindRedPacketPanelControls()
);
const _dailySignIn = createLazyModule(
() => import("./chat-room/daily-sign-in.js"),
(mod) => mod.bindDailySignInControls()
);
const _mobileDrawer = createLazyModule(
() => import("./chat-room/mobile-drawer.js"),
(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 { 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 { bindGlobalDialogControls } from "./chat-room/dialog.js";
@@ -433,7 +432,6 @@ if (typeof window !== "undefined") {
bindChatBotControls: (...args) => _chatBot.wrap('bindChatBotControls')(...args),
clearChatBotContext: (...args) => _chatBot.wrap('clearChatBotContext')(...args),
sendToChatBot: (...args) => _chatBot.wrap('sendToChatBot')(...args),
bindDailySignInControls: (...args) => _dailySignIn.wrap('bindDailySignInControls')(...args),
applyFontSize: (...args) => _fontSize.wrap('applyFontSize')(...args),
bindChatFontSizeControl: (...args) => _fontSize.wrap('bindChatFontSizeControl')(...args),
CHAT_FONT_SIZE_STORAGE_KEY: undefined,
@@ -790,4 +788,5 @@ if (typeof window !== "undefined") {
bindFortunePanelControls();
bindLotteryPanelControls();
bindGomokuPanelControls();
bindDailySignInControls();
}