@tuya-miniapp/smart-ui 2.3.4-beta-1 → 2.3.4-beta-3

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.
@@ -23,6 +23,10 @@ SmartComponent({
23
23
  show: {
24
24
  type: Boolean,
25
25
  observer(value) {
26
+ if (this.data.cancel_timer) {
27
+ clearTimeout(this.data.cancel_timer);
28
+ this.data.cancel_timer = null;
29
+ }
26
30
  if (value !== this.data.currentShow) {
27
31
  if (value) {
28
32
  this.onOpen();
@@ -46,7 +50,7 @@ SmartComponent({
46
50
  value: 20000,
47
51
  },
48
52
  },
49
- data: { currentShow: false, showStyle: '' },
53
+ data: { currentShow: false, showStyle: '', cancel_timer: null },
50
54
  mounted() { },
51
55
  created() { },
52
56
  methods: {
@@ -160,6 +164,7 @@ SmartComponent({
160
164
  onClick() {
161
165
  this.onOpen();
162
166
  },
167
+ noop() { },
163
168
  onOpen() {
164
169
  this.getButtonPosition();
165
170
  this.setData({
@@ -172,7 +177,7 @@ SmartComponent({
172
177
  }, 100);
173
178
  this.$emit('show-change', true);
174
179
  if (this.data.duration) {
175
- setTimeout(() => {
180
+ this.data.cancel_timer = setTimeout(() => {
176
181
  this.onClose();
177
182
  }, this.data.duration);
178
183
  }
@@ -14,7 +14,7 @@
14
14
 
15
15
  <view class="smart-popover-button" catch:tap="onClick">
16
16
  <slot />
17
- <view wx:if="{{currentShow}}" class="smart-popover-overlay" style="left: {{left}};top: {{top}}; bottom:{{bottom}};right:{{right}}; transform:{{transform}}; {{customStyle}}; {{showStyle}}">
17
+ <view catch:tap="noop" wx:if="{{currentShow}}" class="smart-popover-overlay" style="left: {{left}};top: {{top}}; bottom:{{bottom}};right:{{right}}; transform:{{transform}}; {{customStyle}}; {{showStyle}}">
18
18
  <slot name="overlay" />
19
19
  <view class="smart-popover-overlay-arrow" style="background-image: url('{{iconSrc}}'); transform: {{iconTransform}}; {{iconPos}}: {{iconPosVal}}px;width: {{iconWidth}};height:{{iconHeight}};background-size: {{iconWidth}} {{iconHeight}};{{iconStyle}}"></view>
20
20
  </view>
@@ -38,6 +38,10 @@ function createSvgIcon(svg) {
38
38
  show: {
39
39
  type: Boolean,
40
40
  observer: function (value) {
41
+ if (this.data.cancel_timer) {
42
+ clearTimeout(this.data.cancel_timer);
43
+ this.data.cancel_timer = null;
44
+ }
41
45
  if (value !== this.data.currentShow) {
42
46
  if (value) {
43
47
  this.onOpen();
@@ -61,7 +65,7 @@ function createSvgIcon(svg) {
61
65
  value: 20000,
62
66
  },
63
67
  },
64
- data: { currentShow: false, showStyle: '' },
68
+ data: { currentShow: false, showStyle: '', cancel_timer: null },
65
69
  mounted: function () { },
66
70
  created: function () { },
67
71
  methods: {
@@ -175,6 +179,7 @@ function createSvgIcon(svg) {
175
179
  onClick: function () {
176
180
  this.onOpen();
177
181
  },
182
+ noop: function () { },
178
183
  onOpen: function () {
179
184
  var _this = this;
180
185
  this.getButtonPosition();
@@ -188,7 +193,7 @@ function createSvgIcon(svg) {
188
193
  }, 100);
189
194
  this.$emit('show-change', true);
190
195
  if (this.data.duration) {
191
- setTimeout(function () {
196
+ this.data.cancel_timer = setTimeout(function () {
192
197
  _this.onClose();
193
198
  }, this.data.duration);
194
199
  }
@@ -14,7 +14,7 @@
14
14
 
15
15
  <view class="smart-popover-button" catch:tap="onClick">
16
16
  <slot />
17
- <view wx:if="{{currentShow}}" class="smart-popover-overlay" style="left: {{left}};top: {{top}}; bottom:{{bottom}};right:{{right}}; transform:{{transform}}; {{customStyle}}; {{showStyle}}">
17
+ <view catch:tap="noop" wx:if="{{currentShow}}" class="smart-popover-overlay" style="left: {{left}};top: {{top}}; bottom:{{bottom}};right:{{right}}; transform:{{transform}}; {{customStyle}}; {{showStyle}}">
18
18
  <slot name="overlay" />
19
19
  <view class="smart-popover-overlay-arrow" style="background-image: url('{{iconSrc}}'); transform: {{iconTransform}}; {{iconPos}}: {{iconPosVal}}px;width: {{iconWidth}};height:{{iconHeight}};background-size: {{iconWidth}} {{iconHeight}};{{iconStyle}}"></view>
20
20
  </view>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuya-miniapp/smart-ui",
3
- "version": "2.3.4-beta-1",
3
+ "version": "2.3.4-beta-3",
4
4
  "author": "MiniApp Team",
5
5
  "license": "MIT",
6
6
  "miniprogram": "lib",