@tuya-miniapp/smart-ui 2.6.0-beta-4 → 2.6.0-beta-5

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.
@@ -100,20 +100,20 @@ SmartComponent({
100
100
  },
101
101
  created() {
102
102
  const innerValue = this.correctValue(this.data.value);
103
- this.updateColumnValue(innerValue).then(() => {
103
+ this.updateColumnValue(innerValue);
104
+ if (innerValue !== this.data.value) {
104
105
  this.$emit('input', innerValue);
105
- });
106
+ }
106
107
  },
107
108
  methods: {
108
109
  updateValue() {
109
110
  const { data } = this;
110
111
  const val = this.correctValue(data.value);
111
112
  const isEqual = val === data.innerValue;
112
- this.updateColumnValue(val).then(() => {
113
- if (!isEqual) {
114
- this.$emit('input', val);
115
- }
116
- });
113
+ this.updateColumnValue(val);
114
+ if (!isEqual) {
115
+ this.$emit('input', val);
116
+ }
117
117
  },
118
118
  getPicker() {
119
119
  if (this.picker == null) {
@@ -348,11 +348,10 @@ SmartComponent({
348
348
  value = new Date(year, month - 1, date, hour, minute);
349
349
  }
350
350
  value = this.correctValue(value, true);
351
- this.updateColumnValue(value).then(() => {
352
- picker.value = value;
353
- this.$emit('input', value);
354
- this.$emit('change', picker);
355
- });
351
+ this.updateColumnValue(value);
352
+ picker.value = value;
353
+ this.$emit('input', value);
354
+ this.$emit('change', picker);
356
355
  },
357
356
  updateColumnValue(value) {
358
357
  let values = [];
@@ -388,9 +387,12 @@ SmartComponent({
388
387
  values.push(formatter('day', padZero(date.getDate()), this.data), formatter('hour', padZero(date.getHours()), this.data), formatter('minute', padZero(date.getMinutes()), this.data));
389
388
  }
390
389
  }
391
- return this.set({ innerValue: value })
392
- .then(() => this.updateColumns())
393
- .then(() => picker.setValues(values));
390
+ this.setData({ innerValue: value });
391
+ this.updateColumns();
392
+ picker.setValues(values);
393
+ // return this.set({ innerValue: value })
394
+ // .then(() => this.updateColumns())
395
+ // .then(() => picker.setValues(values));
394
396
  },
395
397
  onAnimationStart() {
396
398
  this.$emit('animation-start');
@@ -123,23 +123,21 @@ var defaultFormatter = function (type, value) {
123
123
  columns: [],
124
124
  },
125
125
  created: function () {
126
- var _this = this;
127
126
  var innerValue = this.correctValue(this.data.value);
128
- this.updateColumnValue(innerValue).then(function () {
129
- _this.$emit('input', innerValue);
130
- });
127
+ this.updateColumnValue(innerValue);
128
+ if (innerValue !== this.data.value) {
129
+ this.$emit('input', innerValue);
130
+ }
131
131
  },
132
132
  methods: {
133
133
  updateValue: function () {
134
- var _this = this;
135
134
  var data = this.data;
136
135
  var val = this.correctValue(data.value);
137
136
  var isEqual = val === data.innerValue;
138
- this.updateColumnValue(val).then(function () {
139
- if (!isEqual) {
140
- _this.$emit('input', val);
141
- }
142
- });
137
+ this.updateColumnValue(val);
138
+ if (!isEqual) {
139
+ this.$emit('input', val);
140
+ }
143
141
  },
144
142
  getPicker: function () {
145
143
  if (this.picker == null) {
@@ -343,7 +341,6 @@ var defaultFormatter = function (type, value) {
343
341
  this.$emit('confirm', this.data.innerValue);
344
342
  },
345
343
  onChange: function () {
346
- var _this = this;
347
344
  var data = this.data;
348
345
  var value;
349
346
  var picker = this.getPicker();
@@ -384,14 +381,12 @@ var defaultFormatter = function (type, value) {
384
381
  value = new Date(year, month - 1, date, hour, minute);
385
382
  }
386
383
  value = this.correctValue(value, true);
387
- this.updateColumnValue(value).then(function () {
388
- picker.value = value;
389
- _this.$emit('input', value);
390
- _this.$emit('change', picker);
391
- });
384
+ this.updateColumnValue(value);
385
+ picker.value = value;
386
+ this.$emit('input', value);
387
+ this.$emit('change', picker);
392
388
  },
393
389
  updateColumnValue: function (value) {
394
- var _this = this;
395
390
  var values = [];
396
391
  var _a = this.data, type = _a.type, is12HourClock = _a.is12HourClock;
397
392
  var formatter = this.formatterFunc;
@@ -425,9 +420,12 @@ var defaultFormatter = function (type, value) {
425
420
  values.push(formatter('day', padZero(date.getDate()), this.data), formatter('hour', padZero(date.getHours()), this.data), formatter('minute', padZero(date.getMinutes()), this.data));
426
421
  }
427
422
  }
428
- return this.set({ innerValue: value })
429
- .then(function () { return _this.updateColumns(); })
430
- .then(function () { return picker.setValues(values); });
423
+ this.setData({ innerValue: value });
424
+ this.updateColumns();
425
+ picker.setValues(values);
426
+ // return this.set({ innerValue: value })
427
+ // .then(() => this.updateColumns())
428
+ // .then(() => picker.setValues(values));
431
429
  },
432
430
  onAnimationStart: function () {
433
431
  this.$emit('animation-start');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.6.0-beta-4",
3
+ "version": "2.6.0-beta-5",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",