@xtdev/xt-miniprogram-ui 1.2.81 → 1.2.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -73,12 +73,16 @@ Component({
|
|
|
73
73
|
* 启动时钟
|
|
74
74
|
*/
|
|
75
75
|
startClock() {
|
|
76
|
-
const {watermarkData} = this.properties;
|
|
77
|
-
const {currentTime = Date.now()} = watermarkData;
|
|
76
|
+
const { watermarkData } = this.properties;
|
|
77
|
+
const { currentTime = Date.now() } = watermarkData;
|
|
78
|
+
// 计算currentTime 与当前时间的时差
|
|
79
|
+
const timeDifference = Date.now() - new Date(currentTime).getTime();
|
|
78
80
|
const updateTime = () => {
|
|
79
|
-
const now = new Date(
|
|
81
|
+
const now = new Date(Date.now() - timeDifference);
|
|
80
82
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
81
83
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
84
|
+
// 秒
|
|
85
|
+
// const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
82
86
|
const year = now.getFullYear();
|
|
83
87
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
|
84
88
|
const day = String(now.getDate()).padStart(2, '0');
|
|
@@ -93,7 +97,6 @@ Component({
|
|
|
93
97
|
this.clockInterval = setInterval(updateTime, 1000);
|
|
94
98
|
},
|
|
95
99
|
|
|
96
|
-
|
|
97
100
|
/**
|
|
98
101
|
* 拍照
|
|
99
102
|
*/
|