@10yun/cv-mobile-ui 0.5.20 → 0.5.22

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 (71) hide show
  1. package/package.json +1 -1
  2. package/plugins/jumps.js +57 -12
  3. package/plugins/lbs.js +17 -8
  4. package/ui-cv/components/cv-grid-item/cv-grid-item.vue +1 -1
  5. package/uni-ui/lib/uni-badge/uni-badge.vue +150 -1
  6. package/uni-ui/lib/uni-breadcrumb/uni-breadcrumb.vue +37 -1
  7. package/uni-ui/lib/uni-breadcrumb-item/uni-breadcrumb-item.vue +83 -1
  8. package/uni-ui/lib/uni-calendar/uni-calendar-item.vue +122 -1
  9. package/uni-ui/lib/uni-calendar/uni-calendar.vue +366 -1
  10. package/uni-ui/lib/uni-card/uni-card.vue +124 -1
  11. package/uni-ui/lib/uni-col/uni-col.vue +1 -1
  12. package/uni-ui/lib/uni-collapse/uni-collapse.vue +135 -1
  13. package/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +266 -1
  14. package/uni-ui/lib/uni-combox/uni-combox.vue +1 -1
  15. package/uni-ui/lib/uni-countdown/uni-countdown.vue +239 -1
  16. package/uni-ui/lib/uni-data-checkbox/uni-data-checkbox.vue +487 -1
  17. package/uni-ui/lib/uni-data-picker/uni-data-picker.vue +530 -1
  18. package/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +157 -150
  19. package/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +166 -1
  20. package/uni-ui/lib/uni-data-select/uni-data-select.vue +289 -1
  21. package/uni-ui/lib/uni-datetime-picker/calendar-item.vue +70 -1
  22. package/uni-ui/lib/uni-datetime-picker/calendar.vue +629 -1
  23. package/uni-ui/lib/uni-datetime-picker/time-picker.vue +741 -1
  24. package/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +847 -1
  25. package/uni-ui/lib/uni-drawer/uni-drawer.vue +115 -1
  26. package/uni-ui/lib/uni-easyinput/uni-easyinput.vue +515 -1
  27. package/uni-ui/lib/uni-fab/uni-fab.vue +257 -1
  28. package/uni-ui/lib/uni-fav/uni-fav.vue +123 -1
  29. package/uni-ui/lib/uni-file-picker/uni-file-picker.vue +642 -1
  30. package/uni-ui/lib/uni-file-picker/upload-file.vue +177 -1
  31. package/uni-ui/lib/uni-file-picker/upload-image.vue +176 -1
  32. package/uni-ui/lib/uni-forms/uni-forms.vue +375 -1
  33. package/uni-ui/lib/uni-forms-item/uni-forms-item.vue +429 -1
  34. package/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +129 -1
  35. package/uni-ui/lib/uni-grid/uni-grid.vue +115 -1
  36. package/uni-ui/lib/uni-grid-item/uni-grid-item.vue +78 -1
  37. package/uni-ui/lib/uni-group/uni-group.vue +85 -1
  38. package/uni-ui/lib/uni-icons/uni-icons.vue +85 -1
  39. package/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +68 -1
  40. package/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +294 -1
  41. package/uni-ui/lib/uni-list/uni-list.vue +81 -1
  42. package/uni-ui/lib/uni-list-ad/uni-list-ad.vue +77 -1
  43. package/uni-ui/lib/uni-list-chat/uni-list-chat.vue +294 -1
  44. package/uni-ui/lib/uni-list-item/uni-list-item.vue +346 -1
  45. package/uni-ui/lib/uni-load-more/uni-load-more.vue +172 -1
  46. package/uni-ui/lib/uni-nav-bar/uni-nav-bar.vue +205 -1
  47. package/uni-ui/lib/uni-nav-bar/uni-status-bar.vue +18 -1
  48. package/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +331 -1
  49. package/uni-ui/lib/uni-number-box/uni-number-box.vue +166 -1
  50. package/uni-ui/lib/uni-pagination/uni-pagination.vue +323 -1
  51. package/uni-ui/lib/uni-popup/uni-popup.vue +1 -1
  52. package/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +173 -1
  53. package/uni-ui/lib/uni-popup-message/uni-popup-message.vue +74 -1
  54. package/uni-ui/lib/uni-popup-share/uni-popup-share.vue +106 -1
  55. package/uni-ui/lib/uni-rate/uni-rate.vue +322 -1
  56. package/uni-ui/lib/uni-row/uni-row.vue +1 -1
  57. package/uni-ui/lib/uni-search-bar/uni-search-bar.vue +236 -1
  58. package/uni-ui/lib/uni-section/uni-section.vue +109 -1
  59. package/uni-ui/lib/uni-segmented-control/uni-segmented-control.vue +103 -1
  60. package/uni-ui/lib/uni-status-bar/uni-status-bar.vue +1 -1
  61. package/uni-ui/lib/uni-steps/uni-steps.vue +120 -1
  62. package/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +226 -3
  63. package/uni-ui/lib/uni-swiper-dot/uni-swiper-dot.vue +167 -1
  64. package/uni-ui/lib/uni-table/uni-table.vue +297 -1
  65. package/uni-ui/lib/uni-tag/uni-tag.vue +100 -1
  66. package/uni-ui/lib/uni-td/uni-td.vue +78 -1
  67. package/uni-ui/lib/uni-th/filter-dropdown.vue +1 -1
  68. package/uni-ui/lib/uni-th/uni-th.vue +224 -1
  69. package/uni-ui/lib/uni-thead/uni-thead.vue +77 -1
  70. package/uni-ui/lib/uni-tr/table-checkbox.vue +79 -1
  71. package/uni-ui/lib/uni-tr/uni-tr.vue +135 -1
@@ -1 +1,236 @@
1
- <template>
2
1
  <view class="uni-searchbar">
3
2
  <view :style="{ borderRadius: radius + 'px', backgroundColor: bgColor }" class="uni-searchbar__box" @click="searchClick">
4
3
  <view class="uni-searchbar__box-icon-search">
5
4
  <slot name="searchIcon">
6
5
  <uni-icons color="#c0c4cc" size="18" type="search" />
7
6
  </slot>
8
7
  </view>
9
8
  <input
10
9
  v-if="show || searchVal"
11
10
  :focus="showSync"
12
11
  :disabled="readonly"
13
12
  :placeholder="placeholderText"
14
13
  :maxlength="maxlength"
15
14
  class="uni-searchbar__box-search-input"
16
15
  confirm-type="search"
17
16
  type="text"
18
17
  v-model="searchVal"
19
18
  @confirm="confirm"
20
19
  @blur="blur"
21
20
  @focus="emitFocus"
22
21
  />
23
22
  <text v-else class="uni-searchbar__text-placeholder">{{ placeholder }}</text>
24
23
  <view
25
24
  v-if="show && (clearButton === 'always' || (clearButton === 'auto' && searchVal !== '')) && !readonly"
26
25
  class="uni-searchbar__box-icon-clear"
27
26
  @click="clear"
28
27
  >
29
28
  <slot name="clearIcon">
30
29
  <uni-icons color="#c0c4cc" size="20" type="clear" />
31
30
  </slot>
32
31
  </view>
33
32
  </view>
34
33
  <text @click="cancel" class="uni-searchbar__cancel" v-if="cancelButton === 'always' || (show && cancelButton === 'auto')">
35
34
  {{ cancelTextI18n }}
36
35
  </text>
37
36
  </view>
38
37
  * SearchBar 搜索栏
39
38
  * @description 搜索栏组件,通常用于搜索商品、文章等
40
39
  * @tutorial https://ext.dcloud.net.cn/plugin?id=866
41
40
  * @property {Number} radius 搜索栏圆角
42
41
  * @property {Number} maxlength 输入最大长度
43
42
  * @property {String} placeholder 搜索栏Placeholder
44
43
  * @property {String} clearButton = [always|auto|none] 是否显示清除按钮
45
44
  * @value always 一直显示
46
45
  * @value auto 输入框不为空时显示
47
46
  * @value none 一直不显示
48
47
  * @property {String} cancelButton = [always|auto|none] 是否显示取消按钮
49
48
  * @value always 一直显示
50
49
  * @value auto 输入框不为空时显示
51
50
  * @value none 一直不显示
52
51
  * @property {String} cancelText 取消按钮的文字
53
52
  * @property {String} bgColor 输入框背景颜色
54
53
  * @property {Boolean} focus 是否自动聚焦
55
54
  * @property {Boolean} readonly 组件只读,不能有任何操作,只做展示
56
55
  * @event {Function} confirm uniSearchBar 的输入框 confirm 事件,返回参数为uniSearchBar的value,e={value:Number}
57
56
  * @event {Function} input uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的value,e=value
58
57
  * @event {Function} cancel 点击取消按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
59
58
  * @event {Function} clear 点击清除按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
60
59
  * @event {Function} blur input失去焦点时触发事件,返回参数为uniSearchBar的value,e={value:Number}
61
60
  */
62
61
  name: 'UniSearchBar',
63
62
  emits: ['input', 'update:modelValue', 'clear', 'cancel', 'confirm', 'blur', 'focus'],
64
63
  props: {
65
64
  placeholder: {
66
65
  type: String,
67
66
  default: ''
68
67
  },
69
68
  radius: {
70
69
  type: [Number, String],
71
70
  default: 5
72
71
  },
73
72
  clearButton: {
74
73
  type: String,
75
74
  default: 'auto'
76
75
  },
77
76
  cancelButton: {
78
77
  type: String,
79
78
  default: 'auto'
80
79
  },
81
80
  cancelText: {
82
81
  type: String,
83
82
  default: ''
84
83
  },
85
84
  bgColor: {
86
85
  type: String,
87
86
  default: '#F8F8F8'
88
87
  },
89
88
  maxlength: {
90
89
  type: [Number, String],
91
90
  default: 100
92
91
  },
93
92
  value: {
94
93
  type: [Number, String],
95
94
  default: ''
96
95
  },
97
96
  modelValue: {
98
97
  type: [Number, String],
99
98
  default: ''
100
99
  },
101
100
  focus: {
102
101
  type: Boolean,
103
102
  default: false
104
103
  },
105
104
  readonly: {
106
105
  type: Boolean,
107
106
  default: false
108
107
  }
109
108
  },
110
109
  data() {
111
110
  return {
112
111
  show: false,
113
112
  showSync: false,
114
113
  searchVal: ''
115
114
  };
116
115
  },
117
116
  computed: {
118
117
  cancelTextI18n() {
119
118
  return this.cancelText || t('uni-search-bar.cancel');
120
119
  },
121
120
  placeholderText() {
122
121
  return this.placeholder || t('uni-search-bar.placeholder');
123
122
  }
124
123
  },
125
124
  watch: {
126
125
  // #ifndef VUE3
127
126
  value: {
128
127
  immediate: true,
129
128
  handler(newVal) {
130
129
  this.searchVal = newVal;
131
130
  if (newVal) {
132
131
  this.show = true;
133
132
  }
134
133
  }
135
134
  },
136
135
  // #endif
137
136
  // #ifdef VUE3
138
137
  modelValue: {
139
138
  immediate: true,
140
139
  handler(newVal) {
141
140
  this.searchVal = newVal;
142
141
  if (newVal) {
143
142
  this.show = true;
144
143
  }
145
144
  }
146
145
  },
147
146
  // #endif
148
147
  focus: {
149
148
  immediate: true,
150
149
  handler(newVal) {
151
150
  if (newVal) {
152
151
  if (this.readonly) return;
153
152
  this.show = true;
154
153
  this.$nextTick(() => {
155
154
  this.showSync = true;
156
155
  });
157
156
  }
158
157
  }
159
158
  },
160
159
  searchVal(newVal, oldVal) {
161
160
  this.$emit('input', newVal);
162
161
  // #ifdef VUE3
163
162
  this.$emit('update:modelValue', newVal);
164
163
  // #endif
165
164
  }
166
165
  },
167
166
  methods: {
168
167
  searchClick() {
169
168
  if (this.readonly) return;
170
169
  if (this.show) {
171
170
  return;
172
171
  }
173
172
  this.show = true;
174
173
  this.$nextTick(() => {
175
174
  this.showSync = true;
176
175
  });
177
176
  },
178
177
  clear() {
179
178
  this.$emit('clear', {
180
179
  value: this.searchVal
181
180
  });
182
181
  this.searchVal = '';
183
182
  },
184
183
  cancel() {
185
184
  if (this.readonly) return;
186
185
  this.$emit('cancel', {
187
186
  value: this.searchVal
188
187
  });
189
188
  this.searchVal = '';
190
189
  this.show = false;
191
190
  this.showSync = false;
192
191
  // #ifndef APP-PLUS
193
192
  uni.hideKeyboard();
194
193
  // #endif
195
194
  // #ifdef APP-PLUS
196
195
  plus.key.hideSoftKeybord();
197
196
  // #endif
198
197
  },
199
198
  confirm() {
200
199
  // #ifndef APP-PLUS
201
200
  uni.hideKeyboard();
202
201
  // #endif
203
202
  // #ifdef APP-PLUS
204
203
  plus.key.hideSoftKeybord();
205
204
  // #endif
206
205
  this.$emit('confirm', {
207
206
  value: this.searchVal
208
207
  });
209
208
  },
210
209
  blur() {
211
210
  // #ifndef APP-PLUS
212
211
  uni.hideKeyboard();
213
212
  // #endif
214
213
  // #ifdef APP-PLUS
215
214
  plus.key.hideSoftKeybord();
216
215
  // #endif
217
216
  this.$emit('blur', {
218
217
  value: this.searchVal
219
218
  });
220
219
  },
221
220
  emitFocus(e) {
222
221
  this.$emit('focus', e.detail);
223
222
  }
224
223
  }
224
+ <template>
225
+ <view class="uni-searchbar">
226
+ <view :style="{ borderRadius: radius + 'px', backgroundColor: bgColor }" class="uni-searchbar__box" @click="searchClick">
227
+ <view class="uni-searchbar__box-icon-search">
228
+ <slot name="searchIcon">
229
+ <uni-icons color="#c0c4cc" size="18" type="search" />
230
+ </slot>
231
+ </view>
232
+ <input
233
+ v-if="show || searchVal"
234
+ :focus="showSync"
235
+ :disabled="readonly"
236
+ :placeholder="placeholderText"
237
+ :maxlength="maxlength"
238
+ class="uni-searchbar__box-search-input"
239
+ confirm-type="search"
240
+ type="text"
241
+ v-model="searchVal"
242
+ @confirm="confirm"
243
+ @blur="blur"
244
+ @focus="emitFocus"
245
+ />
246
+ <text v-else class="uni-searchbar__text-placeholder">{{ placeholder }}</text>
247
+ <view
248
+ v-if="show && (clearButton === 'always' || (clearButton === 'auto' && searchVal !== '')) && !readonly"
249
+ class="uni-searchbar__box-icon-clear"
250
+ @click="clear"
251
+ >
252
+ <slot name="clearIcon">
253
+ <uni-icons color="#c0c4cc" size="20" type="clear" />
254
+ </slot>
255
+ </view>
256
+ </view>
257
+ <text @click="cancel" class="uni-searchbar__cancel" v-if="cancelButton === 'always' || (show && cancelButton === 'auto')">
258
+ {{ cancelTextI18n }}
259
+ </text>
260
+ </view>
261
+ </template>
262
+ <script>
263
+ import { initVueI18n } from '@dcloudio/uni-i18n';
264
+ import messages from './i18n/index.js';
265
+ const { t } = initVueI18n(messages);
266
+ /**
267
+ * SearchBar 搜索栏
268
+ * @description 搜索栏组件,通常用于搜索商品、文章等
269
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=866
270
+ * @property {Number} radius 搜索栏圆角
271
+ * @property {Number} maxlength 输入最大长度
272
+ * @property {String} placeholder 搜索栏Placeholder
273
+ * @property {String} clearButton = [always|auto|none] 是否显示清除按钮
274
+ * @value always 一直显示
275
+ * @value auto 输入框不为空时显示
276
+ * @value none 一直不显示
277
+ * @property {String} cancelButton = [always|auto|none] 是否显示取消按钮
278
+ * @value always 一直显示
279
+ * @value auto 输入框不为空时显示
280
+ * @value none 一直不显示
281
+ * @property {String} cancelText 取消按钮的文字
282
+ * @property {String} bgColor 输入框背景颜色
283
+ * @property {Boolean} focus 是否自动聚焦
284
+ * @property {Boolean} readonly 组件只读,不能有任何操作,只做展示
285
+ * @event {Function} confirm uniSearchBar 的输入框 confirm 事件,返回参数为uniSearchBar的value,e={value:Number}
286
+ * @event {Function} input uniSearchBar 的 value 改变时触发事件,返回参数为uniSearchBar的value,e=value
287
+ * @event {Function} cancel 点击取消按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
288
+ * @event {Function} clear 点击清除按钮时触发事件,返回参数为uniSearchBar的value,e={value:Number}
289
+ * @event {Function} blur input失去焦点时触发事件,返回参数为uniSearchBar的value,e={value:Number}
290
+ */
291
+ export default {
292
+ name: 'UniSearchBar',
293
+ emits: ['input', 'update:modelValue', 'clear', 'cancel', 'confirm', 'blur', 'focus'],
294
+ props: {
295
+ placeholder: {
296
+ type: String,
297
+ default: ''
298
+ },
299
+ radius: {
300
+ type: [Number, String],
301
+ default: 5
302
+ },
303
+ clearButton: {
304
+ type: String,
305
+ default: 'auto'
306
+ },
307
+ cancelButton: {
308
+ type: String,
309
+ default: 'auto'
310
+ },
311
+ cancelText: {
312
+ type: String,
313
+ default: ''
314
+ },
315
+ bgColor: {
316
+ type: String,
317
+ default: '#F8F8F8'
318
+ },
319
+ maxlength: {
320
+ type: [Number, String],
321
+ default: 100
322
+ },
323
+ value: {
324
+ type: [Number, String],
325
+ default: ''
326
+ },
327
+ modelValue: {
328
+ type: [Number, String],
329
+ default: ''
330
+ },
331
+ focus: {
332
+ type: Boolean,
333
+ default: false
334
+ },
335
+ readonly: {
336
+ type: Boolean,
337
+ default: false
338
+ }
339
+ },
340
+ data() {
341
+ return {
342
+ show: false,
343
+ showSync: false,
344
+ searchVal: ''
345
+ };
346
+ },
347
+ computed: {
348
+ cancelTextI18n() {
349
+ return this.cancelText || t('uni-search-bar.cancel');
350
+ },
351
+ placeholderText() {
352
+ return this.placeholder || t('uni-search-bar.placeholder');
353
+ }
354
+ },
355
+ watch: {
356
+ // #ifndef VUE3
357
+ value: {
358
+ immediate: true,
359
+ handler(newVal) {
360
+ this.searchVal = newVal;
361
+ if (newVal) {
362
+ this.show = true;
363
+ }
364
+ }
365
+ },
366
+ // #endif
367
+ // #ifdef VUE3
368
+ modelValue: {
369
+ immediate: true,
370
+ handler(newVal) {
371
+ this.searchVal = newVal;
372
+ if (newVal) {
373
+ this.show = true;
374
+ }
375
+ }
376
+ },
377
+ // #endif
378
+ focus: {
379
+ immediate: true,
380
+ handler(newVal) {
381
+ if (newVal) {
382
+ if (this.readonly) return;
383
+ this.show = true;
384
+ this.$nextTick(() => {
385
+ this.showSync = true;
386
+ });
387
+ }
388
+ }
389
+ },
390
+ searchVal(newVal, oldVal) {
391
+ this.$emit('input', newVal);
392
+ // #ifdef VUE3
393
+ this.$emit('update:modelValue', newVal);
394
+ // #endif
395
+ }
396
+ },
397
+ methods: {
398
+ searchClick() {
399
+ if (this.readonly) return;
400
+ if (this.show) {
401
+ return;
402
+ }
403
+ this.show = true;
404
+ this.$nextTick(() => {
405
+ this.showSync = true;
406
+ });
407
+ },
408
+ clear() {
409
+ this.$emit('clear', {
410
+ value: this.searchVal
411
+ });
412
+ this.searchVal = '';
413
+ },
414
+ cancel() {
415
+ if (this.readonly) return;
416
+ this.$emit('cancel', {
417
+ value: this.searchVal
418
+ });
419
+ this.searchVal = '';
420
+ this.show = false;
421
+ this.showSync = false;
422
+ // #ifndef APP-PLUS
423
+ uni.hideKeyboard();
424
+ // #endif
425
+ // #ifdef APP-PLUS
426
+ plus.key.hideSoftKeybord();
427
+ // #endif
428
+ },
429
+ confirm() {
430
+ // #ifndef APP-PLUS
431
+ uni.hideKeyboard();
432
+ // #endif
433
+ // #ifdef APP-PLUS
434
+ plus.key.hideSoftKeybord();
435
+ // #endif
436
+ this.$emit('confirm', {
437
+ value: this.searchVal
438
+ });
439
+ },
440
+ blur() {
441
+ // #ifndef APP-PLUS
442
+ uni.hideKeyboard();
443
+ // #endif
444
+ // #ifdef APP-PLUS
445
+ plus.key.hideSoftKeybord();
446
+ // #endif
447
+ this.$emit('blur', {
448
+ value: this.searchVal
449
+ });
450
+ },
451
+ emitFocus(e) {
452
+ this.$emit('focus', e.detail);
453
+ }
454
+ }
455
+ };
456
+ </script>
457
+ <style>
458
+ @import 'style.css';
459
+ </style>
@@ -1 +1,109 @@
1
- <template>
2
1
  <view class="uni-section">
3
2
  <view class="uni-section-header" @click="onClick">
4
3
  <view class="uni-section-header__decoration" v-if="type" :class="type" />
5
4
  <slot v-else name="decoration"></slot>
6
5
  <view class="uni-section-header__content">
7
6
  <text
8
7
  :style="{ 'font-size': titleFontSize, color: titleColor }"
9
8
  class="uni-section__content-title"
10
9
  :class="{ distraction: !subTitle }"
11
10
  >
12
11
  {{ title }}
13
12
  </text>
14
13
  <text
15
14
  v-if="subTitle"
16
15
  :style="{ 'font-size': subTitleFontSize, color: subTitleColor }"
17
16
  class="uni-section-header__content-sub"
18
17
  >
19
18
  {{ subTitle }}
20
19
  </text>
21
20
  </view>
22
21
  <view class="uni-section-header__slot-right">
23
22
  <slot name="right"></slot>
24
23
  </view>
25
24
  </view>
26
25
  <view class="uni-section-content" :style="{ padding: _padding }">
27
26
  <slot />
28
27
  </view>
29
28
  </view>
30
29
  * Section 标题栏
31
30
  * @description 标题栏
32
31
  * @property {String} type = [line|circle|square] 标题装饰类型
33
32
  * @value line 竖线
34
33
  * @value circle 圆形
35
34
  * @value square 正方形
36
35
  * @property {String} title 主标题
37
36
  * @property {String} titleFontSize 主标题字体大小
38
37
  * @property {String} titleColor 主标题字体颜色
39
38
  * @property {String} subTitle 副标题
40
39
  * @property {String} subTitleFontSize 副标题字体大小
41
40
  * @property {String} subTitleColor 副标题字体颜色
42
41
  * @property {String} padding 默认插槽 padding
43
42
  */
44
43
  name: 'UniSection',
45
44
  emits: ['click'],
46
45
  props: {
47
46
  type: {
48
47
  type: String,
49
48
  default: ''
50
49
  },
51
50
  title: {
52
51
  type: String,
53
52
  required: true,
54
53
  default: ''
55
54
  },
56
55
  titleFontSize: {
57
56
  type: String,
58
57
  default: '14px'
59
58
  },
60
59
  titleColor: {
61
60
  type: String,
62
61
  default: '#333'
63
62
  },
64
63
  subTitle: {
65
64
  type: String,
66
65
  default: ''
67
66
  },
68
67
  subTitleFontSize: {
69
68
  type: String,
70
69
  default: '12px'
71
70
  },
72
71
  subTitleColor: {
73
72
  type: String,
74
73
  default: '#999'
75
74
  },
76
75
  padding: {
77
76
  type: [Boolean, String],
78
77
  default: false
79
78
  }
80
79
  },
81
80
  computed: {
82
81
  _padding() {
83
82
  if (typeof this.padding === 'string') {
84
83
  return this.padding;
85
84
  }
86
85
  return this.padding ? '10px' : '';
87
86
  }
88
87
  },
89
88
  watch: {
90
89
  title(newVal) {
91
90
  if (uni.report && newVal !== '') {
92
91
  uni.report('title', newVal);
93
92
  }
94
93
  }
95
94
  },
96
95
  methods: {
97
96
  onClick() {
98
97
  this.$emit('click');
99
98
  }
100
99
  }
100
+ <template>
101
+ <view class="uni-section">
102
+ <view class="uni-section-header" @click="onClick">
103
+ <view class="uni-section-header__decoration" v-if="type" :class="type" />
104
+ <slot v-else name="decoration"></slot>
105
+ <view class="uni-section-header__content">
106
+ <text
107
+ :style="{ 'font-size': titleFontSize, color: titleColor }"
108
+ class="uni-section__content-title"
109
+ :class="{ distraction: !subTitle }"
110
+ >
111
+ {{ title }}
112
+ </text>
113
+ <text
114
+ v-if="subTitle"
115
+ :style="{ 'font-size': subTitleFontSize, color: subTitleColor }"
116
+ class="uni-section-header__content-sub"
117
+ >
118
+ {{ subTitle }}
119
+ </text>
120
+ </view>
121
+ <view class="uni-section-header__slot-right">
122
+ <slot name="right"></slot>
123
+ </view>
124
+ </view>
125
+ <view class="uni-section-content" :style="{ padding: _padding }">
126
+ <slot />
127
+ </view>
128
+ </view>
129
+ </template>
130
+ <script>
131
+ /**
132
+ * Section 标题栏
133
+ * @description 标题栏
134
+ * @property {String} type = [line|circle|square] 标题装饰类型
135
+ * @value line 竖线
136
+ * @value circle 圆形
137
+ * @value square 正方形
138
+ * @property {String} title 主标题
139
+ * @property {String} titleFontSize 主标题字体大小
140
+ * @property {String} titleColor 主标题字体颜色
141
+ * @property {String} subTitle 副标题
142
+ * @property {String} subTitleFontSize 副标题字体大小
143
+ * @property {String} subTitleColor 副标题字体颜色
144
+ * @property {String} padding 默认插槽 padding
145
+ */
146
+ export default {
147
+ name: 'UniSection',
148
+ emits: ['click'],
149
+ props: {
150
+ type: {
151
+ type: String,
152
+ default: ''
153
+ },
154
+ title: {
155
+ type: String,
156
+ required: true,
157
+ default: ''
158
+ },
159
+ titleFontSize: {
160
+ type: String,
161
+ default: '14px'
162
+ },
163
+ titleColor: {
164
+ type: String,
165
+ default: '#333'
166
+ },
167
+ subTitle: {
168
+ type: String,
169
+ default: ''
170
+ },
171
+ subTitleFontSize: {
172
+ type: String,
173
+ default: '12px'
174
+ },
175
+ subTitleColor: {
176
+ type: String,
177
+ default: '#999'
178
+ },
179
+ padding: {
180
+ type: [Boolean, String],
181
+ default: false
182
+ }
183
+ },
184
+ computed: {
185
+ _padding() {
186
+ if (typeof this.padding === 'string') {
187
+ return this.padding;
188
+ }
189
+ return this.padding ? '10px' : '';
190
+ }
191
+ },
192
+ watch: {
193
+ title(newVal) {
194
+ if (uni.report && newVal !== '') {
195
+ uni.report('title', newVal);
196
+ }
197
+ }
198
+ },
199
+ methods: {
200
+ onClick() {
201
+ this.$emit('click');
202
+ }
203
+ }
204
+ };
205
+ </script>
206
+ <style>
207
+ @import 'style.css';
208
+ </style>