Skip to content

Commit d3f202a

Browse files
committed
refactor: 修复缓存导致数字不更新问题
1 parent fc34c3c commit d3f202a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/BootstrapBlazor/Components/FlipClock/FlipClock.razor.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
return;
1313
}
1414

15-
const lastValues = {};
1615
let counter = 0;
1716
let totalMilliseconds = 0;
1817
let countDown = false;
@@ -73,13 +72,11 @@
7372
const d = getDate();
7473
const unitConfig = getConfig();
7574
unitConfig.forEach(({ key, list, digits }) => {
76-
if (list === null) return;
77-
78-
const v = d[key];
79-
if (lastValues[key] !== v) {
80-
lastValues[key] = v;
81-
setDigits(list, v, digits, countDown);
75+
if (list === null) {
76+
return;
8277
}
78+
79+
setDigits(list, d[key], digits, countDown);
8380
});
8481
return d;
8582
};

0 commit comments

Comments
 (0)