Skip to content

Commit 967dce2

Browse files
committed
fix: 修复TypeScript 类型不匹配导致的编译错误
1 parent 925135b commit 967dce2

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/components/SerialSettings.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,15 @@ export default function SerialSettings() {
5353

5454
useEffect(() => { fetchPorts(); }, []);
5555

56-
const addSysLog = (msg: string) => addLog({ id: crypto.randomUUID(), type: 'sys', text: msg + '\n', time: getTimestamp(), isHex: false });
56+
// 修复点:在 addLog 中添加了 timestampMs 属性
57+
const addSysLog = (msg: string) => addLog({
58+
id: crypto.randomUUID(),
59+
type: 'sys',
60+
text: msg + '\n',
61+
time: getTimestamp(),
62+
isHex: false,
63+
timestampMs: Date.now() // 补全此必填字段
64+
});
5765

5866
const toggleConnection = async () => {
5967
if (isConnected) {
@@ -101,7 +109,7 @@ export default function SerialSettings() {
101109
{/* 串口配置面板 */}
102110
<div style={{ padding: "15px", borderBottom: "1px solid #eee" }}>
103111

104-
{/* 核心改动:视图切换下拉框 */}
112+
{/* 视图切换下拉框 */}
105113
<div style={{ marginBottom: "15px", display: "flex", alignItems: "center", gap: "8px" }}>
106114
<select
107115
value={activeView}

0 commit comments

Comments
 (0)