雨霖铃
2025-11-25 01:07:46 +08:00
parent a4c331bd8b
commit ed6053473d
9 changed files with 400 additions and 143 deletions
+17
View File
@@ -0,0 +1,17 @@
// 导入时间戳工具的初始化函数和事件处理
import './timestamp.js';
// 导入页面切换功能
import { switchPage } from '../utils/domUtils.js';
// 页面切换逻辑
import { addEventListenerById } from '../utils/domUtils.js';
addEventListenerById('nav-timestamp-btn', 'click', () => {
switchPage('timestamp');
});
// 计时器页面切换
addEventListenerById('nav-other-tools-btn', 'click', () => {
switchPage('other-tools');
});
+35
View File
@@ -0,0 +1,35 @@
import {
initTimestampDisplay,
handleToggleUnit,
handleStopTimer,
handleStartTimer,
handleConvertTimestamp,
handleConvertDateToTimestamp,
handleCopyTimestamp,
handleClosePanel,
handleTimezoneResult,
handleTimezoneInput,
} from '../modules/eventHandlers.js';
import { addEventListenerById } from '../utils/domUtils.js';
// 初始化时间戳显示
initTimestampDisplay();
// 绑定事件处理器
// 绑定时间戳相关按钮事件
addEventListenerById('toggle-unit-btn', 'click', handleToggleUnit);
// 绑定计时器相关按钮事件
addEventListenerById('stop-timer-btn', 'click', handleStopTimer);
addEventListenerById('start-timer-btn', 'click', handleStartTimer);
// 绑定时间戳转换按钮事件
addEventListenerById('convert-timestamp-to-date-btn', 'click', handleConvertTimestamp);
// 绑定日期转换按钮事件
addEventListenerById('convert-date-to-timestamp-btn', 'click', handleConvertDateToTimestamp);
// 绑定复制时间戳按钮事件
addEventListenerById('copy-timestamp-btn', 'click', handleCopyTimestamp);
// 绑定关闭面板按钮事件
addEventListenerById('close-panel-btn', 'click', handleClosePanel);
// 绑定切换时区事件
addEventListenerById('timezone-result', 'change', handleTimezoneResult);
// 绑定输入时区事件
addEventListenerById('timezone-input', 'change', handleTimezoneInput);