@xtdev/xt-miniprogram-ui 1.2.50 → 1.2.52

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.
@@ -79,6 +79,7 @@ Component({
79
79
  }
80
80
  },
81
81
  data: {
82
+ show: false,
82
83
  years: [], // 年份数组
83
84
  months: [], // 月份数组
84
85
  days: [], // 天份数组
@@ -378,6 +379,12 @@ Component({
378
379
  dateArr
379
380
  })
380
381
  },
382
+ // 关闭选择器
383
+ onClose() {
384
+ this.onReset();
385
+ this.setData({ show: false });
386
+ this.triggerEvent("onClose", {});
387
+ },
381
388
  // 重置时间
382
389
  onReset() {
383
390
  this.initPickerArr();
@@ -404,6 +411,7 @@ Component({
404
411
  endDateValue: '',
405
412
  })
406
413
  }
414
+ this.triggerEvent("onReset", {});
407
415
  },
408
416
  // 确认选择时间
409
417
  onConfirm() {
@@ -4,7 +4,7 @@
4
4
  <!-- 顶部标题+关闭按钮 -->
5
5
  <view class="xt-popup-head">
6
6
  <view class="xt-popup-head-text">{{title}}</view>
7
- <xt-icon icon="shibai-xiao" class="shibai-xiao" size="48"/>
7
+ <xt-icon catchtap="onClose" icon="shibai-xiao" class="shibai-xiao" size="48"/>
8
8
  </view>
9
9
  <!-- 分割线 -->
10
10
  <view class="head-border"></view>
@@ -615,11 +615,13 @@ Component({
615
615
  endDateValue: ''
616
616
  })
617
617
  }
618
+ this.triggerEvent("onReset", {});
618
619
  },
619
620
  // 关闭选择器
620
621
  onClose() {
621
622
  this.onReset();
622
623
  this.setData({ show: false });
624
+ this.triggerEvent("onClose", {});
623
625
  },
624
626
  // 确认选择时间
625
627
  onConfirm() {
@@ -1,5 +1,22 @@
1
1
  // src/xt-uploader/index.js
2
2
  const utils = require("./utils");
3
+ // 节流函数
4
+ function _throttle(fn, wait = 500, isImmediate = false){
5
+ var flag = true;
6
+ return function(){
7
+ if(flag == true){
8
+ var context = this
9
+ var args = arguments
10
+ flag = false
11
+ isImmediate && fn.apply(context,args)
12
+ setTimeout(() => {
13
+ !isImmediate && fn.apply(context,args)
14
+ flag = true
15
+ },wait)
16
+ }
17
+ }
18
+ }
19
+
3
20
  Component({
4
21
  /**
5
22
  * 组件的属性列表
@@ -78,7 +95,8 @@ Component({
78
95
  this.triggerEvent("error", { errMsg });
79
96
  },
80
97
  // 点击上传
81
- startTakePhoto() {
98
+ startTakePhoto: _throttle(function (e) {
99
+ console.log("onStartTakePhoto", e);
82
100
  const _this = this;
83
101
  const {
84
102
  customUpload,
@@ -142,7 +160,7 @@ Component({
142
160
  console.log("-----选取失败", error && error.errMsg);
143
161
  },
144
162
  });
145
- },
163
+ }, 1500, true),
146
164
  getSystemInfo() {
147
165
  const environment = wx.getSystemInfoSync().environment || "wechat";
148
166
  const platform = wx.getSystemInfoSync().platform;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtdev/xt-miniprogram-ui",
3
- "version": "1.2.50",
3
+ "version": "1.2.52",
4
4
  "description": "",
5
5
  "miniprogram": "libs",
6
6
  "publishConfig": {