@nutui/nutui 4.0.6-beta.1 → 4.0.6-beta.2

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.
@@ -168,30 +168,7 @@ const _sfc_main = create({
168
168
  range: [minSeconds, maxSeconds]
169
169
  }
170
170
  ];
171
- switch (props.type) {
172
- case "date":
173
- result = result.slice(0, 3);
174
- break;
175
- case "datetime":
176
- result = result.slice(0, 5);
177
- break;
178
- case "time":
179
- result = result.slice(3, 6);
180
- break;
181
- case "year-month":
182
- result = result.slice(0, 2);
183
- break;
184
- case "month-day":
185
- result = result.slice(1, 3);
186
- break;
187
- case "datehour":
188
- result = result.slice(0, 4);
189
- break;
190
- case "hour-minute":
191
- result = result.slice(3, 5);
192
- break;
193
- }
194
- return result;
171
+ return generateList(result);
195
172
  });
196
173
  const columns = computed(() => {
197
174
  const val = ranges.value.map((res, columnIndex) => {
@@ -281,6 +258,43 @@ const _sfc_main = create({
281
258
  const confirm = (val) => {
282
259
  emit("confirm", val);
283
260
  };
261
+ const generateList = (list) => {
262
+ switch (props.type) {
263
+ case "date":
264
+ list = list.slice(0, 3);
265
+ break;
266
+ case "datetime":
267
+ list = list.slice(0, 5);
268
+ break;
269
+ case "time":
270
+ list = list.slice(3, 6);
271
+ break;
272
+ case "year-month":
273
+ list = list.slice(0, 2);
274
+ break;
275
+ case "month-day":
276
+ list = list.slice(1, 3);
277
+ break;
278
+ case "datehour":
279
+ list = list.slice(0, 4);
280
+ break;
281
+ case "hour-minute":
282
+ list = list.slice(3, 5);
283
+ break;
284
+ }
285
+ return list;
286
+ };
287
+ const getSelectedValue = (time) => {
288
+ const res = [
289
+ time.getFullYear(),
290
+ time.getMonth() + 1,
291
+ time.getDate(),
292
+ time.getHours(),
293
+ time.getMinutes(),
294
+ time.getSeconds()
295
+ ];
296
+ return generateList(res.map((i) => String(i)));
297
+ };
284
298
  onBeforeMount(() => {
285
299
  state.currentDate = formatValue(props.modelValue);
286
300
  });
@@ -291,6 +305,7 @@ const _sfc_main = create({
291
305
  const isSameValue = JSON.stringify(newValues) === JSON.stringify(state.currentDate);
292
306
  if (!isSameValue) {
293
307
  state.currentDate = newValues;
308
+ state.selectedValue = getSelectedValue(newValues);
294
309
  }
295
310
  }
296
311
  );
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
4
  "name": "NutUI",
5
- "version": "4.0.6-beta.1",
5
+ "version": "4.0.6-beta.2",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "tags": [