@tdesign/uniapp 0.7.0 → 0.7.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/action-sheet/README.en-US.md +1 -1
  3. package/dist/action-sheet/README.md +1 -1
  4. package/dist/action-sheet/action-sheet.vue +27 -12
  5. package/dist/action-sheet/computed.js +14 -0
  6. package/dist/action-sheet/type.ts +2 -2
  7. package/dist/avatar/avatar.vue +6 -6
  8. package/dist/avatar-group/avatar-group.vue +1 -3
  9. package/dist/back-top/back-top.vue +13 -15
  10. package/dist/badge/badge.vue +1 -3
  11. package/dist/button/README.en-US.md +5 -2
  12. package/dist/button/README.md +5 -2
  13. package/dist/button/button.vue +18 -14
  14. package/dist/button/props.ts +14 -0
  15. package/dist/button/type.ts +14 -0
  16. package/dist/calendar/README.en-US.md +1 -0
  17. package/dist/calendar/README.md +1 -0
  18. package/dist/calendar/calendar-header.vue +1 -3
  19. package/dist/calendar/calendar.vue +28 -19
  20. package/dist/calendar/props.ts +5 -0
  21. package/dist/calendar/template.vue +1 -3
  22. package/dist/calendar/type.ts +6 -0
  23. package/dist/cascader/cascader.vue +9 -7
  24. package/dist/cell/cell.vue +51 -35
  25. package/dist/cell-group/cell-group.vue +1 -3
  26. package/dist/check-tag/check-tag.vue +12 -15
  27. package/dist/checkbox/checkbox.vue +13 -15
  28. package/dist/col/col.vue +1 -3
  29. package/dist/collapse/collapse.vue +1 -3
  30. package/dist/collapse-panel/collapse-panel.vue +1 -3
  31. package/dist/color-picker/color-picker.vue +2 -4
  32. package/dist/color-picker/template.vue +1 -3
  33. package/dist/common/src/instantiationDecorator.js +14 -0
  34. package/dist/common/style/theme/index.css +42 -90
  35. package/dist/count-down/count-down.vue +2 -4
  36. package/dist/date-time-picker/date-time-picker.vue +1 -3
  37. package/dist/dialog/dialog.vue +67 -69
  38. package/dist/divider/divider.vue +1 -3
  39. package/dist/draggable/draggable.vue +1 -3
  40. package/dist/drawer/drawer.vue +1 -3
  41. package/dist/dropdown-item/dropdown-item.vue +1 -3
  42. package/dist/dropdown-menu/dropdown-menu.vue +12 -14
  43. package/dist/empty/empty.vue +1 -3
  44. package/dist/fab/fab.vue +1 -3
  45. package/dist/footer/footer.vue +1 -3
  46. package/dist/form/form.vue +1 -3
  47. package/dist/form-item/form-item.css +16 -11
  48. package/dist/form-item/form-item.vue +2 -7
  49. package/dist/grid/grid.vue +1 -3
  50. package/dist/grid-item/grid-item.vue +3 -5
  51. package/dist/guide/content.vue +1 -3
  52. package/dist/guide/guide.vue +25 -40
  53. package/dist/icon/icon.vue +2 -4
  54. package/dist/image/image.vue +1 -3
  55. package/dist/image-viewer/image-viewer.vue +27 -30
  56. package/dist/indexes/indexes.vue +13 -15
  57. package/dist/indexes-anchor/indexes-anchor.vue +1 -3
  58. package/dist/input/input.vue +31 -31
  59. package/dist/link/link.vue +25 -26
  60. package/dist/loading/loading.vue +2 -2
  61. package/dist/message/index.d.ts +1 -1
  62. package/dist/message/message.interface.ts +2 -1
  63. package/dist/message-item/message-item.vue +34 -36
  64. package/dist/mixins/page-scroll.js +1 -1
  65. package/dist/navbar/navbar.vue +46 -33
  66. package/dist/notice-bar/notice-bar.vue +24 -26
  67. package/dist/overlay/overlay.vue +5 -7
  68. package/dist/picker/picker.vue +3 -4
  69. package/dist/picker-item/picker-item.vue +2 -4
  70. package/dist/popover/popover.vue +1 -3
  71. package/dist/popup/popup.vue +2 -4
  72. package/dist/progress/progress.vue +1 -3
  73. package/dist/pull-down-refresh/pull-down-refresh.vue +13 -15
  74. package/dist/qrcode/components/qrcode-canvas/qrcode-canvas.vue +1 -3
  75. package/dist/qrcode/components/qrcode-status/qrcode-status.vue +1 -3
  76. package/dist/qrcode/qrcode.vue +1 -3
  77. package/dist/radio/radio.vue +20 -22
  78. package/dist/rate/rate.vue +1 -3
  79. package/dist/result/result.vue +13 -15
  80. package/dist/row/row.vue +1 -3
  81. package/dist/search/README.en-US.md +1 -1
  82. package/dist/search/README.md +1 -1
  83. package/dist/search/search.vue +22 -10
  84. package/dist/search/type.ts +1 -1
  85. package/dist/side-bar/side-bar.vue +1 -3
  86. package/dist/side-bar-item/side-bar-item.vue +12 -15
  87. package/dist/skeleton/skeleton.vue +2 -4
  88. package/dist/slider/slider.vue +18 -20
  89. package/dist/step-item/step-item.vue +1 -3
  90. package/dist/stepper/stepper.vue +1 -3
  91. package/dist/steps/steps.vue +1 -2
  92. package/dist/sticky/sticky.vue +1 -3
  93. package/dist/swipe-cell/swipe-cell.vue +2 -5
  94. package/dist/swiper/swiper.vue +1 -3
  95. package/dist/swiper-nav/swiper-nav.vue +1 -3
  96. package/dist/switch/switch.vue +1 -3
  97. package/dist/tab-bar/tab-bar.vue +2 -1
  98. package/dist/tab-bar-item/tab-bar-item.vue +22 -25
  99. package/dist/tab-panel/tab-panel.vue +1 -3
  100. package/dist/tabs/tabs.vue +1 -2
  101. package/dist/tag/tag.vue +23 -26
  102. package/dist/textarea/textarea.vue +1 -3
  103. package/dist/toast/toast.vue +12 -14
  104. package/dist/transition/transition.vue +1 -3
  105. package/dist/tree-select/tree-select.vue +6 -9
  106. package/dist/upload/props.ts +1 -1
  107. package/dist/upload/upload.vue +1 -3
  108. package/dist/watermark/watermark.vue +1 -2
  109. package/package.json +3 -1
  110. package/dist/.eslintrc.js +0 -30
  111. package/dist/tsconfig.eslint.json +0 -13
@@ -3,9 +3,12 @@
3
3
  <t-popup
4
4
  v-if="usePopup"
5
5
  :visible="visible"
6
- :using-custom-navbar="usingCustomNavbar"
7
- :custom-navbar-height="customNavbarHeight"
8
6
  placement="bottom"
7
+ :show-overlay="isShowOverlay(popupProps && popupProps.showOverlay, true)"
8
+ :using-custom-navbar="usingCustomNavbar || (popupProps && popupProps.usingCustomNavbar)"
9
+ :custom-navbar-height="coalesce(customNavbarHeight, popupProps && popupProps.usingCustomNavbar)"
10
+ :z-index="(popupProps && popupProps.zIndex)"
11
+ :overlay-props="(popupProps && popupProps.overlayProps) || defaultOverlayProps"
9
12
  @visible-change="onVisibleChange"
10
13
  >
11
14
  <CalendarTemplate
@@ -153,6 +156,8 @@ export default uniComponent({
153
156
  dataVisible: this.visible,
154
157
  dataValue: coalesce(this.value, this.defaultValue),
155
158
  days: [],
159
+
160
+ defaultOverlayProps: {},
156
161
  };
157
162
  },
158
163
  watch: {
@@ -253,6 +258,8 @@ export default uniComponent({
253
258
  }
254
259
  },
255
260
  methods: {
261
+ coalesce,
262
+
256
263
  getMonthTitle,
257
264
  getDateLabel,
258
265
  isDateSelected,
@@ -291,23 +298,23 @@ export default uniComponent({
291
298
  },
292
299
 
293
300
  updateActionButton(value) {
294
- const _min = this.getCurrentYearAndMonth(this.base.minDate);
295
- const _max = this.getCurrentYearAndMonth(this.base.maxDate);
296
- const _value = this.getCurrentYearAndMonth(value);
301
+ const iMin = this.getCurrentYearAndMonth(this.base.minDate);
302
+ const iMax = this.getCurrentYearAndMonth(this.base.maxDate);
303
+ const iValue = this.getCurrentYearAndMonth(value);
297
304
 
298
- const _minTimestamp = new Date(_min.year, _min.month, 1).getTime();
299
- const _maxTimestamp = new Date(_max.year, _max.month, 1).getTime();
300
- const _dateValue = new Date(_value.year, _value.month, 1);
305
+ const iMinTimestamp = new Date(iMin.year, iMin.month, 1).getTime();
306
+ const iMaxTimestamp = new Date(iMax.year, iMax.month, 1).getTime();
307
+ const iDateValue = new Date(iValue.year, iValue.month, 1);
301
308
 
302
- const _prevYearTimestamp = getPrevYear(_dateValue).getTime();
303
- const _prevMonthTimestamp = getPrevMonth(_dateValue).getTime();
304
- const _nextMonthTimestamp = getNextMonth(_dateValue).getTime();
305
- const _nextYearTimestamp = getNextYear(_dateValue).getTime();
309
+ const iPrevYearTimestamp = getPrevYear(iDateValue).getTime();
310
+ const iPrevMonthTimestamp = getPrevMonth(iDateValue).getTime();
311
+ const iNextMonthTimestamp = getNextMonth(iDateValue).getTime();
312
+ const iNextYearTimestamp = getNextYear(iDateValue).getTime();
306
313
 
307
- const preYearBtnDisable = _prevYearTimestamp < _minTimestamp || _prevMonthTimestamp < _minTimestamp;
308
- const prevMonthBtnDisable = _prevMonthTimestamp < _minTimestamp;
309
- const nextYearBtnDisable = _nextMonthTimestamp > _maxTimestamp || _nextYearTimestamp > _maxTimestamp;
310
- const nextMonthBtnDisable = _nextMonthTimestamp > _maxTimestamp;
314
+ const preYearBtnDisable = iPrevYearTimestamp < iMinTimestamp || iPrevMonthTimestamp < iMinTimestamp;
315
+ const prevMonthBtnDisable = iPrevMonthTimestamp < iMinTimestamp;
316
+ const nextYearBtnDisable = iNextMonthTimestamp > iMaxTimestamp || iNextYearTimestamp > iMaxTimestamp;
317
+ const nextMonthBtnDisable = iNextMonthTimestamp > iMaxTimestamp;
311
318
 
312
319
  this.actionButtons = {
313
320
  preYearBtnDisable,
@@ -440,12 +447,14 @@ export default uniComponent({
440
447
  maxDate && (this.base.maxDate = maxDate);
441
448
  this.calcMonths();
442
449
  },
450
+
451
+ isShowOverlay(value, defaultValue) {
452
+ return tools.isBoolean(value) ? value : defaultValue;
453
+ },
443
454
  },
444
455
  });
445
456
  </script>
446
- <style scoped>
447
- @import './calendar.css';
448
- </style>
457
+ <style scoped src="./calendar.css"></style>
449
458
  <style scoped>
450
459
  .t-calendar-switch-mode--none > .t-calendar__months {
451
460
  /* support mp-alipay */
@@ -39,6 +39,11 @@ export default {
39
39
  minDate: {
40
40
  type: Number,
41
41
  },
42
+ /** 透传 Popup 组件全部属性 */
43
+ popupProps: {
44
+ type: Object,
45
+ default: () => ({}),
46
+ },
42
47
  /** 是否只读,只读状态下不能选择日期 */
43
48
  readonly: Boolean,
44
49
  /** 切换模式。 `none` 表示平铺展示所有月份; `month` 表示支持按月切换, `year-month` 表示既按年切换,也支持按月切换 */
@@ -256,6 +256,4 @@ export default {
256
256
  };
257
257
 
258
258
  </script>
259
- <style scoped>
260
- @import './calendar.css';
261
- </style>
259
+ <style scoped src="./calendar.css"></style>
@@ -5,6 +5,7 @@
5
5
  * */
6
6
 
7
7
  import type { TdButtonProps as ButtonProps } from '../button/type';
8
+ import type { TdPopupProps as PopupProps } from '../popup/type';
8
9
 
9
10
  export interface TdCalendarProps {
10
11
  /**
@@ -43,6 +44,11 @@ export interface TdCalendarProps {
43
44
  * 最小可选的日期,不传则默认今天
44
45
  */
45
46
  minDate?: number;
47
+ /**
48
+ * 透传 Popup 组件全部属性
49
+ * @default {}
50
+ */
51
+ popupProps?: PopupProps;
46
52
  /**
47
53
  * 是否只读,只读状态下不能选择日期
48
54
  */
@@ -106,7 +106,7 @@
106
106
  scroll-y
107
107
  :scroll-top="scrollTopList[index]"
108
108
  type="list"
109
- :style="'height: ' + _optionsHeight + 'px'"
109
+ :style="'height: ' + optionsHeight + 'px'"
110
110
  >
111
111
  <view :class="'cascader-radio-group-' + index">
112
112
  <TRadioGroup
@@ -199,7 +199,7 @@ export default uniComponent({
199
199
  selectedValue: [],
200
200
  scrollTopList: [],
201
201
  steps: [],
202
- _optionsHeight: 0,
202
+ optionsHeight: 0,
203
203
  tools,
204
204
 
205
205
  dataVisible: this.visible,
@@ -258,6 +258,7 @@ export default uniComponent({
258
258
  this.initWithValue();
259
259
  },
260
260
  immediate: true,
261
+ deep: true,
261
262
  },
262
263
 
263
264
  options: {
@@ -330,7 +331,7 @@ export default uniComponent({
330
331
  },
331
332
  updateOptionsHeight(steps) {
332
333
  const { contentHeight, stepsInitHeight, stepHeight, subTitlesHeight } = this.state;
333
- this._optionsHeight = contentHeight - stepsInitHeight - subTitlesHeight - (steps - 1) * stepHeight;
334
+ this.optionsHeight = contentHeight - stepsInitHeight - subTitlesHeight - (steps - 1) * stepHeight;
334
335
  },
335
336
 
336
337
  async initOptionsHeight(steps) {
@@ -358,7 +359,7 @@ export default uniComponent({
358
359
  }
359
360
 
360
361
  const optionsInitHeight = this.state.contentHeight - this.state.subTitlesHeight;
361
- this._optionsHeight = theme === 'step'
362
+ this.optionsHeight = theme === 'step'
362
363
  ? optionsInitHeight - this.state.stepsInitHeight - (steps - 1) * this.state.stepHeight
363
364
  : optionsInitHeight - this.state.tabsHeight;
364
365
  },
@@ -503,6 +504,9 @@ export default uniComponent({
503
504
 
504
505
  this.hide('finish');
505
506
  }
507
+ // #ifdef VUE2
508
+ this.$set(this, 'selectedIndexes', JSON.parse(JSON.stringify(selectedIndexes)));
509
+ // #endif
506
510
  },
507
511
  triggerChange() {
508
512
  const { items, selectedValue, selectedIndexes } = this;
@@ -514,6 +518,4 @@ export default uniComponent({
514
518
  },
515
519
  });
516
520
  </script>
517
- <style scoped>
518
- @import './cascader.css';
519
- </style>
521
+ <style scoped src="./cascader.css"></style>
@@ -13,18 +13,18 @@
13
13
  >
14
14
  <view :class="classPrefix + '__left ' + tClassLeft">
15
15
  <block
16
- v-if="_leftIcon"
16
+ v-if="iLeftIcon"
17
17
  name="icon"
18
18
  >
19
19
  <t-icon
20
20
  :custom-style="leftIconCustomStyle"
21
21
  :t-class="classPrefix + '__left-icon ' + tClassLeftIcon"
22
- :name="_leftIcon.name"
23
- :size="_leftIcon.size"
24
- :color="_leftIcon.color"
22
+ :name="iLeftIcon.name"
23
+ :size="iLeftIcon.size"
24
+ :color="iLeftIcon.color"
25
25
  :aria-hidden="true"
26
- :aria-label="_leftIcon.ariaLabel"
27
- :aria-role="_leftIcon.ariaRole"
26
+ :aria-label="iLeftIcon.ariaLabel"
27
+ :aria-role="iLeftIcon.ariaRole"
28
28
  @click="'handleClose' || ''"
29
29
  />
30
30
  </block>
@@ -93,31 +93,31 @@
93
93
  ]"
94
94
  >
95
95
  <t-icon
96
- v-if="_arrow"
96
+ v-if="rightArrow"
97
97
  :custom-style="rightArrowCustomStyle"
98
98
  :t-class=" classPrefix + '__right-icon ' + tClassRightIcon"
99
- :name="_arrow.name || ''"
100
- :size="_arrow.size"
101
- :color="_arrow.color"
99
+ :name="rightArrow.name || ''"
100
+ :size="rightArrow.size"
101
+ :color="rightArrow.color"
102
102
  :aria-hidden="true"
103
- :aria-label="_arrow.ariaLabel"
104
- :aria-role="_arrow.ariaRole"
103
+ :aria-label="rightArrow.ariaLabel"
104
+ :aria-role="rightArrow.ariaRole"
105
105
  @click="'handleClose' || ''"
106
106
  />
107
107
  <block v-else>
108
108
  <block
109
- v-if="_rightIcon"
109
+ v-if="iRightIcon"
110
110
  name="icon"
111
111
  >
112
112
  <t-icon
113
113
  :custom-style="rightIconCustomStyle"
114
114
  :t-class=" classPrefix + '__right-icon ' + tClassRightIcon"
115
- :name="_rightIcon.name"
116
- :size="_rightIcon.size"
117
- :color="_rightIcon.color || ''"
115
+ :name="iRightIcon.name"
116
+ :size="iRightIcon.size"
117
+ :color="iRightIcon.color || ''"
118
118
  :aria-hidden="true"
119
- :aria-label="_rightIcon.ariaLabel"
120
- :aria-role="_rightIcon.ariaRole"
119
+ :aria-label="iRightIcon.ariaLabel"
120
+ :aria-role="iRightIcon.ariaRole"
121
121
  @click="'handleClose' || ''"
122
122
  />
123
123
  </block>
@@ -132,7 +132,7 @@ import TImage from '../image/image';
132
132
  import { uniComponent } from '../common/src/index';
133
133
  import { prefix } from '../common/config';
134
134
  import props from './props';
135
- import { calcIcon } from '../common/utils';
135
+ import { calcIcon, addUnit } from '../common/utils';
136
136
  import tools from '../common/utils.wxs';
137
137
 
138
138
  import { ChildrenMixin, RELATION_MAP } from '../common/relation';
@@ -177,9 +177,9 @@ export default uniComponent({
177
177
  return {
178
178
  prefix,
179
179
  classPrefix: name,
180
- _arrow: null,
181
- _rightIcon: null,
182
- _leftIcon: null,
180
+ rightArrow: null,
181
+ iRightIcon: null,
182
+ iLeftIcon: null,
183
183
  isLastChild: false,
184
184
  tools,
185
185
  };
@@ -187,25 +187,43 @@ export default uniComponent({
187
187
  computed: {
188
188
  rightArrowCustomStyle() {
189
189
  return tools._style([
190
- COMMON_RIGHT_ICON_STYLE,
190
+ {
191
+ color: this.rightArrow.color
192
+ ? this.rightArrow.color
193
+ : COMMON_RIGHT_ICON_STYLE.color,
194
+ fontSize: this.rightArrow.size
195
+ ? addUnit(this.rightArrow.size)
196
+ : COMMON_RIGHT_ICON_STYLE.fontSize,
197
+ },
191
198
  this.rightIconStyle || '',
192
- this._arrow.style || '',
199
+ this.rightArrow.style || '',
193
200
  ]);
194
201
  },
195
202
  rightIconCustomStyle() {
196
203
  return tools._style([
197
- COMMON_RIGHT_ICON_STYLE,
204
+ {
205
+ color: this.iRightIcon.color
206
+ ? this.iRightIcon.color
207
+ : COMMON_RIGHT_ICON_STYLE.color,
208
+ fontSize: this.iRightIcon.size
209
+ ? addUnit(this.iRightIcon.size)
210
+ : COMMON_RIGHT_ICON_STYLE.fontSize,
211
+ },
198
212
  this.rightIconStyle || '',
199
- this._rightIcon.style || '',
213
+ this.iRightIcon.style || '',
200
214
  ]);
201
215
  },
202
216
  leftIconCustomStyle() {
203
217
  return tools._style([
204
218
  {
205
- color: 'var(--td-cell-left-icon-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)))',
206
- fontSize: 'var(--td-cell-left-icon-font-size, 24px)',
219
+ color: this.iLeftIcon.color
220
+ ? this.iLeftIcon.color
221
+ : 'var(--td-cell-left-icon-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)))',
222
+ fontSize: this.iLeftIcon.size
223
+ ? addUnit(this.iLeftIcon.size)
224
+ : 'var(--td-cell-left-icon-font-size, 24px)',
207
225
  },
208
- this._leftIcon.style || '',
226
+ this.iLeftIcon.style || '',
209
227
  ]);
210
228
  },
211
229
  leftImageCustomStyle() {
@@ -218,19 +236,19 @@ export default uniComponent({
218
236
  watch: {
219
237
  leftIcon: {
220
238
  handler(e) {
221
- this.setIcon('_leftIcon', e, '');
239
+ this.setIcon('iLeftIcon', e, '');
222
240
  },
223
241
  immediate: true,
224
242
  },
225
243
  rightIcon: {
226
244
  handler(e) {
227
- this.setIcon('_rightIcon', e, '');
245
+ this.setIcon('iRightIcon', e, '');
228
246
  },
229
247
  immediate: true,
230
248
  },
231
249
  arrow: {
232
250
  handler(e) {
233
- this.setIcon('_arrow', e, 'chevron-right');
251
+ this.setIcon('rightArrow', e, 'chevron-right');
234
252
  },
235
253
  immediate: true,
236
254
  },
@@ -255,6 +273,4 @@ export default uniComponent({
255
273
  },
256
274
  });
257
275
  </script>
258
- <style scoped>
259
- @import './cell.css';
260
- </style>
276
+ <style scoped src="./cell.css"></style>
@@ -64,6 +64,4 @@ export default uniComponent({
64
64
  },
65
65
  });
66
66
  </script>
67
- <style scoped>
68
- @import './cell-group.css';
69
- </style>
67
+ <style scoped src="./cell-group.css"></style>
@@ -9,19 +9,19 @@
9
9
  :class="classPrefix + '__icon'"
10
10
  >
11
11
  <block
12
- v-if="_icon"
12
+ v-if="innerIcon"
13
13
  name="icon"
14
14
  >
15
15
  <t-icon
16
- :custom-style="_icon.style || ''"
16
+ :custom-style="innerIcon.style || ''"
17
17
  :t-class="prefix + '-icon'"
18
- :prefix="_icon.prefix"
19
- :name="_icon.name"
20
- :size="_icon.size"
21
- :color="_icon.color"
22
- :aria-hidden="!!_icon.ariaHidden"
23
- :aria-label="_icon.ariaLabel"
24
- :aria-role="_icon.ariaRole"
18
+ :prefix="innerIcon.prefix"
19
+ :name="innerIcon.name"
20
+ :size="innerIcon.size"
21
+ :color="innerIcon.color"
22
+ :aria-hidden="!!innerIcon.ariaHidden"
23
+ :aria-label="innerIcon.ariaLabel"
24
+ :aria-role="innerIcon.ariaRole"
25
25
  />
26
26
  </block>
27
27
  <slot name="icon" />
@@ -84,7 +84,7 @@ export default uniComponent({
84
84
  classPrefix: name,
85
85
  className: '',
86
86
  tools,
87
- _icon: null,
87
+ innerIcon: null,
88
88
 
89
89
  dataChecked: coalesce(this.checked, this.defaultChecked),
90
90
  };
@@ -95,7 +95,7 @@ export default uniComponent({
95
95
  dataChecked: 'setClass',
96
96
  icon: {
97
97
  handler(e) {
98
- this._icon = calcIcon(e);
98
+ this.innerIcon = calcIcon(e);
99
99
  },
100
100
  immediate: true,
101
101
  },
@@ -143,7 +143,4 @@ export default uniComponent({
143
143
  });
144
144
 
145
145
  </script>
146
- <style scoped>
147
- @import './check-tag.css';
148
-
149
- </style>
146
+ <style scoped src="./check-tag.css"></style>
@@ -2,15 +2,15 @@
2
2
  <view
3
3
  :id="tId"
4
4
  :style="tools._style([customStyle])"
5
- :class="tools.cls(classPrefix, [placement, theme, ['checked', dataChecked], ['block', block], ['disabled', _disabled]]) + ' ' + tClass"
5
+ :class="tools.cls(classPrefix, [placement, theme, ['checked', dataChecked], ['block', block], ['disabled', iDisabled]]) + ' ' + tClass"
6
6
  aria-role="checkbox"
7
7
  :aria-checked="dataChecked ? (dataIndeterminate ? 'mixed' : true) : false"
8
- :aria-disabled="_disabled ? true : false"
8
+ :aria-disabled="iDisabled ? true : false"
9
9
  @click.stop="handleTap"
10
10
  >
11
11
  <view
12
12
  v-if="theme == 'default'"
13
- :class="tools.cls(classPrefix + '__icon', [placement, ['checked', dataChecked], ['disabled', _disabled]]) + ' ' + tClassIcon"
13
+ :class="tools.cls(classPrefix + '__icon', [placement, ['checked', dataChecked], ['disabled', iDisabled]]) + ' ' + tClassIcon"
14
14
  >
15
15
  <slot
16
16
  v-if="icon === 'slot'"
@@ -38,7 +38,7 @@
38
38
  />
39
39
  <view
40
40
  v-else-if="!dataChecked && (icon == 'circle' || icon == 'rectangle')"
41
- :class="tools.cls(classPrefix + '__icon-' + icon, [['disabled', _disabled]])"
41
+ :class="tools.cls(classPrefix + '__icon-' + icon, [['disabled', iDisabled]])"
42
42
  />
43
43
  <view
44
44
  v-if="!dataChecked && icon == 'line'"
@@ -54,7 +54,7 @@
54
54
  <view
55
55
  :class="
56
56
  tools.cls(classPrefix + '__title', [
57
- ['disabled', _disabled],
57
+ ['disabled', iDisabled],
58
58
  ['checked', dataChecked]
59
59
  ]) +
60
60
  ' ' +
@@ -69,7 +69,7 @@
69
69
  <slot name="label" />
70
70
  </view>
71
71
  <view
72
- :class="tools.cls(classPrefix + '__description', [['disabled', _disabled]]) + ' ' + tClassContent"
72
+ :class="tools.cls(classPrefix + '__description', [['disabled', iDisabled]]) + ' ' + tClassContent"
73
73
  :style="'-webkit-line-clamp:' + maxContentRow"
74
74
  >
75
75
  <block v-if="content">
@@ -132,7 +132,7 @@ export default uniComponent({
132
132
  return {
133
133
  prefix,
134
134
  classPrefix: name,
135
- _disabled: false,
135
+ iDisabled: false,
136
136
  tools,
137
137
 
138
138
  dataBorderless: this.borderless,
@@ -166,7 +166,7 @@ export default uniComponent({
166
166
  },
167
167
  disabled: {
168
168
  handler(v) {
169
- this._disabled = v;
169
+ this.iDisabled = v;
170
170
  },
171
171
  immediate: true,
172
172
  },
@@ -183,7 +183,7 @@ export default uniComponent({
183
183
  const valueSet = new Set(value);
184
184
  const checkedFromParent = valueSet.has(this.value);
185
185
  const data = {
186
- _disabled: this.disabled == null ? disabled : this.disabled,
186
+ iDisabled: this.disabled == null ? disabled : this.disabled,
187
187
  };
188
188
 
189
189
  data.dataBorderless = !!(coalesce(this.borderless, borderless));
@@ -210,10 +210,10 @@ export default uniComponent({
210
210
  });
211
211
  },
212
212
  handleTap(e) {
213
- const { _disabled, readonly, contentDisabled } = this;
213
+ const { iDisabled, readonly, contentDisabled } = this;
214
214
  const { target } = e.currentTarget.dataset;
215
215
 
216
- if (_disabled || readonly || (target === 'text' && contentDisabled)) return;
216
+ if (iDisabled || readonly || (target === 'text' && contentDisabled)) return;
217
217
 
218
218
  const { value, label, checkAll, dataIndeterminate } = this;
219
219
  const checked = !this.dataChecked;
@@ -228,11 +228,9 @@ export default uniComponent({
228
228
  },
229
229
 
230
230
  setDisabled(disabled) {
231
- this._disabled = this.disabled || disabled;
231
+ this.iDisabled = this.disabled || disabled;
232
232
  },
233
233
  },
234
234
  });
235
235
  </script>
236
- <style scoped>
237
- @import './checkbox.css';
238
- </style>
236
+ <style scoped src="./checkbox.css"></style>
package/dist/col/col.vue CHANGED
@@ -46,9 +46,7 @@ export default uniComponent({
46
46
  });
47
47
 
48
48
  </script>
49
- <style scoped>
50
- @import './col.css';
51
- </style>
49
+ <style scoped src="./col.css"></style>
52
50
  <style scoped>
53
51
  .t-col {
54
52
  /* 适配 qq 小程序等 */
@@ -114,6 +114,4 @@ export default uniComponent({
114
114
  },
115
115
  });
116
116
  </script>
117
- <style scoped>
118
- @import './collapse.css';
119
- </style>
117
+ <style scoped src="./collapse.css"></style>
@@ -233,6 +233,4 @@ export default uniComponent({
233
233
  });
234
234
 
235
235
  </script>
236
- <style scoped>
237
- @import './collapse-panel.css';
238
- </style>
236
+ <style scoped src="./collapse-panel.css"></style>
@@ -234,7 +234,7 @@ export default uniComponent({
234
234
  }, 33);
235
235
  this.debouncedUpdateEleRect = debounce(e => this.updateEleRect(e), 150);
236
236
  },
237
- beforeUnMount() {
237
+ beforeUnmount() {
238
238
  clearTimeout(this.timer);
239
239
  },
240
240
  methods: {
@@ -496,6 +496,4 @@ export default uniComponent({
496
496
  });
497
497
 
498
498
  </script>
499
- <style scoped>
500
- @import './color-picker.css';
501
- </style>
499
+ <style scoped src="./color-picker.css"></style>
@@ -193,6 +193,4 @@ export default {
193
193
  };
194
194
  </script>
195
195
 
196
- <style scoped>
197
- @import './color-picker.css';
198
- </style>
196
+ <style scoped src="./color-picker.css"></style>
@@ -80,6 +80,12 @@ export const toComponent = function (options) {
80
80
  });
81
81
  };
82
82
 
83
+ // #ifdef Vue2
84
+ if (options.beforeUnmount) {
85
+ options.beforeDestroy = options.beforeUnmount;
86
+ }
87
+ // #endif
88
+
83
89
  options.methods._trigger = function (evtName, detail, opts) {
84
90
  const target = controlledProps.find(item => item.event === evtName);
85
91
 
@@ -171,10 +177,18 @@ function filterProps(props, controlledProps) {
171
177
  || unControlledKeys.indexOf(key) > -1
172
178
  ) {
173
179
  const newType = Array.isArray(curType) ? curType : [curType];
180
+ // #ifdef VUE3
174
181
  newProps[key] = {
175
182
  type: [null, ...newType],
176
183
  default: null,
177
184
  };
185
+ // #endif
186
+ // #ifdef VUE2
187
+ newProps[key] = {
188
+ type: [...newType],
189
+ default: null,
190
+ };
191
+ // #endif
178
192
  } else if (
179
193
  [Boolean, String].indexOf(props[key].type) > -1
180
194
  && props[key].default === undefined