fusions-ui 1.2.4 → 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 -20
  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 +26 -33
  31. package/components/fu-form-item/props.js +30 -8
  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 +38 -43
  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 +29 -27
  107. package/components/fu-swiper/props.js +81 -25
  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,21 +1,31 @@
1
1
  export default {
2
2
  props: {
3
- // 是否显示
3
+ /**
4
+ * @description 是否显示
5
+ * @default false
6
+ */
4
7
  show: {
5
8
  type: Boolean,
6
9
  default: false
7
10
  },
8
- // 可选签名颜色
11
+ /**
12
+ * @description 可选签名颜色
13
+ */
9
14
  signSelectColor: {
10
15
  type: Array,
11
- default: () => (['#080808', '#E83A30'])
16
+ default: () => (['#060606', '#ec3930'])
12
17
  },
13
- // 是否旋转输出图片
18
+ /**
19
+ * @description 是否旋转输出图片
20
+ * @default true
21
+ */
14
22
  rotate: {
15
23
  type: Boolean,
16
24
  default: true
17
25
  },
18
- // 自定义顶栏的高度
26
+ /**
27
+ * @description 自定义顶栏的高度
28
+ */
19
29
  customBarHeight: {
20
30
  type: [Number,String],
21
31
  default: 0
@@ -73,18 +73,17 @@
73
73
  // #endif
74
74
  },
75
75
  methods: {
76
- /**
77
- * 初始化数据
78
- */
76
+ // 初始化数据
79
77
  init() {
80
78
  let elements = [];
81
- if (!this.$fu.array(this.skeleton)) return this.$fu.error('skeleton参数必须为数组形式,参考文档示例:');
79
+ if (!this.$fu.isArray(this.skeleton)) return this.$fu.error('skeleton参数必须为数组形式,参考文档示例:');
82
80
  this.skeleton.forEach(item => {
83
81
  const elClass = this.getElCounts(item);
84
82
  elements = elements.concat(elClass);
85
83
  })
86
84
  this.elements = [...elements];
87
85
  },
86
+
88
87
  /**
89
88
  * 处理骨架屏参数内容
90
89
  * @param {Object} e 每项数据
@@ -92,11 +91,11 @@
92
91
  getElCounts(e) {
93
92
  let elements = [];
94
93
  let children = [];
95
- if (this.$fu.number(e)) return [{ type: 'gap', height: e }];
94
+ if (this.$fu.checkNumber(e)) return [{ type: 'gap', height: e }];
96
95
  const type = e.type || 'line';
97
96
  const num = e.num || 1;
98
97
  const style = e.style || {};
99
- const styleIsArray = this.$fu.array(style);
98
+ const styleIsArray = this.$fu.isArray(style);
100
99
  const gap = e.gap || '20rpx';
101
100
  const child = e.children || [];
102
101
  for (let i = 0; i < child.length; i++) {
@@ -123,9 +122,8 @@
123
122
  }
124
123
  return elements;
125
124
  },
126
- /**
127
- * 创建动画
128
- */
125
+
126
+ // 创建动画
129
127
  createAnimation(opacity = 1) {
130
128
  // loading结束之后或未开启动画不执行
131
129
  if (!this.loading || !this.animate) return;
@@ -151,8 +149,7 @@
151
149
  }
152
150
  </script>
153
151
  <style lang="scss" scoped>
154
- @import '../../libs/css/component.scss';
155
-
152
+ @import '../../libs/style/components.scss';
156
153
  $avatar: 100rpx;
157
154
  $avatarSm: 50rpx;
158
155
  $avatarLg: 200rpx;
@@ -237,6 +234,5 @@
237
234
  background-position: 0 50%
238
235
  }
239
236
  }
240
-
241
237
  /* #endif */
242
238
  </style>
@@ -1,21 +1,32 @@
1
1
  export default {
2
2
  props: {
3
- // 是否显示骨架
3
+ /**
4
+ * @description 是否显示骨架
5
+ * @default true
6
+ */
4
7
  loading: {
5
8
  type: Boolean,
6
9
  default: true
7
10
  },
8
- // 骨架内容 具体说明参考文档:
11
+ /**
12
+ * @description 骨架内容 具体说明参考文档:
13
+ */
9
14
  skeleton: {
10
15
  type: Array,
11
16
  default: () => []
12
17
  },
13
- // 是否开启动画效果
18
+ /**
19
+ * @description 是否开启动画效果
20
+ * @default true
21
+ */
14
22
  animate: {
15
23
  type: Boolean,
16
24
  default: true
17
25
  },
18
- // 是否圆角骨架风格
26
+ /**
27
+ * @description 是否圆角骨架风格
28
+ * @default false
29
+ */
19
30
  round: {
20
31
  type: Boolean,
21
32
  default: false
@@ -20,6 +20,7 @@
20
20
  * @property {String} activeIcon 激活状态的图标
21
21
  * @property {String} inactiveIcon 未激活状态图标
22
22
  * @property {Boolean} dot 是否显示点类型 (默认 false )
23
+ *
23
24
  * @example <fu-steps current="0"><fu-steps-item title="已出库" desc="10:35" ></fu-steps-item></fu-steps>
24
25
  */
25
26
  export default {
@@ -43,7 +44,7 @@
43
44
  updateChildData() {
44
45
  this.children.map(child => {
45
46
  // 先判断子组件是否存在对应的方法
46
- this.$fu.func((child || {}).updateFromParent()) && child.updateFromParent()
47
+ this.$fu.isFunc((child || {}).updateFromParent()) && child.updateFromParent()
47
48
  })
48
49
  },
49
50
  // 接受子组件的通知,去修改其他子组件的数据
@@ -63,7 +64,7 @@
63
64
  </script>
64
65
 
65
66
  <style lang="scss" scoped>
66
- @import '../../libs/css/component.scss';
67
+ @import '../../libs/style/components.scss';
67
68
 
68
69
  .fu-steps {
69
70
  @include flex;
@@ -1,36 +1,52 @@
1
1
  export default {
2
2
  props: {
3
- // 排列方向
3
+ /**
4
+ * @description 排列方向
5
+ * @values 'row' - 横向, 'column' - 竖向
6
+ * @default 'row'
7
+ */
4
8
  direction: {
5
9
  type: String,
6
10
  default: 'row'
7
11
  },
8
- // 设置第几个步骤
12
+ /**
13
+ * @description 设置第几个步骤
14
+ */
9
15
  current: {
10
16
  type: [String, Number],
11
17
  default: 0
12
18
  },
13
- // 激活状态颜色
19
+ /**
20
+ * @description 激活状态颜色
21
+ */
14
22
  activeColor: {
15
23
  type: String,
16
24
  default: '#2979ff'
17
25
  },
18
- // 未激活状态颜色
26
+ /**
27
+ * @description 未激活状态颜色
28
+ */
19
29
  inactiveColor: {
20
30
  type: String,
21
31
  default: '#969799'
22
32
  },
23
- // 激活状态的图标
33
+ /**
34
+ * @description 激活状态的图标
35
+ */
24
36
  activeIcon: {
25
37
  type: String,
26
38
  default: ''
27
39
  },
28
- // 未激活状态图标
40
+ /**
41
+ * @description 未激活状态图标
42
+ */
29
43
  inactiveIcon: {
30
44
  type: String,
31
45
  default: ''
32
46
  },
33
- // 是否显示点类型
47
+ /**
48
+ * @description 是否显示点类型
49
+ */
34
50
  dot: {
35
51
  type: Boolean,
36
52
  default: false
@@ -9,11 +9,11 @@
9
9
  <slot name="icon">
10
10
  <view class="fu-steps-item__wrapper__dot" v-if="parentData.dot" :style="{ backgroundColor: statusColor }"></view>
11
11
  <view class="fu-steps-item__wrapper__icon" v-else-if="parentData.activeIcon || parentData.inactiveIcon">
12
- <fu-icons :name="index <= parentData.current ? parentData.activeIcon : parentData.inactiveIcon" :size="iconSize" :color="index <= parentData.current ? parentData.activeColor : parentData.inactiveColor"></fu-icons>
12
+ <fu-icon :name="index <= parentData.current ? parentData.activeIcon : parentData.inactiveIcon" :size="iconSize" :color="index <= parentData.current ? parentData.activeColor : parentData.inactiveColor" />
13
13
  </view>
14
14
  <view class="fu-steps-item__wrapper__circle" :style="{ backgroundColor: statusClass === 'process' ? parentData.activeColor : 'transparent', borderColor: statusColor }" v-else>
15
15
  <text class="fu-steps-item__wrapper__circle__text" :style="{ color: index == parentData.current ? '#ffffff' : parentData.inactiveColor }" v-if="statusClass === 'process' || statusClass === 'wait'">{{ index + 1}}</text>
16
- <fu-icons :name="statusClass === 'error' ? 'cancel' : 'select'" size="12" :color="statusClass === 'error' ? '#f76c6c' : parentData.activeColor" v-else></fu-icons>
16
+ <fu-icon :name="statusClass === 'error' ? 'cancel' : 'select'" size="12" :color="statusClass === 'error' ? '#f76c6c' : parentData.activeColor" v-else />
17
17
  </view>
18
18
  </slot>
19
19
  </view>
@@ -157,7 +157,7 @@
157
157
  </script>
158
158
 
159
159
  <style lang="scss" scoped>
160
- @import '../../libs/css/component.scss';
160
+ @import '../../libs/style/components.scss';
161
161
 
162
162
  $fu-tips-color: #a7a8aa !default;
163
163
  $fu-content-color: #77797e !default;
@@ -1,21 +1,31 @@
1
1
  export default {
2
2
  props: {
3
- // 标题
3
+ /**
4
+ * @description 标题
5
+ */
4
6
  title: {
5
7
  type: [String, Number],
6
8
  default: ''
7
9
  },
8
- // 描述文本
10
+ /**
11
+ * @description 描述文本
12
+ */
9
13
  desc: {
10
14
  type: [String, Number],
11
15
  default: ''
12
16
  },
13
- // 图标大小
17
+ /**
18
+ * @description 图标大小
19
+ * @default 18
20
+ */
14
21
  iconSize: {
15
22
  type: [String, Number],
16
- default: 17
23
+ default: 18
17
24
  },
18
- // 当前步骤是否处于失败状态
25
+ /**
26
+ * @description 当前步骤是否处于失败状态
27
+ * @default false
28
+ */
19
29
  error: {
20
30
  type: Boolean,
21
31
  default: false
@@ -16,11 +16,12 @@
16
16
  * @property {String,Number} offsetTop 吸顶时与顶部的距离,单位px(默认 0 )
17
17
  * @property {String,Number} customNavHeight 自定义导航栏的高度 (h5 默认44 其他默认 0 )
18
18
  * @property {Boolean} disabled = [true|false] 是否禁用吸顶功能 (默认 false )
19
- * @property {String} bgColor 组件背景颜色
20
- * @property {String,Number} zIndex 吸顶时的z-index值(默认 998
19
+ * @property {String} bgColor 背景颜色
20
+ * @property {String,Number} zIndex 吸顶时的z-index值(默认 99
21
21
  * @property {String,Number} index 自定义标识,用于区分是哪一个组件(默认 0)
22
22
  * @property {String} customClass 自定义外部样式类
23
23
  * @property {Object,String} customStyle 自定义外部的样式
24
+ *
24
25
  * @example <fu-sticky offsetTop="200"><view>此处吸顶</view></fu-sticky>
25
26
  */
26
27
  export default {
@@ -139,7 +140,6 @@
139
140
  setFixed(top) {
140
141
  // 判断是否出于吸顶条件范围
141
142
  const fixed = top <= this.stickyTop;
142
- console.log(fixed);
143
143
  this.fixed = fixed;
144
144
  },
145
145
 
@@ -1,11 +1,15 @@
1
1
  export default {
2
2
  props: {
3
- // 吸顶容器到顶部某个距离的时候,进行吸顶,在H5平台,NavigationBar为44px
3
+ /**
4
+ * @description 吸顶容器到顶部某个距离的时候,进行吸顶,在H5平台,NavigationBar为44px
5
+ */
4
6
  offsetTop: {
5
7
  type: [String, Number],
6
8
  default: 0
7
9
  },
8
- // 自定义导航栏的高度
10
+ /**
11
+ * @description 自定义导航栏的高度
12
+ */
9
13
  customNavHeight: {
10
14
  type: [String, Number],
11
15
  // #ifdef H5
@@ -16,22 +20,32 @@ export default {
16
20
  default: 0
17
21
  // #endif
18
22
  },
19
- // 是否禁用吸顶功能
23
+ /**
24
+ * @description 是否禁用吸顶功能
25
+ * @default false
26
+ */
20
27
  disabled: {
21
28
  type: Boolean,
22
29
  default: false
23
30
  },
24
- // 吸顶区域的背景颜色
31
+ /**
32
+ * @description 吸顶区域的背景颜色
33
+ */
25
34
  bgColor: {
26
35
  type: String,
27
36
  default: ''
28
37
  },
29
- // z-index值
38
+ /**
39
+ * @description z-index值
40
+ * @default 99
41
+ */
30
42
  zIndex: {
31
43
  type: [String, Number],
32
- default: 998
44
+ default: 99
33
45
  },
34
- // 列表中的索引值
46
+ /**
47
+ * @description 列表中的索引值
48
+ */
35
49
  index: {
36
50
  type: [String, Number],
37
51
  default: 0
@@ -1,19 +1,24 @@
1
1
  <template>
2
2
  <view ref="fu-subsection" class="fu-subsection" :class="[`fu-subsection--${mode}`]" :style="[$fu.addStyle(this.customStyle), wrapperStyle]">
3
- <view ref="fu-subsection__bar" class="fu-subsection__bar" :style="[barStyle]"
3
+ <view
4
+ ref="fu-subsection__bar"
5
+ class="fu-subsection__bar"
6
+ :style="[barStyle]"
4
7
  :class="[
5
8
  mode === 'button' && 'fu-subsection--button__bar',
6
9
  current === 0 && mode === 'subsection' && 'fu-subsection__bar--first',
7
10
  current > 0 && current < list.length - 1 && mode === 'subsection' && 'fu-subsection__bar--center',
8
11
  current === list.length - 1 && mode === 'subsection' && 'fu-subsection__bar--last'
9
12
  ]"></view>
10
- <view :ref="`fu-subsection__item--${index}`" class="fu-subsection__item"
13
+ <view
14
+ :ref="`fu-subsection__item--${index}`"
15
+ class="fu-subsection__item"
11
16
  :class="[
12
17
  `fu-subsection__item--${index}`,
13
18
  index < list.length - 1 && 'fu-subsection__item--no-border-right',
14
19
  index === 0 && 'fu-subsection__item--first',
15
20
  index === list.length - 1 && 'fu-subsection__item--last'
16
- ]" :style="[itemStyle(index)]" v-for="(item, index) in list" :key="index" @tap="clickHandler(index)">
21
+ ]" :style="[itemStyle(index)]" v-for="(item, index) in list" :key="index" @tap="handleClick(index)">
17
22
  <text class="fu-subsection__item__text" :style="[textStyle(index)]">{{ getText(item) }}</text>
18
23
  </view>
19
24
  </view>
@@ -44,6 +49,7 @@
44
49
  * @property {String,Object} customStyle 定义需要用到的外部样式
45
50
  * @property {String,Object} customItemStyle 自定义选项样式
46
51
  * @property {String} keyName 从`list`元素对象中读取的键名(默认 'name' )
52
+ *
47
53
  * @event {Function} change 分段器选项发生改变时触发 回调 index:选项的index索引值,从0开始
48
54
  * @example <fu-subsection :list="list" :current="current" @change="sectionChange"></fu-subsection>
49
55
  */
@@ -152,7 +158,7 @@
152
158
  // #endif
153
159
  },
154
160
 
155
- clickHandler(index) {
161
+ handleClick(index) {
156
162
  this.$emit("change", index);
157
163
  }
158
164
  },
@@ -188,21 +194,24 @@
188
194
  </script>
189
195
 
190
196
  <style lang="scss" scoped>
197
+ @import '../../libs/style/components.scss';
198
+ $padding: 3px;
199
+ $border-radius: 3px;
200
+
191
201
  .fu-subsection {
192
- display: flex;
193
- flex-direction: row;
202
+ @include flex(row);
194
203
  position: relative;
195
- overflow: hidden;
196
204
  /* #ifndef APP-NVUE */
197
205
  width: 100%;
198
206
  box-sizing: border-box;
207
+ overflow: hidden;
199
208
  /* #endif */
200
209
 
201
210
  &--button {
202
211
  height: 32px;
203
212
  background-color: rgb(238, 238, 239);
204
- padding: 3px;
205
- border-radius: 3px;
213
+ padding: $padding;
214
+ border-radius: $border-radius;
206
215
  align-items: stretch;
207
216
 
208
217
  &__bar {
@@ -223,8 +232,8 @@
223
232
  /* #endif */
224
233
 
225
234
  &--first {
226
- border-top-left-radius: 3px;
227
- border-bottom-left-radius: 3px;
235
+ border-top-left-radius: $border-radius;
236
+ border-bottom-left-radius: $border-radius;
228
237
  border-top-right-radius: 0px;
229
238
  border-bottom-right-radius: 0px;
230
239
  }
@@ -239,17 +248,16 @@
239
248
  &--last {
240
249
  border-top-left-radius: 0px;
241
250
  border-bottom-left-radius: 0px;
242
- border-top-right-radius: 3px;
243
- border-bottom-right-radius: 3px;
251
+ border-top-right-radius: $border-radius;
252
+ border-bottom-right-radius: $border-radius;
244
253
  }
245
254
  }
246
255
 
247
256
  &__item {
248
- display: flex;
249
- flex-direction: row;
250
- flex: 1;
257
+ @include flex(row);
251
258
  justify-content: center;
252
259
  align-items: center;
260
+ flex: 1;
253
261
  // vue环境下,需要设置相对定位,因为滑块为绝对定位,item需要在滑块的上面
254
262
  position: relative;
255
263
 
@@ -258,20 +266,19 @@
258
266
  }
259
267
 
260
268
  &--first {
261
- border-top-left-radius: 3px;
262
- border-bottom-left-radius: 3px;
269
+ border-top-left-radius: $border-radius;
270
+ border-bottom-left-radius: $border-radius;
263
271
  }
264
272
 
265
273
  &--last {
266
- border-top-right-radius: 3px;
267
- border-bottom-right-radius: 3px;
274
+ border-top-right-radius: $border-radius;
275
+ border-bottom-right-radius: $border-radius;
268
276
  }
269
277
 
270
278
  &__text {
279
+ @include flex(row);
271
280
  font-size: 12px;
272
281
  line-height: 12px;
273
- display: flex;
274
- flex-direction: row;
275
282
  align-items: center;
276
283
  transition-property: color;
277
284
  transition-duration: 0.3s;
@@ -1,55 +1,85 @@
1
1
  export default {
2
2
  props: {
3
- // 滑块的移动过渡时间,单位ms
3
+ /**
4
+ * @description 滑块的移动过渡时间,单位ms
5
+ * @default 300
6
+ */
4
7
  duration: {
5
8
  type: [String,Number],
6
9
  default: 300
7
10
  },
8
- // tab的数据
11
+ /**
12
+ * @description subsection的数据
13
+ */
9
14
  list: {
10
15
  type: Array,
11
16
  default: () => []
12
17
  },
13
- // 当前活动的tab的index
18
+ /**
19
+ * @description 当前活动的subsection的index
20
+ */
14
21
  current: {
15
22
  type: [String,Number],
16
23
  default: 0
17
24
  },
18
- // 激活的颜色
25
+ /**
26
+ * @description 激活的颜色
27
+ */
19
28
  activeColor: {
20
29
  type: String,
21
30
  default: '#2979ff'
22
31
  },
23
- // 未激活的颜色
32
+ /**
33
+ * @description 未激活的颜色
34
+ */
24
35
  inactiveColor: {
25
36
  type: String,
26
37
  default: '#303133'
27
38
  },
28
- // 模式选择,mode=button为按钮模式,mode=subsection时为分段器模式(默认 'button')
39
+ // 模式选择(默认 'button')
40
+ /**
41
+ * @description 模式选择
42
+ * @values 'button' - 按钮模式, 'subsection' - 分段器模式
43
+ */
29
44
  mode: {
30
45
  type: String,
31
46
  default: 'button'
32
47
  },
33
- // 字体大小
48
+ /**
49
+ * @description 字体大小
50
+ * @default 12
51
+ */
34
52
  size: {
35
53
  type: [String,Number],
36
54
  default: 12
37
55
  },
38
- // 激活tab的字体是否加粗
56
+ /**
57
+ * @description 激活subsection的字体是否加粗
58
+ * @default true
59
+ */
39
60
  bold: {
40
61
  type: Boolean,
41
62
  default: true
42
63
  },
43
- // mode = button时,组件背景颜色
64
+ /**
65
+ * @description 组件背景颜色(仅mode=button时生效)
66
+ * @default '#efeff0'
67
+ */
44
68
  bgColor: {
45
69
  type: String,
46
70
  default: '#efeff0'
47
71
  },
48
- // 从list元素对象中读取的键名
72
+ /**
73
+ * @description 从list元素对象中读取的键名
74
+ * @default 'name'
75
+ */
49
76
  keyName: {
50
77
  type: String,
51
78
  default: 'name'
52
79
  },
80
+ /**
81
+ * @description 自定义item外部样式
82
+ */
53
83
  customItemStyle: {
54
84
  type: [String, Object],
55
85
  default: ''
@@ -61,7 +61,7 @@ bindIngXMixins = {
61
61
  }, 200)
62
62
  })
63
63
  },
64
- onClick(index, item, position) {
64
+ handleClick(index, item, position) {
65
65
  this.$emit('click', {
66
66
  content: item,
67
67
  index,