fusions-ui 1.2.3 → 1.2.6

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 (176) hide show
  1. package/components/fu-avatar/fu-avatar.vue +4 -2
  2. package/components/fu-avatar/props.js +52 -15
  3. package/components/fu-avatar-group/fu-avatar-group.vue +3 -2
  4. package/components/fu-avatar-group/props.js +31 -9
  5. package/components/fu-badge/fu-badge.vue +8 -14
  6. package/components/fu-badge/props.js +56 -16
  7. package/components/fu-banner-arc/fu-banner-arc.vue +4 -5
  8. package/components/fu-banner-arc/props.js +15 -4
  9. package/components/fu-button/fu-button.vue +18 -19
  10. package/components/fu-button/props.js +108 -35
  11. package/components/fu-cell/fu-cell.vue +9 -8
  12. package/components/fu-cell-group/fu-cell-group.vue +2 -1
  13. package/components/fu-cell-group/props.js +7 -2
  14. package/components/fu-checkbox/fu-checkbox.vue +5 -4
  15. package/components/fu-checkbox/props.js +51 -14
  16. package/components/fu-code-input/fu-code-input.vue +10 -6
  17. package/components/fu-code-input/props.js +66 -17
  18. package/components/fu-code-verify/fu-code-verify.vue +9 -5
  19. package/components/fu-code-verify/props.js +64 -17
  20. package/components/fu-collapse/fu-collapse.vue +10 -3
  21. package/components/fu-collapse/props.js +9 -3
  22. package/components/fu-collapse-item/fu-collapse-item.vue +45 -31
  23. package/components/fu-collapse-item/props.js +49 -16
  24. package/components/fu-countdown/fu-countdown.vue +2 -1
  25. package/components/fu-countdown/props.js +15 -4
  26. package/components/fu-datetime-picker/fu-datetime-picker.vue +6 -5
  27. package/components/fu-datetime-picker/props.js +91 -25
  28. package/components/fu-form/fu-form.vue +2 -1
  29. package/components/fu-form/props.js +34 -6
  30. package/components/fu-form-item/fu-form-item.vue +46 -56
  31. package/components/fu-form-item/props.js +34 -7
  32. package/components/fu-grid/fu-grid.vue +16 -17
  33. package/components/fu-grid/props.js +20 -5
  34. package/components/fu-grid-item/fu-grid-item.vue +31 -35
  35. package/components/fu-grid-item/props.js +11 -3
  36. package/components/fu-icon/fu-icon.vue +107 -0
  37. package/components/fu-icon/icon.css +584 -0
  38. package/components/{fu-icons/icons.js → fu-icon/icon.js} +1031 -1031
  39. package/components/{fu-icons/fuicons.ttf → fu-icon/icon.ttf} +0 -0
  40. package/components/fu-icon/props.js +55 -0
  41. package/components/fu-image/fu-image.vue +15 -10
  42. package/components/fu-image/props.js +69 -18
  43. package/components/fu-index-anchor/fu-index-anchor.vue +6 -5
  44. package/components/fu-index-anchor/props.js +20 -6
  45. package/components/fu-index-item/fu-index-item.vue +4 -4
  46. package/components/fu-index-list/fu-index-list.vue +9 -9
  47. package/components/fu-index-list/props.js +19 -6
  48. package/components/fu-input/fu-input.vue +54 -68
  49. package/components/fu-input/props.js +145 -53
  50. package/components/fu-keyboard/fu-keyboard.vue +19 -9
  51. package/components/fu-keyboard/keyboard-car.vue +33 -22
  52. package/components/fu-keyboard/keyboard-number.vue +17 -9
  53. package/components/fu-keyboard/props.js +66 -17
  54. package/components/fu-line/fu-line.vue +17 -13
  55. package/components/fu-line/props.js +30 -5
  56. package/components/fu-link/fu-link.vue +14 -8
  57. package/components/fu-link/props.js +22 -7
  58. package/components/fu-loading/fu-loading.vue +32 -27
  59. package/components/fu-loading/props.js +28 -8
  60. package/components/fu-loading-more/fu-loading-more.vue +19 -23
  61. package/components/fu-loading-more/props.js +27 -13
  62. package/components/fu-modal/fu-modal.vue +11 -6
  63. package/components/fu-modal/props.js +61 -17
  64. package/components/{fu-nav-bar/fu-nav-bar.vue → fu-navbar/fu-navbar.vue} +37 -44
  65. package/components/fu-notice-bar/fu-notice-bar.vue +10 -8
  66. package/components/fu-notice-bar/notice-column.vue +187 -122
  67. package/components/fu-notice-bar/notice-row.vue +85 -28
  68. package/components/fu-notice-bar/props.js +83 -22
  69. package/components/fu-number-box/fu-number-box.vue +26 -28
  70. package/components/fu-number-box/props.js +37 -11
  71. package/components/fu-parse/fu-parse.vue +0 -1
  72. package/components/fu-picker/fu-picker.vue +22 -17
  73. package/components/fu-picker/props.js +70 -19
  74. package/components/fu-popup/fu-popup.vue +39 -44
  75. package/components/fu-popup/props.js +34 -9
  76. package/components/fu-progress/fu-progress.vue +3 -2
  77. package/components/fu-progress/props.js +36 -9
  78. package/components/fu-rate/fu-rate.vue +40 -32
  79. package/components/fu-rate/props.js +47 -13
  80. package/components/fu-read-more/fu-read-more.vue +19 -14
  81. package/components/fu-read-more/props.js +68 -46
  82. package/components/fu-ribbon/fu-ribbon.vue +8 -7
  83. package/components/fu-ribbon/props.js +15 -4
  84. package/components/fu-scroll-list/fu-scroll-list.vue +18 -34
  85. package/components/fu-scroll-list/props.js +19 -10
  86. package/components/fu-search/fu-search.vue +13 -18
  87. package/components/fu-search/props.js +69 -17
  88. package/components/fu-section/fu-section.vue +19 -22
  89. package/components/fu-section/props.js +30 -4
  90. package/components/fu-sign-board/fu-sign-board.vue +18 -3
  91. package/components/fu-sign-board/props.js +15 -5
  92. package/components/fu-skeleton/fu-skeleton.vue +8 -12
  93. package/components/fu-skeleton/props.js +15 -4
  94. package/components/fu-steps/fu-steps.vue +3 -2
  95. package/components/fu-steps/props.js +23 -7
  96. package/components/fu-steps-item/fu-steps-item.vue +3 -3
  97. package/components/fu-steps-item/props.js +15 -5
  98. package/components/fu-sticky/fu-sticky.vue +3 -3
  99. package/components/fu-sticky/props.js +21 -7
  100. package/components/fu-subsection/fu-subsection.vue +29 -22
  101. package/components/fu-subsection/props.js +40 -10
  102. package/components/fu-swipe-action-item/bindingx.js +1 -1
  103. package/components/fu-swipe-action-item/fu-swipe-action-item.vue +134 -123
  104. package/components/fu-swipe-action-item/mpwxs.js +1 -1
  105. package/components/fu-swipe-action-item/props.js +22 -6
  106. package/components/fu-swiper/fu-swiper.vue +26 -24
  107. package/components/fu-swiper/props.js +80 -24
  108. package/components/fu-switch/fu-switch.vue +20 -12
  109. package/components/fu-switch/props.js +48 -13
  110. package/components/fu-tabs/fu-tabs.vue +36 -33
  111. package/components/fu-tabs/props.js +46 -13
  112. package/components/fu-tag/fu-tag.vue +24 -21
  113. package/components/fu-tag/props.js +63 -17
  114. package/components/fu-text/fu-text.vue +72 -33
  115. package/components/fu-text/props.js +85 -27
  116. package/components/fu-text/value.js +6 -6
  117. package/components/fu-textarea/fu-textarea.vue +13 -17
  118. package/components/fu-textarea/props.js +103 -30
  119. package/components/fu-timeaxis/fu-timeaxis.vue +1 -1
  120. package/components/fu-timeaxis-item/fu-timeaxis-item.vue +8 -4
  121. package/components/fu-transition/fu-transition.vue +48 -49
  122. package/components/fu-transition/props.js +21 -0
  123. package/components/fu-upload/fu-upload.vue +3 -1
  124. package/components/fu-upload/props.js +67 -19
  125. package/components/fu-upload/upload-file.vue +31 -18
  126. package/components/fu-upload/upload-image.vue +37 -19
  127. package/components/fu-vtabs/fu-vtabs.vue +6 -4
  128. package/components/fu-vtabs/props.js +50 -15
  129. package/components/fu-waterfall/fu-waterfall.vue +11 -9
  130. package/components/fu-waterfall/props.js +37 -15
  131. package/index.js +17 -24
  132. package/index.scss +9 -7
  133. package/libs/config/config.js +16 -9
  134. package/libs/function/applyEven.js +9 -9
  135. package/libs/function/check.js +81 -89
  136. package/libs/function/{index.js → common.js} +5 -5
  137. package/libs/function/message.js +0 -27
  138. package/libs/mixin/mixin.js +26 -21
  139. package/libs/{utils/min.router.config.js → route/min.route.config.js} +7 -7
  140. package/libs/{utils/router.config.js → route/route.config.js} +10 -11
  141. package/libs/{css/main.scss → style/common.scss} +50 -87
  142. package/libs/style/style.h5.scss +8 -0
  143. package/libs/style/style.mp.scss +15 -0
  144. package/package.json +1 -1
  145. package/components/fu-calendar/calendar-item.vue +0 -214
  146. package/components/fu-calendar/calendar.js +0 -546
  147. package/components/fu-calendar/fu-calendar.vue +0 -536
  148. package/components/fu-calendar/i18n/en.json +0 -12
  149. package/components/fu-calendar/i18n/index.js +0 -8
  150. package/components/fu-calendar/i18n/zh-Hans.json +0 -12
  151. package/components/fu-calendar/i18n/zh-Hant.json +0 -12
  152. package/components/fu-calendar/util.js +0 -360
  153. package/components/fu-date-picker/calendar-item.vue +0 -177
  154. package/components/fu-date-picker/calendar.vue +0 -917
  155. package/components/fu-date-picker/fu-date-picker.vue +0 -1069
  156. package/components/fu-date-picker/i18n/en.json +0 -22
  157. package/components/fu-date-picker/i18n/index.js +0 -8
  158. package/components/fu-date-picker/i18n/zh-Hans.json +0 -22
  159. package/components/fu-date-picker/i18n/zh-Hant.json +0 -22
  160. package/components/fu-date-picker/props.js +0 -68
  161. package/components/fu-date-picker/time-picker.vue +0 -924
  162. package/components/fu-date-picker/util.js +0 -419
  163. package/components/fu-icons/fu-icons.vue +0 -102
  164. package/components/fu-icons/fuicons.css +0 -585
  165. package/components/fu-landscape/fu-landscape.vue +0 -167
  166. package/components/fu-landscape/props.js +0 -64
  167. package/components/fu-tabbar/fu-tabbar.vue +0 -333
  168. package/components/fu-tabbar/props.js +0 -78
  169. package/libs/css/style.h5.scss +0 -35
  170. package/libs/css/style.mp.scss +0 -50
  171. package/libs/utils/util.js +0 -58
  172. /package/components/{fu-nav-bar → fu-navbar}/props.js +0 -0
  173. /package/components/{fu-nav-bar → fu-navbar}/status-bar.vue +0 -0
  174. /package/{components/fu-datetime-picker → libs/function}/dayjs.js +0 -0
  175. /package/libs/{css → style}/color.scss +0 -0
  176. /package/libs/{css/component.scss → style/components.scss} +0 -0
@@ -1,26 +1,26 @@
1
1
  <template>
2
- <view class="fu-forms-item"
3
- :class="['is-direction-' + localLabelPos , border?'fu-forms-item--border': '' , border && isFirstBorder? 'is-first-border': '']">
2
+ <view class="fu-form-item"
3
+ :class="['is-direction-' + localLabelPos , border?'fu-form-item--border': '' , border && isFirstBorder? 'is-first-border': '']">
4
4
  <slot name="label">
5
- <view class="fu-forms-item__label" :class="{'no-label': !label && !required}" :style="{width: localLabelWidth, justifyContent: localLabelAlign}">
5
+ <view class="fu-form-item__label" :class="{'no-label': !label && !required}" :style="{width: localLabelWidth, justifyContent: localLabelAlign}">
6
6
  <text v-if="required" class="is-required">*</text>
7
7
  <text>{{ label }}</text>
8
8
  </view>
9
9
  </slot>
10
10
  <!-- #ifndef APP-NVUE -->
11
- <view class="fu-forms-item__content">
11
+ <view class="fu-form-item__content">
12
12
  <slot></slot>
13
- <view class="fu-forms-item__error" :class="{'msg--active': msg}">
13
+ <view class="fu-form-item__error" :class="{'msg--active': msg}">
14
14
  <text>{{ msg }}</text>
15
15
  </view>
16
16
  </view>
17
17
  <!-- #endif -->
18
18
  <!-- #ifdef APP-NVUE -->
19
- <view class="fu-forms-item__nuve-content">
20
- <view class="fu-forms-item__content">
19
+ <view class="fu-form-item__nuve-content">
20
+ <view class="fu-form-item__content">
21
21
  <slot></slot>
22
22
  </view>
23
- <view class="fu-forms-item__error" :class="{'msg--active': msg}">
23
+ <view class="fu-form-item__error" :class="{'msg--active': msg}">
24
24
  <text class="error-text">{{ msg }}</text>
25
25
  </view>
26
26
  </view>
@@ -38,12 +38,12 @@
38
38
  * @property {String } label 输入框左边的文字提示
39
39
  * @property {Number } labelWidth label的宽度,单位px(默认70)
40
40
  * @property {String } labelAlign = [left|center|right] label的文字对齐方式(默认left)
41
- * @value left label 左侧显示
42
- * @value center label 居中
43
- * @value right label 右侧对齐
41
+ * @value left label 左侧显示
42
+ * @value center label 居中
43
+ * @value right label 右侧对齐
44
44
  * @property {String } message 显示的错误提示内容,如果为空字符串或者false,则不显示错误信息
45
45
  * @property {String } prop 表单域的属性名,在使用校验规则时必填
46
- * @property {String } labelPosition = [top|left] label的文字的位置(默认left)
46
+ * @property {String } labelPosition = [top|left] label的文字的位置,优先级高于fu-form组件中的labelPosition
47
47
  * @value top 顶部显示 label
48
48
  * @value left 左侧显示 label
49
49
  */
@@ -106,18 +106,6 @@
106
106
  }
107
107
 
108
108
  },
109
- // #ifndef VUE3
110
- destroyed() {
111
- if (this.__isUnmounted) return
112
- this.fuInit()
113
- },
114
- // #endif
115
- // #ifdef VUE3
116
- unmounted() {
117
- this.__isUnmounted = true;
118
- this.fuInit()
119
- },
120
- // #endif
121
109
  methods: {
122
110
  /**
123
111
  * 外部调用方法
@@ -222,7 +210,7 @@
222
210
  // 宽度
223
211
  this.localLabelWidth = this._labelWidthUnit(labelWidth);
224
212
  // 标签位置
225
- this.localLabelPos = this._labelPosition();
213
+ this.localLabelPos = this.labelPosition || this._labelPosition();
226
214
  // 将需要校验的子组件加入form 队列
227
215
  this.form && type && childrens.push(this)
228
216
 
@@ -367,19 +355,34 @@
367
355
  },
368
356
  'form.labelPosition'(val) {
369
357
  // 标签位置
370
- this.localLabelPos = this._labelPosition()
358
+ this.localLabelPos = this.labelPosition || this._labelPosition()
371
359
  },
372
360
  'form.labelAlign'(val) {
373
-
361
+ // 标签对齐方式
362
+ this.localLabelAlign = this._justifyContent();
374
363
  }
375
- }
364
+ },
365
+ // #ifndef VUE3
366
+ destroyed() {
367
+ if (this.__isUnmounted) return
368
+ this.fuInit()
369
+ },
370
+ // #endif
371
+ // #ifdef VUE3
372
+ unmounted() {
373
+ this.__isUnmounted = true;
374
+ this.fuInit()
375
+ },
376
+ // #endif
376
377
  }
377
378
  </script>
378
379
 
379
380
  <style lang="scss" scoped>
380
- .fu-forms-item {
381
+ @import '../../libs/style/components.scss';
382
+
383
+ .fu-form-item {
384
+ @include flex(row);
381
385
  position: relative;
382
- display: flex;
383
386
  /* #ifdef APP-NVUE */
384
387
  // 在 nvue 中,使用 margin-bottom error 信息会被隐藏
385
388
  padding-bottom: 22px;
@@ -387,26 +390,21 @@
387
390
  /* #ifndef APP-NVUE */
388
391
  margin-bottom: 22px;
389
392
  /* #endif */
390
- flex-direction: row;
391
393
 
392
394
  &__label {
393
- display: flex;
394
- flex-direction: row;
395
+ @include flex(row);
395
396
  align-items: center;
396
397
  text-align: left;
397
398
  font-size: 14px;
398
399
  color: #606266;
399
- height: 36px;
400
+ height: 40px;
400
401
  padding: 0 12px 0 0;
401
402
  /* #ifndef APP-NVUE */
402
403
  vertical-align: middle;
403
- flex-shrink: 0;
404
- /* #endif */
405
-
406
- /* #ifndef APP-NVUE */
404
+ flex: 0 0 auto;
407
405
  box-sizing: border-box;
408
-
409
406
  /* #endif */
407
+
410
408
  &.no-label {
411
409
  padding: 0;
412
410
  }
@@ -434,9 +432,8 @@
434
432
  /* #endif */
435
433
  }
436
434
 
437
- & .fu-forms-item__nuve-content {
438
- display: flex;
439
- flex-direction: column;
435
+ & .fu-form-item__nuve-content {
436
+ @include flex(column);
440
437
  flex: 1;
441
438
  }
442
439
 
@@ -478,9 +475,8 @@
478
475
  &.is-direction-top {
479
476
  flex-direction: column;
480
477
 
481
- .fu-forms-item__label {
478
+ .fu-form-item__label {
482
479
  padding: 0 0 8px;
483
- line-height: 1.5715;
484
480
  text-align: left;
485
481
  /* #ifndef APP-NVUE */
486
482
  white-space: initial;
@@ -489,49 +485,43 @@
489
485
  }
490
486
 
491
487
  .is-required {
492
- // color: $fu-color-error;
493
488
  color: #dd524d;
494
489
  font-weight: bold;
495
490
  }
496
491
  }
497
492
 
498
493
 
499
- .fu-forms-item--border {
494
+ .fu-form-item--border {
500
495
  margin-bottom: 0;
501
496
  padding: 10px 0;
502
- // padding-bottom: 0;
503
- border-top: 1px #eee solid;
497
+ border-top: 1px #eeeeee solid;
504
498
 
505
499
  /* #ifndef APP-NVUE */
506
- .fu-forms-item__content {
500
+ .fu-form-item__content {
507
501
  flex-direction: column;
508
502
  justify-content: flex-start;
509
503
  align-items: flex-start;
510
504
 
511
- .fu-forms-item__error {
505
+ .fu-form-item__error {
512
506
  position: relative;
513
507
  top: 5px;
514
508
  left: 0;
515
509
  padding-top: 0;
516
510
  }
517
511
  }
518
-
519
512
  /* #endif */
520
513
 
521
514
  /* #ifdef APP-NVUE */
522
- display: flex;
523
- flex-direction: column;
515
+ @include flex(column);
524
516
 
525
- .fu-forms-item__error {
517
+ .fu-form-item__error {
526
518
  position: relative;
527
519
  top: 0px;
528
520
  left: 0;
529
521
  padding-top: 0;
530
522
  margin-top: 5px;
531
523
  }
532
-
533
524
  /* #endif */
534
-
535
525
  }
536
526
 
537
527
  .is-first-border {
@@ -1,39 +1,66 @@
1
1
  export default {
2
2
  props: {
3
- // 表单校验规则
3
+ /**
4
+ * @description 表单校验规则
5
+ * @default null
6
+ */
4
7
  rules: {
5
8
  type: Array,
6
9
  default () {
7
- return null;
10
+ return null
8
11
  }
9
12
  },
10
- // 表单域的属性名,在使用校验规则时必填
13
+ /**
14
+ * @description 表单域的属性名,在使用校验规则时必填
15
+ */
11
16
  prop: {
12
17
  type: [String, Array],
13
18
  default: ''
14
19
  },
20
+ /**
21
+ * @description 是否必填,左边显示红色"*"号
22
+ * @default false
23
+ */
15
24
  required: {
16
25
  type: Boolean,
17
26
  default: false
18
27
  },
28
+ /**
29
+ * @description 输入框左边的文字提示
30
+ */
19
31
  label: {
20
32
  type: String,
21
33
  default: ''
22
34
  },
23
- // label的宽度
35
+ /**
36
+ * @description label的宽度
37
+ */
24
38
  labelWidth: {
25
39
  type: [String, Number],
26
40
  default: ''
27
41
  },
28
- // label 居中方式,默认 left 取值 left/center/right
42
+ /**
43
+ * @description label 居中方式
44
+ * @values 'left' - 左对齐, 'center' - 居中, 'right' - 右对齐
45
+ * @default 'left'
46
+ */
29
47
  labelAlign: {
30
48
  type: String,
31
- default: ''
49
+ default: 'left'
32
50
  },
33
- // 强制显示错误信息
51
+ /**
52
+ * @description 强制显示错误信息
53
+ */
34
54
  message: {
35
55
  type: [String, Boolean],
36
56
  default: ''
57
+ },
58
+ /**
59
+ * @description label的文字的位置,优先级高于fu-form组件中的labelPosition
60
+ */
61
+ labelPosition: {
62
+ type: String,
63
+ default: ''
37
64
  }
38
65
  },
39
66
  }
@@ -1,6 +1,11 @@
1
1
  <template>
2
2
  <view class="fu-grid-wrap">
3
- <view :id="elId" ref="fu-grid" class="fu-grid" :class="{ 'fu-grid--border': showBorder }" :style="{ 'border-left-color':borderColor}">
3
+ <view
4
+ :id="elId"
5
+ ref="fu-grid"
6
+ class="fu-grid"
7
+ :class="{ 'fu-grid--border': showBorder }"
8
+ :style="{ 'border-left-color': borderColor}">
4
9
  <slot />
5
10
  </view>
6
11
  </view>
@@ -43,17 +48,15 @@
43
48
  this.children = [];
44
49
  },
45
50
  mounted() {
46
- this.$nextTick(() => {
47
- this.init()
48
- })
51
+ this.init()
49
52
  },
50
53
  methods: {
51
54
  init() {
52
- setTimeout(() => {
55
+ this.$nextTick(() => {
53
56
  this.getSize((width) => {
54
57
  this.children.forEach(item => item.width = width)
55
58
  })
56
- }, 50)
59
+ })
57
60
  },
58
61
 
59
62
  change(e) {
@@ -79,36 +82,32 @@
79
82
  </script>
80
83
 
81
84
  <style lang="scss" scoped>
85
+ @import '../../libs/style/components.scss';
86
+ $border-color: #D2D2D2;
87
+
82
88
  .fu-grid-wrap {
83
- /* #ifndef APP-NVUE */
84
- display: flex;
85
- /* #endif */
89
+ @include flex(column);
86
90
  flex: 1;
87
- flex-direction: column;
88
91
  /* #ifdef H5 */
89
92
  width: 100%;
90
93
  /* #endif */
91
94
  }
92
95
 
93
96
  .fu-grid {
94
- /* #ifndef APP-NVUE */
95
- display: flex;
96
- /* #endif */
97
- // flex: 1;
98
- flex-direction: row;
97
+ @include flex(row);
99
98
  flex-wrap: wrap;
100
99
  }
101
100
 
102
101
  .fu-grid--border {
103
102
  position: relative;
104
103
  /* #ifdef APP-NVUE */
105
- border-left-color: #d6d6d6;
104
+ border-left-color: $border-color;
106
105
  border-left-style: solid;
107
106
  border-left-width: 0.5px;
108
107
  /* #endif */
109
108
  /* #ifndef APP-NVUE */
110
109
  z-index: 1;
111
- border-left: 1px #d6d6d6 solid;
110
+ border-left: 1px solid $border-color;
112
111
  /* #endif */
113
112
  }
114
113
  </style>
@@ -1,26 +1,41 @@
1
1
  export default {
2
2
  props: {
3
- // 每列显示个数
3
+ /**
4
+ * @description 每列显示个数
5
+ * @default 3
6
+ */
4
7
  column: {
5
8
  type: [Number],
6
9
  default: 3
7
10
  },
8
- // 是否显示边框(默认 true)
11
+ /**
12
+ * @description 是否显示边框
13
+ * @default true
14
+ */
9
15
  showBorder: {
10
16
  type: Boolean,
11
17
  default: true
12
18
  },
13
- // 边框颜色
19
+ /**
20
+ * @description 边框颜色
21
+ * @default '#d6d6d6'
22
+ */
14
23
  borderColor: {
15
24
  type: String,
16
25
  default: '#d6d6d6'
17
26
  },
18
- // 是否正方形显示(默认 true)
27
+ /**
28
+ * @description 是否正方形显示
29
+ * @default true
30
+ */
19
31
  square: {
20
32
  type: Boolean,
21
33
  default: true
22
34
  },
23
- // 点击背景是否高亮(默认 true)
35
+ /**
36
+ * @description 点击背景是否高亮
37
+ * @default true
38
+ */
24
39
  highlight: {
25
40
  type: Boolean,
26
41
  default: true
@@ -1,8 +1,10 @@
1
1
  <template>
2
2
  <view class="fu-grid-item" v-if="width" :style="itemStyle">
3
- <view :class="{ 'fu-grid-item--border': showBorder, 'fu-grid-item--border-top': showBorder && index < column, 'fu-highlight': highlight }"
4
- :style="{'border-right-color': borderColor ,'border-bottom-color': borderColor ,'border-top-color': borderColor }"
5
- class="fu-grid-item__box" @click="onClick">
3
+ <view
4
+ class="fu-grid-item__box"
5
+ :class="{ 'fu-grid-item--border': showBorder, 'fu-grid-item--border-top': showBorder && index < column, 'fu-highlight': highlight }"
6
+ :style="{'border-right-color': borderColor ,'border-bottom-color': borderColor ,'border-top-color': borderColor }"
7
+ @click="onClick">
6
8
  <slot />
7
9
  </view>
8
10
  </view>
@@ -33,40 +35,26 @@
33
35
  showBorder: true,
34
36
  square: true,
35
37
  highlight: true,
36
- left: 0,
37
- top: 0,
38
38
  openNum: 2,
39
- width: 0,
40
- borderColor: '#d6d6d6'
39
+ width: 0
41
40
  }
42
41
  },
43
42
  created() {
44
- this.column = this.grid.column
45
- this.showBorder = this.grid.showBorder
46
- this.square = this.grid.square
47
- this.highlight = this.grid.highlight
48
- this.top = this.hor === 0 ? this.grid.hor : this.hor
49
- this.left = this.ver === 0 ? this.grid.ver : this.ver
50
- this.borderColor = this.grid.borderColor
43
+ this.column = this.grid.column;
44
+ this.showBorder = this.grid.showBorder;
45
+ this.square = this.grid.square;
46
+ this.highlight = this.grid.highlight;
47
+ this.borderColor = this.grid.borderColor;
51
48
  this.grid.children.push(this)
52
49
  this.grid.init()
53
50
  this.width = this.grid.width
54
51
  },
55
- beforeDestroy() {
56
- this.grid.children.forEach((item, index) => {
57
- if (item === this) {
58
- this.grid.children.splice(index, 1)
59
- }
60
- })
61
- },
62
52
  computed: {
63
53
  itemStyle() {
64
54
  const style = {
65
- width: this.width
55
+ width: this.width,
56
+ ...(this.square && {height: this.width})
66
57
  };
67
- if(this.square) {
68
- style.height = this.width;
69
- }
70
58
  return this.$fu.deepMerge(style, this.$fu.addStyle(this.customStyle))
71
59
  }
72
60
  },
@@ -78,15 +66,25 @@
78
66
  }
79
67
  })
80
68
  }
69
+ },
70
+ beforeDestroy() {
71
+ this.grid.children.forEach((item, index) => {
72
+ if (item === this) {
73
+ this.grid.children.splice(index, 1)
74
+ }
75
+ })
81
76
  }
82
77
  }
83
78
  </script>
84
79
 
85
80
  <style lang="scss" scoped>
81
+ @import '../../libs/style/components.scss';
82
+ $border-color: #D2D2D2;
83
+
86
84
  .fu-grid-item {
85
+ @include flex;
87
86
  /* #ifndef APP-NVUE */
88
87
  height: 100%;
89
- display: flex;
90
88
  /* #endif */
91
89
  /* #ifdef H5 */
92
90
  cursor: pointer;
@@ -94,46 +92,44 @@
94
92
  }
95
93
 
96
94
  .fu-grid-item__box {
95
+ @include flex(column);
97
96
  /* #ifndef APP-NVUE */
98
- display: flex;
99
97
  width: 100%;
100
98
  /* #endif */
101
99
  position: relative;
102
100
  flex: 1;
103
- flex-direction: column;
104
101
  }
105
102
 
106
103
  .fu-grid-item--border {
107
104
  position: relative;
108
105
  /* #ifdef APP-NVUE */
109
- border-bottom-color: #D2D2D2;
106
+ border-bottom-color: $border-color;
110
107
  border-bottom-style: solid;
111
108
  border-bottom-width: 0.5px;
112
- border-right-color: #D2D2D2;
109
+ border-right-color: $border-color;
113
110
  border-right-style: solid;
114
111
  border-right-width: 0.5px;
115
112
  /* #endif */
116
113
  /* #ifndef APP-NVUE */
117
114
  z-index: 0;
118
- border-bottom: 1px #D2D2D2 solid;
119
- border-right: 1px #D2D2D2 solid;
115
+ border-bottom: 1px solid $border-color;
116
+ border-right: 1px solid $border-color;
120
117
  /* #endif */
121
118
  }
122
119
 
123
120
  .fu-grid-item--border-top {
124
121
  position: relative;
125
122
  /* #ifdef APP-NVUE */
126
- border-top-color: #D2D2D2;
123
+ border-top-color: $border-color;
127
124
  border-top-style: solid;
128
125
  border-top-width: 0.5px;
129
126
  /* #endif */
130
127
  /* #ifndef APP-NVUE */
131
- border-top: 1px #D2D2D2 solid;
128
+ border-top: 1px solid $border-color;
132
129
  z-index: 0;
133
130
  /* #endif */
134
131
  }
135
132
 
136
-
137
133
  .fu-highlight:active {
138
134
  background-color: #f1f1f1;
139
135
  }
@@ -1,16 +1,24 @@
1
1
  export default {
2
2
  props: {
3
- // 是否有点击效果
3
+ /**
4
+ * @description 是否有点击效果
5
+ * @default true
6
+ */
4
7
  highlight: {
5
8
  type: Boolean,
6
9
  default: true
7
10
  },
8
- // 定义背景色(默认 transparent)
11
+ /**
12
+ * @description 定义背景色
13
+ * @default 'transparent'
14
+ */
9
15
  bgColor: {
10
16
  type: String,
11
17
  default: 'transparent'
12
18
  },
13
- // 索引
19
+ /**
20
+ * @description 索引
21
+ */
14
22
  index: {
15
23
  type: Number,
16
24
  default: 0
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <view class="fu-icon" @click="handleClick">
3
+ <image class="fu-icon__img" :src="name" :mode="imgMode" :style="[imgStyle]" v-if="isImg"></image>
4
+
5
+ <!-- #ifdef APP-NVUE -->
6
+ <text class="fu-icon__icon" :style="iconStyle" v-else>{{ fucode }}</text>
7
+ <!-- #endif -->
8
+ <!-- #ifndef APP-NVUE -->
9
+ <text class="fu-icon__icon" :style="iconStyle" :class="['fu-icon-' + name]" v-else>
10
+ <slot></slot>
11
+ </text>
12
+ <!-- #endif -->
13
+ </view>
14
+ </template>
15
+
16
+ <script>
17
+ import mpMixin from '../../libs/mixin/mpMixin.js'
18
+ import props from './props.js'
19
+ import icon from './icon.js'
20
+ // #ifdef APP-NVUE
21
+ var domModule = weex.requireModule('dom');
22
+ import iconUrl from './icon.ttf'
23
+ domModule.addRule('fontFace', {
24
+ 'fontFamily': "fusionsicon",
25
+ 'src': "url('" + iconUrl + "')"
26
+ });
27
+ // #endif
28
+ /**
29
+ * Icon 图标
30
+ * @description 此组件用于展示 icon 图标
31
+ * @property {String} name 图标名称,参考示例
32
+ * @property {String} color 图标颜色
33
+ * @property {Number} size 图标大小(默认 16)
34
+ * @property {String} fontFamily 自定义图标
35
+ *
36
+ * @event {Function} click 点击图标触发
37
+ * @example <fu-icon name="success" size="40" color="#ff0000"></fu-icon>
38
+ */
39
+ export default {
40
+ name:"FuIcon",
41
+ emits:['click'],
42
+ mixins: [mpMixin, props],
43
+ data() {
44
+ return {
45
+ icon: icon.glyphs
46
+ }
47
+ },
48
+ computed: {
49
+ fucode() {
50
+ let code = this.icon.find(v => v.font_class === this.name)
51
+ if(code){
52
+ return unescape(`%u${code.unicode}`)
53
+ }
54
+ return ''
55
+ },
56
+ iconSize() {
57
+ return this.$fu.addUnit(this.size)
58
+ },
59
+ iconStyle() {
60
+ return {
61
+ color: this.color,
62
+ fontSize: this.iconSize,
63
+ ...(this.fontFamily && {fontFamily: this.fontFamily})
64
+ }
65
+ },
66
+ // 判断传入的name属性,是否图片路径,只要带有"/"均认为是图片形式
67
+ isImg() {
68
+ return this.name.indexOf('/') !== -1
69
+ },
70
+ imgStyle() {
71
+ // 如果设置 width 和 height 属性,则优先使用,否则使用 size 属性
72
+ return {
73
+ width: this.width? this.$fu.addUnit(this.width): this.$fu.addUnit(this.size),
74
+ height: this.height? this.$fu.addUnit(this.height): this.$fu.addUnit(this.size)
75
+ }
76
+ }
77
+ },
78
+ methods: {
79
+ // 图标点击事件
80
+ handleClick() {
81
+ this.$emit('click')
82
+ }
83
+ }
84
+ }
85
+ </script>
86
+
87
+ <style lang="scss" scoped>
88
+ @import '../../libs/style/components.scss';
89
+ /* #ifndef APP-NVUE */
90
+ @import './icon.css';
91
+ @font-face {
92
+ font-family: fusionsicon;
93
+ src: url('./icon.ttf') format('truetype');
94
+ }
95
+ /* #endif */
96
+
97
+ .fu-icon {
98
+ @include flex;
99
+ align-items: center;
100
+
101
+ &__icon {
102
+ font-family: fusionsicon;
103
+ text-decoration: none;
104
+ text-align: center;
105
+ }
106
+ }
107
+ </style>