@xtdev/xt-miniprogram-ui 1.2.49 → 1.2.51

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: [], // 天份数组
@@ -93,7 +94,6 @@ Component({
93
94
  endDateStr: '', // 结束日期字符
94
95
  defaultDate: '', // 默认日期(组件接收的|当前时间)
95
96
  checkedType: 'start', // 当前选择的日期类型
96
- clickedEnd: false, // 点击结束时间
97
97
  filtType: 'dateRange', // 选择器模式
98
98
  typeEnums: {
99
99
  date: '按日筛选',
@@ -346,10 +346,8 @@ Component({
346
346
  // 切换日期类型
347
347
  switchDateType(e) {
348
348
  const checkedType = e.currentTarget.dataset.type;
349
- const { data: { clickedEnd } } = this;
350
349
  this.setData({
351
350
  checkedType,
352
- clickedEnd: checkedType === 'end' ? true : clickedEnd
353
351
  });
354
352
  this.showCheckedPicker();
355
353
  },
@@ -381,6 +379,12 @@ Component({
381
379
  dateArr
382
380
  })
383
381
  },
382
+ // 关闭选择器
383
+ onClose() {
384
+ this.onReset();
385
+ this.setData({ show: false });
386
+ this.triggerEvent("onClose", {});
387
+ },
384
388
  // 重置时间
385
389
  onReset() {
386
390
  this.initPickerArr();
@@ -405,9 +409,9 @@ Component({
405
409
  endDateArr: [],
406
410
  endDateStr: '',
407
411
  endDateValue: '',
408
- clickedEnd: false
409
412
  })
410
413
  }
414
+ this.triggerEvent("onReset", {});
411
415
  },
412
416
  // 确认选择时间
413
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>
@@ -17,10 +17,12 @@
17
17
  <view class="date-sel">
18
18
  <view wx:if="{{filtType === 'date'}}" class="sel-sigle actived">{{dateStr}}</view>
19
19
  <view wx:else class="sel-range">
20
- <view catchtap="switchDateType" data-type="start" class="sel-start actived">{{startDateStr}}</view>
20
+ <view catchtap="switchDateType" data-type="start" class="sel-start {{checkedType == 'start' ? 'actived' : ''}}">
21
+ {{startDateStr}}
22
+ </view>
21
23
  <view>至</view>
22
- <view catchtap="switchDateType" data-type="end" class="sel-end {{clickedEnd ? 'actived' : ''}}">
23
- {{ clickedEnd ? endDateStr : '结束时间'}}
24
+ <view catchtap="switchDateType" data-type="end" class="sel-end {{checkedType == 'end' ? 'actived' : ''}}">
25
+ {{ endDateStr || '结束时间'}}
24
26
  </view>
25
27
  </view>
26
28
  </view>
@@ -107,7 +107,6 @@ Component({
107
107
  endDateStr: "", // 结束日期字符
108
108
  defaultDate: "", // 默认日期(组件接收的|当前时间)
109
109
  checkedType: "start", // 当前选择的日期类型
110
- clickedEnd: false, // 点击结束时间
111
110
  filtType: "dateRange", // 选择器模式
112
111
  btnDisabled: false, // 按钮禁用
113
112
  newDaysArr: [], // 新的天数数组列表,储存拖动之后的天数数组值,用于拖动结束后更新
@@ -551,12 +550,8 @@ Component({
551
550
  // 切换日期类型
552
551
  switchDateType(e) {
553
552
  const checkedType = e.currentTarget.dataset.type;
554
- const {
555
- data: { clickedEnd },
556
- } = this;
557
553
  this.setData({
558
554
  checkedType,
559
- clickedEnd: checkedType === "end" ? true : clickedEnd,
560
555
  });
561
556
  this.showCheckedPicker();
562
557
  },
@@ -617,15 +612,16 @@ Component({
617
612
  startDateStr: resetDateStr,
618
613
  endDateArr: [],
619
614
  endDateStr: '',
620
- endDateValue: '',
621
- clickedEnd: false
615
+ endDateValue: ''
622
616
  })
623
617
  }
618
+ this.triggerEvent("onReset", {});
624
619
  },
625
620
  // 关闭选择器
626
621
  onClose() {
627
622
  this.onReset();
628
623
  this.setData({ show: false });
624
+ this.triggerEvent("onClose", {});
629
625
  },
630
626
  // 确认选择时间
631
627
  onConfirm() {
@@ -17,10 +17,12 @@
17
17
  <view class="date-sel">
18
18
  <view wx:if="{{filtType === 'date' || filtType === 'yearMonth'}}" class="sel-sigle actived">{{dateStr}}</view>
19
19
  <view wx:else class="sel-range">
20
- <view catchtap="switchDateType" data-type="start" class="sel-start actived">{{startDateStr}}</view>
20
+ <view catchtap="switchDateType" data-type="start" class="sel-start {{checkedType == 'start' ? 'actived' : ''}}">
21
+ {{startDateStr}}
22
+ </view>
21
23
  <view>至</view>
22
- <view catchtap="switchDateType" data-type="end" class="sel-end {{clickedEnd ? 'actived' : ''}}">
23
- {{ clickedEnd ? endDateStr : '结束时间'}}
24
+ <view catchtap="switchDateType" data-type="end" class="sel-end {{checkedType == 'end' ? 'actived' : ''}}">
25
+ {{ endDateStr || '结束时间'}}
24
26
  </view>
25
27
  </view>
26
28
  </view>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtdev/xt-miniprogram-ui",
3
- "version": "1.2.49",
3
+ "version": "1.2.51",
4
4
  "description": "",
5
5
  "miniprogram": "libs",
6
6
  "publishConfig": {