@varlet/ui 2.8.6-alpha.1678026868230 → 2.8.6-alpha.1678028497778

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.
@@ -28,11 +28,7 @@ var __sfc__ = defineComponent({
28
28
  props,
29
29
 
30
30
  setup(props) {
31
- var endTime = ref(0);
32
- var isStart = ref(false);
33
31
  var showTime = ref('');
34
- var handle = ref(0);
35
- var pauseTime = ref(0);
36
32
  var timeData = ref({
37
33
  days: 0,
38
34
  hours: 0,
@@ -40,6 +36,10 @@ var __sfc__ = defineComponent({
40
36
  seconds: 0,
41
37
  milliseconds: 0
42
38
  });
39
+ var endTime = 0;
40
+ var isStart = false;
41
+ var handle = 0;
42
+ var remainingTime = 0;
43
43
  var cacheIsStart;
44
44
 
45
45
  var parseFormat = (format, time) => {
@@ -95,51 +95,46 @@ var __sfc__ = defineComponent({
95
95
  } = props;
96
96
  var now = performance.now();
97
97
 
98
- if (!endTime.value) {
99
- endTime.value = now + toNumber(time);
98
+ if (!endTime) {
99
+ endTime = now + toNumber(time);
100
100
  }
101
101
 
102
- var durationTime = endTime.value - now;
102
+ remainingTime = endTime - now;
103
103
 
104
- if (durationTime < 0) {
105
- durationTime = 0;
104
+ if (remainingTime < 0) {
105
+ remainingTime = 0;
106
106
  }
107
107
 
108
- pauseTime.value = durationTime;
109
- formatTime(durationTime);
108
+ formatTime(remainingTime);
110
109
 
111
- if (durationTime === 0) {
110
+ if (remainingTime === 0) {
112
111
  call(onEnd);
113
112
  return;
114
113
  }
115
114
 
116
- if (autoStart || isStart.value) {
117
- handle.value = requestAnimationFrame(countdown);
115
+ if (autoStart || isStart) {
116
+ handle = requestAnimationFrame(countdown);
118
117
  }
119
118
  }; // expose
120
119
 
121
120
 
122
121
  var start = () => {
123
- if (isStart.value) {
124
- return;
125
- }
126
-
127
- isStart.value = true;
128
- endTime.value = performance.now() + (pauseTime.value || toNumber(props.time));
122
+ isStart = true;
123
+ endTime = performance.now() + (remainingTime || toNumber(props.time));
129
124
  countdown();
130
125
  }; // expose
131
126
 
132
127
 
133
128
  var pause = () => {
134
- isStart.value = false;
135
- cancelAnimationFrame(handle.value);
129
+ isStart = false;
130
+ cancelAnimationFrame(handle);
136
131
  }; // expose
137
132
 
138
133
 
139
134
  var reset = () => {
140
- endTime.value = 0;
141
- isStart.value = false;
142
- cancelAnimationFrame(handle.value);
135
+ endTime = 0;
136
+ isStart = false;
137
+ cancelAnimationFrame(handle);
143
138
  countdown();
144
139
  };
145
140
 
@@ -151,14 +146,14 @@ var __sfc__ = defineComponent({
151
146
  return;
152
147
  }
153
148
 
154
- isStart.value = cacheIsStart;
149
+ isStart = cacheIsStart;
155
150
 
156
- if (isStart.value === true) {
157
- countdown();
151
+ if (isStart === true) {
152
+ start();
158
153
  }
159
154
  });
160
155
  onDeactivated(() => {
161
- cacheIsStart = isStart.value;
156
+ cacheIsStart = isStart;
162
157
  pause();
163
158
  });
164
159
  onUnmounted(pause);
@@ -235,7 +235,7 @@ import './time-picker/style/index.mjs'
235
235
  import './tooltip/style/index.mjs'
236
236
  import './uploader/style/index.mjs'
237
237
 
238
- const version = '2.8.6-alpha.1678026868230'
238
+ const version = '2.8.6-alpha.1678028497778'
239
239
 
240
240
  function install(app) {
241
241
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -156,7 +156,7 @@ export * from './time-picker/index.mjs'
156
156
  export * from './tooltip/index.mjs'
157
157
  export * from './uploader/index.mjs'
158
158
 
159
- const version = '2.8.6-alpha.1678026868230'
159
+ const version = '2.8.6-alpha.1678028497778'
160
160
 
161
161
  function install(app) {
162
162
  ActionSheet.install && app.use(ActionSheet)