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,5 +1,8 @@
1
1
  export default {
2
2
  props: {
3
+ /**
4
+ * @description value / v-model 预置值
5
+ */
3
6
  value: {
4
7
  type: [String,Number],
5
8
  default: ''
@@ -8,77 +11,123 @@ export default {
8
11
  type: [String,Number],
9
12
  default: ''
10
13
  },
11
- // 键盘弹起时,是否自动上推页面
14
+ /**
15
+ * @description 键盘弹起时,是否自动上推页面
16
+ * @default true
17
+ */
12
18
  adjustPosition: {
13
19
  type: Boolean,
14
20
  default: true
15
21
  },
16
- // 最大输入长度
22
+ /**
23
+ * @description 最大输入长度
24
+ * @default 4
25
+ */
17
26
  maxlength: {
18
27
  type: [String,Number],
19
28
  default: 4
20
29
  },
21
- // 是否用圆点填充
30
+ /**
31
+ * @description 是否用圆点填充
32
+ * @default false
33
+ */
22
34
  dot: {
23
35
  type: Boolean,
24
36
  default: false
25
37
  },
26
- // 显示模式,box-盒子模式,line-底部横线模式
38
+ /**
39
+ * @description 显示模式
40
+ * @values 'box' - 盒子模式, 'line' - 底部横线模式
41
+ * @default 'box'
42
+ */
27
43
  mode: {
28
44
  type: String,
29
45
  default: 'box'
30
46
  },
31
- // 是否细边框
47
+ /**
48
+ * @description 是否细边框
49
+ * @default false
50
+ */
32
51
  hairline: {
33
52
  type: Boolean,
34
53
  default: false
35
54
  },
36
- // 字符间的距离
55
+ /**
56
+ * @description 字符间的距离
57
+ * @default 10
58
+ */
37
59
  space: {
38
60
  type: [String,Number],
39
61
  default: 10
40
62
  },
41
- // 是否自动获取焦点
63
+ /**
64
+ * @description 是否自动获取焦点
65
+ * @default false
66
+ */
42
67
  focus: {
43
68
  type: Boolean,
44
69
  default: false
45
70
  },
46
- // 字体是否加粗
71
+ /**
72
+ * @description 字体是否加粗
73
+ * @default false
74
+ */
47
75
  bold: {
48
76
  type: Boolean,
49
77
  default: false
50
78
  },
51
- // 字体颜色
79
+ /**
80
+ * @description 字体颜色
81
+ * @default '#626468'
82
+ */
52
83
  color: {
53
84
  type: String,
54
- default: '#5c5e62'
85
+ default: '#626468'
55
86
  },
56
- // 字体大小
87
+ /**
88
+ * @description 字体大小
89
+ * @default 18
90
+ */
57
91
  fontSize: {
58
92
  type: [String,Number],
59
93
  default: 18
60
94
  },
61
- // 输入框的大小,宽等于高
95
+ /**
96
+ * @description 输入框的大小,宽等于高
97
+ * @default 35
98
+ */
62
99
  size: {
63
100
  type: [String,Number],
64
101
  default: 35
65
102
  },
66
- // 是否隐藏原生键盘,如果想用自定义键盘的话,需设置此参数为true
103
+ /**
104
+ * @description 是否隐藏原生键盘,如果想用自定义键盘的话,需设置此参数为true
105
+ * @default false
106
+ */
67
107
  disabledKeyboard: {
68
108
  type: Boolean,
69
109
  default: false
70
110
  },
71
- // 边框和线条颜色
111
+ /**
112
+ * @description 边框和线条颜色
113
+ * @default '#cdcdce'
114
+ */
72
115
  borderColor: {
73
116
  type: String,
74
- default: '#c9cacb'
117
+ default: '#cdcdce'
75
118
  },
76
- // 是否禁止输入"."符号
119
+ /**
120
+ * @description 是否禁止输入"."符号
121
+ * @default true
122
+ */
77
123
  disabledDot: {
78
124
  type: Boolean,
79
125
  default: true
80
126
  },
81
- // 自定义圆角(默认 4)
127
+ /**
128
+ * @description 设置圆角
129
+ * @default 4
130
+ */
82
131
  radius: {
83
132
  type: [String,Number],
84
133
  default: 4
@@ -1,5 +1,7 @@
1
1
  <template>
2
- <view class="fu-code-verify" :style="[{
2
+ <view
3
+ class="fu-code-verify"
4
+ :style="[{
3
5
  fontSize: $fu.addUnit(size),
4
6
  background: bgColor,
5
7
  color: color,
@@ -8,7 +10,8 @@
8
10
  ...($fu.addStyle(customStyle) || {}),
9
11
  ...(width && { width: $fu.addUnit(width)}),
10
12
  ...(height && { lineHeight: $fu.addUnit(height)})
11
- }, opacity]" @tap="start()">
13
+ }, opacity]"
14
+ @tap="handleStart">
12
15
  <slot>{{text || ''}}</slot>
13
16
  </view>
14
17
  </template>
@@ -38,6 +41,7 @@
38
41
  * @property {String} uniqueKey 为了区分多个页面,或者一个页面多个倒计时组件本地存储的继续倒计时变了
39
42
  * @property {Boolean} startState = [true|false] 是否默认倒计时状态 默认false
40
43
  * @property {Object,String} customStyle 自定义外部样式
44
+ *
41
45
  * @event {Function} send 点击按钮触发
42
46
  * @event {Function} start 开始倒计时触发
43
47
  * @event {Function} end 结束倒计时触发
@@ -101,7 +105,7 @@
101
105
  }
102
106
  },
103
107
 
104
- start() {
108
+ handleStart() {
105
109
  if(!this.secNum || this.timer) return
106
110
  this.text = this.sendText || '';
107
111
  this.opacity = `opacity: ${this.isOpacity? '.6': 1};`;
@@ -174,7 +178,7 @@
174
178
  seconds: {
175
179
  immediate: true,
176
180
  handler(n) {
177
- this.secNum = n
181
+ this.secNum = n;
178
182
  }
179
183
  },
180
184
  successVal(val) {
@@ -204,7 +208,7 @@
204
208
  </script>
205
209
 
206
210
  <style lang="scss" scoped>
207
- @import '../../libs/css/color.scss';
211
+ @import '../../libs/style/color.scss';
208
212
 
209
213
  .fu-code-verify {
210
214
  width: fit-content;
@@ -1,86 +1,133 @@
1
1
  export default {
2
2
  props: {
3
- // 倒计时总秒数
3
+ /**
4
+ * @description 倒计时总秒数
5
+ * @default 60
6
+ */
4
7
  seconds: {
5
8
  type: Number,
6
9
  default: 60
7
10
  },
8
- // 发送前显示文本
11
+ /**
12
+ * @description 发送前显示文本
13
+ * @default '获取验证码'
14
+ */
9
15
  startText: {
10
16
  type: String,
11
17
  default: '获取验证码'
12
18
  },
13
- // 发送中显示文本
19
+ /**
20
+ * @description 发送中显示文本
21
+ * @default '请稍候...'
22
+ */
14
23
  sendText: {
15
24
  type: String,
16
25
  default: '请稍候...'
17
26
  },
18
- // 正在倒计时中的提示
27
+ /**
28
+ * @description 正在倒计时中的提示
29
+ * @default 'Xs后获取'
30
+ */
19
31
  changeText: {
20
32
  type: String,
21
33
  default: 'Xs后获取'
22
34
  },
23
- // 倒计时结束时的提示
35
+ /**
36
+ * @description 倒计时结束时的提示
37
+ * @default '重新获取'
38
+ */
24
39
  endText: {
25
40
  type: String,
26
41
  default: '重新获取'
27
42
  },
28
- // 按钮宽度
43
+ /**
44
+ * @description 按钮宽度
45
+ */
29
46
  width: {
30
47
  type: [String,Number],
31
48
  default: ''
32
49
  },
33
- // 按钮高度
50
+ /**
51
+ * @description 按钮高度
52
+ */
34
53
  height: {
35
54
  type: [String,Number],
36
55
  default: ''
37
56
  },
38
- // 按钮字体颜色
57
+ /**
58
+ * @description 按钮字体颜色
59
+ */
39
60
  color: {
40
61
  type: String,
41
62
  default: ''
42
63
  },
43
- // 按钮字体大小
64
+ /**
65
+ * @description 按钮字体大小
66
+ * @default 14
67
+ */
44
68
  size: {
45
69
  type: [String,Number],
46
70
  default: 14
47
71
  },
48
- // 按钮背景颜色
72
+ /**
73
+ * @description 按钮背景颜色
74
+ * @default 'transparent'
75
+ */
49
76
  bgColor: {
50
77
  type: String,
51
78
  default: 'transparent'
52
79
  },
53
- // 按钮边框颜色
80
+ /**
81
+ * @description 按钮边框颜色
82
+ * @default 'transparent'
83
+ */
54
84
  borderColor: {
55
85
  type: String,
56
86
  default: 'transparent'
57
87
  },
58
- // 按钮圆角值
88
+ /**
89
+ * @description 按钮圆角值
90
+ * @default 4
91
+ */
59
92
  radius: {
60
93
  type: [String,Number],
61
94
  default: 4
62
95
  },
63
- // 倒计时的时候是否改变opacity值
96
+ /**
97
+ * @description 倒计时的时候是否改变opacity值
98
+ * @default true
99
+ */
64
100
  isOpacity: {
65
101
  type: Boolean,
66
102
  default: true
67
103
  },
68
- // 短信发送成功(改变数值且数值大于0表示发送成功,多次发送数值递增即可)
104
+ /**
105
+ * @description 短信发送成功(改变数值且数值大于0表示发送成功,多次发送数值递增即可)
106
+ * @default 0
107
+ */
69
108
  successVal: {
70
109
  type: Number,
71
110
  default: 0
72
111
  },
73
- // 是否在H5刷新或各端返回再进入时继续倒计时
112
+ /**
113
+ * @description 是否在H5刷新或各端返回再进入时继续倒计时
114
+ * @default false
115
+ */
74
116
  keepRunning: {
75
117
  type: Boolean,
76
118
  default: false
77
119
  },
78
- // 为了区分多个页面,或者一个页面多个倒计时组件本地存储的继续倒计时变了
120
+ /**
121
+ * @description 为了区分多个页面,或者一个页面多个倒计时组件本地存储的继续倒计时变了
122
+ */
79
123
  uniqueKey: {
80
124
  type: String,
81
125
  default: ''
82
126
  },
83
- // 是否默认为倒计时状态 默认false
127
+ /**
128
+ * @description 是否默认为倒计时状态
129
+ * @default false
130
+ */
84
131
  startState: {
85
132
  type: Boolean,
86
133
  default: false
@@ -13,7 +13,9 @@
13
13
  * @property {String,Array} value 当前激活面板改变时触发(如果是手风琴模式,参数类型为string,否则为array)
14
14
  * @property {Boolean} accordion = [true|false] 是否开启手风琴效果是否开启手风琴效果
15
15
  * @property {String} bgColor 自定义背景色 默认('#FFFFFF') 透明色设置transparent
16
+ *
16
17
  * @event {Function} change 切换面板时触发,如果是手风琴模式,返回类型为string,否则为array
18
+ * @example <fu-collapse></fu-collapse>
17
19
  */
18
20
  export default {
19
21
  name:"FuCollapse",
@@ -76,6 +78,7 @@
76
78
  })
77
79
  this.emit(val)
78
80
  },
81
+
79
82
  setAccordion(self) {
80
83
  if (!this.accordion) return
81
84
  this.childrens.forEach((item, index) => {
@@ -84,6 +87,7 @@
84
87
  }
85
88
  })
86
89
  },
90
+
87
91
  resize() {
88
92
  this.childrens.forEach((item, index) => {
89
93
  // #ifndef APP-NVUE
@@ -94,7 +98,8 @@
94
98
  // #endif
95
99
  })
96
100
  },
97
- onChange(isOpen, self) {
101
+
102
+ handleChange(isOpen, self) {
98
103
  let activeItem = []
99
104
 
100
105
  if (this.accordion) {
@@ -109,6 +114,7 @@
109
114
  this.$emit('change', activeItem)
110
115
  this.emit(activeItem)
111
116
  },
117
+
112
118
  emit(val){
113
119
  this.$emit('input', val)
114
120
  this.$emit('update:modelValue', val)
@@ -123,14 +129,15 @@
123
129
  </script>
124
130
 
125
131
  <style lang="scss" scoped>
132
+ @import '../../libs/style/components.scss';
133
+
126
134
  .fu-collapse {
135
+ @include flex(column);
127
136
  /* #ifndef APP-NVUE */
128
137
  width: 100%;
129
- display: flex;
130
138
  /* #endif */
131
139
  /* #ifdef APP-NVUE */
132
140
  flex: 1;
133
141
  /* #endif */
134
- flex-direction: column;
135
142
  }
136
143
  </style>
@@ -1,6 +1,8 @@
1
1
  export default {
2
2
  props: {
3
- // 当前激活面板改变时触发(如果是手风琴模式,参数类型为string,否则为array)
3
+ /**
4
+ * @description 当前激活面板改变时触发(如果是手风琴模式,参数类型为string,否则为array)
5
+ */
4
6
  value: {
5
7
  type: [String,Array],
6
8
  default: ''
@@ -9,12 +11,16 @@ export default {
9
11
  type: [String,Array],
10
12
  default: ''
11
13
  },
12
- // 是否开启手风琴效果是否开启手风琴效果
14
+ /**
15
+ * @description 是否开启手风琴效果是否开启手风琴效果
16
+ */
13
17
  accordion: {
14
18
  type: Boolean,
15
19
  default: false
16
20
  },
17
- // 自定义背景色
21
+ /**
22
+ * @description 自定义背景色
23
+ */
18
24
  bgColor: {
19
25
  type: String,
20
26
  default: '#FFFFFF'
@@ -1,7 +1,10 @@
1
1
  <template>
2
2
  <view class="fu-collapse-item">
3
- <view @click="onClick(!isOpen)" class="fu-collapse-item__title"
4
- :class="{'is-open':isOpen &&titleBorder === 'auto' ,'fu-collapse-item-border':titleBorder !== 'none'}" :style="{background: bgColor}">
3
+ <view
4
+ class="fu-collapse-item__title"
5
+ :class="{'is-open':isOpen &&titleBorder === 'auto' ,'fu-collapse-item-border':titleBorder !== 'none'}"
6
+ :style="{background: bgColor}"
7
+ @click="handleClick(!isOpen)">
5
8
  <view class="fu-collapse-item__title-wrap">
6
9
  <slot name="title">
7
10
  <view class="fu-collapse-item__title-box" :class="{'is-disabled':disabled}" :style="[{padding: padding}]">
@@ -14,12 +17,18 @@
14
17
  class="fu-collapse-item__title-arrow"
15
18
  :class="{ 'fu-collapse-item__title-arrow-active': isOpen, 'fu-collapse-item--animation': showAnimation === true }"
16
19
  v-if="showArrow">
17
- <fu-icons :color="disabled?'#ddd':'#bbb'" size="15" name="down" />
20
+ <fu-icon :color="disabled?'#ddd':'#bbb'" size="15" name="down" />
18
21
  </view>
19
22
  </view>
20
- <view class="fu-collapse-item__wrap" :class="{'is--transition':showAnimation}" :style="{height: (isOpen?height:0) +'px'}">
21
- <view :id="elId" ref="collapse--hook" class="fu-collapse-item__wrap-content"
22
- :class="{open:isheight,'fu-collapse-item--border':border&&isOpen}">
23
+ <view
24
+ class="fu-collapse-item__wrap"
25
+ :class="{'is--transition':showAnimation}"
26
+ :style="{height: (isOpen? height: 0) + 'px'}">
27
+ <view
28
+ :id="elId"
29
+ ref="collapse--hook"
30
+ class="fu-collapse-item__wrap-content"
31
+ :class="{open: isheight, 'fu-collapse-item--border': border && isOpen}">
23
32
  <slot></slot>
24
33
  </view>
25
34
  </view>
@@ -44,8 +53,11 @@
44
53
  * @property {Boolean} disabled = [true|false] 是否展开面板 默认false
45
54
  * @property {Boolean} showAnimation = [true|false] 开启动画
46
55
  * @property {Boolean} showArrow = [true|false] 是否显示右侧箭头
47
- * @property {String} bgColor 自定义背景色 默认('#FFFFFF') 透明色设置transparent
56
+ * @property {String} bgColor 背景颜色 默认('#FFFFFF') 透明色设置transparent
48
57
  * @property {String} padding 自定义内间距(默认 '0 30rpx')
58
+ *
59
+ * @event {Function} change 某个item被打开或者收起时触发
60
+ * @example <fu-collapse-item :title="item.title" v-for="(item, index) in list" :key="index">{{ item.name }}</fu-collapse-item>
49
61
  */
50
62
  export default {
51
63
  name:"FuCollapseItem",
@@ -69,7 +81,7 @@
69
81
  created() {
70
82
  this.collapse = this.getCollapse();
71
83
  this.oldHeight = 0;
72
- this.onClick(this.open, 'init');
84
+ this.handleClick(this.open, 'init');
73
85
  },
74
86
  // #ifndef VUE3
75
87
  destroyed() {
@@ -109,6 +121,7 @@
109
121
  this.getNvueHwight(type)
110
122
  // #endif
111
123
  },
124
+
112
125
  uninstall() {
113
126
  if (this.collapse) {
114
127
  this.collapse.childrens.forEach((item, index) => {
@@ -123,16 +136,18 @@
123
136
  })
124
137
  }
125
138
  },
126
- onClick(isOpen, type) {
139
+
140
+ handleClick(isOpen, type) {
127
141
  if (this.disabled) return
128
142
  this.isOpen = isOpen;
129
143
  if (this.isOpen && this.collapse) {
130
144
  this.collapse.setAccordion(this)
131
145
  }
132
146
  if (type !== 'init') {
133
- this.collapse.onChange(isOpen, this)
147
+ this.collapse.handleChange(isOpen, this)
134
148
  }
135
149
  },
150
+
136
151
  getCollapseHeight(type, index = 0) {
137
152
  const views = uni.createSelectorQuery().in(this)
138
153
  views.select(`#${this.elId}`).fields({size: true}, data => {
@@ -144,31 +159,33 @@
144
159
  return
145
160
  }
146
161
  // #ifdef APP-NVUE
147
- this.height = data.height + 1
162
+ this.height = data.height + 1;
148
163
  // #endif
149
164
  // #ifndef APP-NVUE
150
- this.height = data.height
165
+ this.height = data.height;
151
166
  // #endif
152
- this.isheight = true
167
+ this.isheight = true;
153
168
  if (type) return
154
- this.onClick(this.isOpen, 'init')
169
+ this.handleClick(this.isOpen, 'init')
155
170
  }).exec()
156
171
  },
172
+
157
173
  getNvueHwight(type) {
158
174
  const result = dom.getComponentRect(this.$refs['collapse--hook'], option => {
159
175
  if (option && option.result && option.size) {
160
176
  // #ifdef APP-NVUE
161
- this.height = option.size.height + 1
177
+ this.height = option.size.height + 1;
162
178
  // #endif
163
179
  // #ifndef APP-NVUE
164
- this.height = option.size.height
180
+ this.height = option.size.height;
165
181
  // #endif
166
- this.isheight = true
182
+ this.isheight = true;
167
183
  if (type) return
168
- this.onClick(this.open, 'init')
184
+ this.handleClick(this.open, 'init')
169
185
  }
170
186
  })
171
187
  },
188
+
172
189
  /**
173
190
  * 获取父元素实例
174
191
  */
@@ -186,25 +203,26 @@
186
203
  watch: {
187
204
  open(val) {
188
205
  this.isOpen = val
189
- this.onClick(val, 'init')
206
+ this.handleClick(val, 'init')
190
207
  }
191
208
  }
192
209
  }
193
210
  </script>
194
211
 
195
- <style lang="scss">
212
+ <style lang="scss" scoped>
213
+ @import '../../libs/style/components.scss';
214
+
196
215
  .fu-collapse-item {
197
216
  /* #ifndef APP-NVUE */
198
217
  box-sizing: border-box;
199
-
200
218
  /* #endif */
219
+
201
220
  &__title {
221
+ @include flex(row);
202
222
  /* #ifndef APP-NVUE */
203
- display: flex;
204
223
  width: 100%;
205
224
  box-sizing: border-box;
206
225
  /* #endif */
207
- flex-direction: row;
208
226
  align-items: center;
209
227
  transition: border-bottom-color .3s;
210
228
 
@@ -214,13 +232,11 @@
214
232
  }
215
233
 
216
234
  &-box {
217
- // padding: 0 15px;
235
+ @include flex(row);
218
236
  /* #ifndef APP-NVUE */
219
- display: flex;
220
237
  width: 100%;
221
238
  box-sizing: border-box;
222
239
  /* #endif */
223
- flex-direction: row;
224
240
  justify-content: space-between;
225
241
  align-items: center;
226
242
  height: 48px;
@@ -261,17 +277,17 @@
261
277
  /* #ifndef APP-NVUE */
262
278
  white-space: nowrap;
263
279
  color: inherit;
280
+ overflow: hidden;
264
281
  /* #endif */
265
282
  /* #ifdef APP-NVUE */
266
283
  lines: 1;
267
284
  /* #endif */
268
- overflow: hidden;
269
285
  text-overflow: ellipsis;
270
286
  }
271
287
 
272
288
  &-arrow {
289
+ @include flex;
273
290
  /* #ifndef APP-NVUE */
274
- display: flex;
275
291
  box-sizing: border-box;
276
292
  /* #endif */
277
293
  align-items: center;
@@ -290,13 +306,12 @@
290
306
  /* #ifndef APP-NVUE */
291
307
  will-change: height;
292
308
  box-sizing: border-box;
293
- /* #endif */
294
309
  overflow: hidden;
310
+ /* #endif */
295
311
  position: relative;
296
312
  height: 0;
297
313
 
298
314
  &.is--transition {
299
- // transition: all 0.3s;
300
315
  transition-property: height, border-bottom-width;
301
316
  transition-duration: 0.3s;
302
317
  /* #ifndef APP-NVUE */
@@ -308,7 +323,6 @@
308
323
  position: absolute;
309
324
  font-size: 13px;
310
325
  color: #303133;
311
- // transition: height 0.3s;
312
326
  border-bottom-color: transparent;
313
327
  border-bottom-style: solid;
314
328
  border-bottom-width: 0;