@tuya-miniapp/smart-ui 2.3.1 → 2.3.2-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.
@@ -92,6 +92,12 @@ SmartComponent({
92
92
  innerValue: Date.now(),
93
93
  columns: [],
94
94
  },
95
+ created() {
96
+ const innerValue = this.correctValue(this.data.value);
97
+ this.updateColumnValue(innerValue).then(() => {
98
+ this.$emit('input', innerValue);
99
+ });
100
+ },
95
101
  methods: {
96
102
  updateValue() {
97
103
  const { data } = this;
@@ -368,11 +374,11 @@ SmartComponent({
368
374
  .then(() => this.updateColumns())
369
375
  .then(() => picker.setValues(values));
370
376
  },
371
- },
372
- created() {
373
- const innerValue = this.correctValue(this.data.value);
374
- this.updateColumnValue(innerValue).then(() => {
375
- this.$emit('input', innerValue);
376
- });
377
+ onAnimationStart() {
378
+ this.$emit('animation-start');
379
+ },
380
+ onAnimationEnd() {
381
+ this.$emit('animation-end');
382
+ },
377
383
  },
378
384
  });
@@ -14,4 +14,6 @@
14
14
  bind:change="onChange"
15
15
  bind:confirm="onConfirm"
16
16
  bind:cancel="onCancel"
17
+ bind:animation-start="onAnimationStart"
18
+ bind:animation-end="onAnimationEnd"
17
19
  />
@@ -26,6 +26,8 @@ SmartComponent({
26
26
  type: Array,
27
27
  value: [],
28
28
  observer(value) {
29
+ if (!this.data.isInit)
30
+ return;
29
31
  this.updateUint(value);
30
32
  this.updateVisibleOptions(this.data.currentIndex);
31
33
  },
@@ -42,6 +44,8 @@ SmartComponent({
42
44
  type: Number,
43
45
  value: -1,
44
46
  observer(index) {
47
+ if (!this.data.isInit)
48
+ return;
45
49
  this.setIndex(index, false, this.data.changeAnimation);
46
50
  },
47
51
  },
@@ -61,6 +65,7 @@ SmartComponent({
61
65
  renderStart: 0,
62
66
  animate: false,
63
67
  playing: false,
68
+ isInit: false,
64
69
  maxText: '',
65
70
  timer: null,
66
71
  preOffsetList: [],
@@ -69,6 +74,9 @@ SmartComponent({
69
74
  const { defaultIndex, activeIndex, options } = this.data;
70
75
  this.updateUint(options);
71
76
  this.setIndex(activeIndex !== -1 ? activeIndex : defaultIndex, false, this.data.changeAnimation);
77
+ this.setData({
78
+ isInit: true,
79
+ });
72
80
  },
73
81
  methods: {
74
82
  getCount() {
@@ -116,6 +116,13 @@ var defaultFormatter = function (type, value) {
116
116
  innerValue: Date.now(),
117
117
  columns: [],
118
118
  },
119
+ created: function () {
120
+ var _this = this;
121
+ var innerValue = this.correctValue(this.data.value);
122
+ this.updateColumnValue(innerValue).then(function () {
123
+ _this.$emit('input', innerValue);
124
+ });
125
+ },
119
126
  methods: {
120
127
  updateValue: function () {
121
128
  var _this = this;
@@ -404,12 +411,11 @@ var defaultFormatter = function (type, value) {
404
411
  .then(function () { return _this.updateColumns(); })
405
412
  .then(function () { return picker.setValues(values); });
406
413
  },
407
- },
408
- created: function () {
409
- var _this = this;
410
- var innerValue = this.correctValue(this.data.value);
411
- this.updateColumnValue(innerValue).then(function () {
412
- _this.$emit('input', innerValue);
413
- });
414
+ onAnimationStart: function () {
415
+ this.$emit('animation-start');
416
+ },
417
+ onAnimationEnd: function () {
418
+ this.$emit('animation-end');
419
+ },
414
420
  },
415
421
  });
@@ -14,4 +14,6 @@
14
14
  bind:change="onChange"
15
15
  bind:confirm="onConfirm"
16
16
  bind:cancel="onCancel"
17
+ bind:animation-start="onAnimationStart"
18
+ bind:animation-end="onAnimationEnd"
17
19
  />
@@ -64,6 +64,8 @@ var DEFAULT_DURATION = 400;
64
64
  type: Array,
65
65
  value: [],
66
66
  observer: function (value) {
67
+ if (!this.data.isInit)
68
+ return;
67
69
  this.updateUint(value);
68
70
  this.updateVisibleOptions(this.data.currentIndex);
69
71
  },
@@ -80,6 +82,8 @@ var DEFAULT_DURATION = 400;
80
82
  type: Number,
81
83
  value: -1,
82
84
  observer: function (index) {
85
+ if (!this.data.isInit)
86
+ return;
83
87
  this.setIndex(index, false, this.data.changeAnimation);
84
88
  },
85
89
  },
@@ -99,6 +103,7 @@ var DEFAULT_DURATION = 400;
99
103
  renderStart: 0,
100
104
  animate: false,
101
105
  playing: false,
106
+ isInit: false,
102
107
  maxText: '',
103
108
  timer: null,
104
109
  preOffsetList: [],
@@ -107,6 +112,9 @@ var DEFAULT_DURATION = 400;
107
112
  var _a = this.data, defaultIndex = _a.defaultIndex, activeIndex = _a.activeIndex, options = _a.options;
108
113
  this.updateUint(options);
109
114
  this.setIndex(activeIndex !== -1 ? activeIndex : defaultIndex, false, this.data.changeAnimation);
115
+ this.setData({
116
+ isInit: true,
117
+ });
110
118
  },
111
119
  methods: {
112
120
  getCount: function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.3.1",
3
+ "version": "2.3.2-beta-2",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",