```
feat(sidepanel): 优化时间戳工具界面与交互功能 - 调整 CSS 样式,增加 #current-timestamp 区块样式定义,统一阴影写法空格格式 - 重构 HTML 结构,将当前时间戳相关元素包裹进 div 容器中,并调整按钮布局 - 限制时区列表为常用时区,提升选择效率并确保兼容性 - 改进切换单位和复制按钮的反馈效果,添加动画提示增强用户体验 - 精简 updateTimestamp 函数逻辑,移除冗余代码并提高可维护性 ```
This commit is contained in:
@@ -3,16 +3,13 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 更新时间戳显示
|
||||
* 更新时间戳
|
||||
* @param {boolean} showMilliseconds - 是否显示毫秒
|
||||
*/
|
||||
export function updateTimestamp(showMilliseconds = true) {
|
||||
const currentTimestamp = document.getElementById('current-timestamp-value');
|
||||
const currentTimestampUnit = document.getElementById('current-timestamp-unit');
|
||||
const timestamp = Date.now();
|
||||
const unit = showMilliseconds ? '毫秒' : '秒';
|
||||
currentTimestamp.textContent = showMilliseconds ? timestamp : Math.floor(timestamp / 1000);
|
||||
currentTimestampUnit.textContent = unit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user