fusions-ui 1.2.6 → 1.2.8
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.
- package/LICENSE +1 -1
- package/changelog.md +2 -0
- package/components/avatar/index.ts +1 -0
- package/components/avatar/src/avatar.ts +131 -0
- package/components/avatar/src/avatar.vue +104 -0
- package/components/avatar/src/composables/index.ts +1 -0
- package/components/avatar/src/composables/use-avatar.ts +61 -0
- package/components/avatar-group/index.ts +1 -0
- package/components/avatar-group/src/avatar-group.ts +86 -0
- package/components/{fu-avatar-group/fu-avatar-group.vue → avatar-group/src/avatar-group.vue} +27 -34
- package/components/avatar-group/src/composables/index.ts +1 -0
- package/components/avatar-group/src/composables/use-avatar-group.ts +17 -0
- package/components/badge/index.ts +1 -0
- package/components/badge/src/badge.ts +126 -0
- package/components/{fu-badge/fu-badge.vue → badge/src/badge.vue} +26 -62
- package/components/badge/src/composables/badge-custom.ts +51 -0
- package/components/badge/src/composables/index.ts +1 -0
- package/components/banner-arc/index.ts +1 -0
- package/components/banner-arc/src/banner-arc.ts +41 -0
- package/components/banner-arc/src/banner-arc.vue +49 -0
- package/components/banner-arc/src/composables/banner-arc-custom.ts +19 -0
- package/components/banner-arc/src/composables/index.ts +1 -0
- package/components/button/index.ts +1 -0
- package/components/button/src/button.ts +332 -0
- package/components/{fu-button/fu-button.vue → button/src/button.vue} +57 -163
- package/components/button/src/composables/button-custom.ts +90 -0
- package/components/button/src/composables/index.ts +2 -0
- package/components/button/src/composables/use-button.ts +137 -0
- package/components/cell/index.ts +1 -0
- package/components/cell/src/cell.ts +167 -0
- package/components/{fu-cell/fu-cell.vue → cell/src/cell.vue} +29 -38
- package/components/cell/src/composables/index.ts +1 -0
- package/components/cell/src/composables/use-cell.ts +20 -0
- package/components/cell-group/index.ts +1 -0
- package/components/cell-group/src/cell-group.ts +23 -0
- package/components/{fu-cell-group/fu-cell-group.vue → cell-group/src/cell-group.vue} +8 -13
- package/components/checkbox/index.ts +1 -0
- package/components/checkbox/src/checkbox.ts +144 -0
- package/components/checkbox/src/checkbox.vue +270 -0
- package/components/checkbox/src/composables/checkbox-custom.ts +15 -0
- package/components/checkbox/src/composables/index.ts +2 -0
- package/components/checkbox/src/composables/use-checkbox.ts +200 -0
- package/components/code-input/index.ts +1 -0
- package/components/code-input/src/code-input.ts +157 -0
- package/components/code-input/src/code-input.vue +158 -0
- package/components/code-input/src/composables/code-input-custom.ts +74 -0
- package/components/code-input/src/composables/index.ts +2 -0
- package/components/code-input/src/composables/use-code-input.ts +67 -0
- package/components/code-verify/index.ts +1 -0
- package/components/code-verify/src/code-verify.ts +160 -0
- package/components/code-verify/src/code-verify.vue +87 -0
- package/components/code-verify/src/composables/code-verify-custom.ts +23 -0
- package/components/code-verify/src/composables/index.ts +2 -0
- package/components/code-verify/src/composables/use-code-verify.ts +132 -0
- package/components/collapse/index.ts +1 -0
- package/components/collapse/src/collapse.ts +41 -0
- package/components/collapse/src/collapse.vue +48 -0
- package/components/collapse/src/composables/index.ts +1 -0
- package/components/collapse/src/composables/use-collapse.ts +150 -0
- package/components/collapse-item/index.ts +1 -0
- package/components/collapse-item/src/collapse-item.ts +102 -0
- package/components/{fu-collapse-item/fu-collapse-item.vue → collapse-item/src/collapse-item.vue} +20 -159
- package/components/collapse-item/src/composables/index.ts +1 -0
- package/components/collapse-item/src/composables/use-collapse-item.ts +139 -0
- package/components/countdown/index.ts +1 -0
- package/components/countdown/src/composables/index.ts +1 -0
- package/components/countdown/src/composables/use-countdown.ts +133 -0
- package/components/countdown/src/countdown.ts +63 -0
- package/components/countdown/src/countdown.vue +60 -0
- package/components/{fu-countdown/util.js → countdown/src/util.ts} +5 -5
- package/components/datetime-picker/index.ts +1 -0
- package/components/datetime-picker/src/composables/index.ts +1 -0
- package/components/datetime-picker/src/composables/use-datetime-picker.ts +325 -0
- package/components/datetime-picker/src/datetime-picker.ts +223 -0
- package/components/datetime-picker/src/datetime-picker.vue +96 -0
- package/components/form/index.ts +1 -0
- package/components/form/src/composables/index.ts +1 -0
- package/components/form/src/composables/use-form.ts +256 -0
- package/components/form/src/form.ts +108 -0
- package/components/form/src/form.vue +64 -0
- package/components/{fu-form/utils.js → form/src/utils.ts} +49 -42
- package/components/{fu-form/validate.js → form/src/validate.ts} +58 -49
- package/components/form-item/index.ts +1 -0
- package/components/form-item/src/composables/index.ts +1 -0
- package/components/form-item/src/composables/use-form-item.ts +292 -0
- package/components/form-item/src/form-item.ts +81 -0
- package/components/form-item/src/form-item.vue +229 -0
- package/components/fusions-ui/src/fusions-ui.vue +8 -0
- package/components/grid/index.ts +1 -0
- package/components/grid/src/composables/index.ts +1 -0
- package/components/grid/src/composables/use-grid.ts +67 -0
- package/components/grid/src/grid.ts +54 -0
- package/components/grid/src/grid.vue +69 -0
- package/components/grid-item/index.ts +1 -0
- package/components/grid-item/src/composables/grid-item-custom.ts +16 -0
- package/components/grid-item/src/composables/index.ts +2 -0
- package/components/grid-item/src/composables/use-grid-item.ts +55 -0
- package/components/grid-item/src/grid-item.ts +15 -0
- package/components/grid-item/src/grid-item.vue +102 -0
- package/components/icon/index.ts +1 -0
- package/components/icon/src/composables/icon-custom.ts +41 -0
- package/components/icon/src/composables/index.ts +2 -0
- package/components/icon/src/composables/use-icon.ts +14 -0
- package/components/{fu-icon/icon.css → icon/src/fuicon.css} +584 -584
- package/components/icon/src/fuicon.ts +1023 -0
- package/components/icon/src/icon.ts +84 -0
- package/components/icon/src/icon.vue +92 -0
- package/components/image/index.ts +1 -0
- package/components/image/src/composables/image-custom.ts +36 -0
- package/components/image/src/composables/index.ts +2 -0
- package/components/image/src/composables/use-image.ts +135 -0
- package/components/image/src/image.ts +185 -0
- package/components/image/src/image.vue +152 -0
- package/components/index-anchor/index.ts +1 -0
- package/components/index-anchor/src/composables/index.ts +1 -0
- package/components/index-anchor/src/composables/use-index-anchor.ts +44 -0
- package/components/index-anchor/src/index-anchor.ts +45 -0
- package/components/index-anchor/src/index-anchor.vue +60 -0
- package/components/index-item/index.ts +1 -0
- package/components/index-item/src/composables/index.ts +1 -0
- package/components/index-item/src/composables/use-index-item.ts +75 -0
- package/components/index-item/src/index-item.ts +13 -0
- package/components/index-item/src/index-item.vue +32 -0
- package/components/index-list/index.ts +1 -0
- package/components/index-list/src/composables/index.ts +1 -0
- package/components/index-list/src/composables/use-index-list.ts +297 -0
- package/components/index-list/src/index-list.ts +52 -0
- package/components/index-list/src/index-list.vue +178 -0
- package/components/index.ts +62 -0
- package/components/input/index.ts +1 -0
- package/components/input/src/composables/index.ts +2 -0
- package/components/input/src/composables/input-custom.ts +69 -0
- package/components/input/src/composables/use-input.ts +117 -0
- package/components/input/src/input.ts +360 -0
- package/components/input/src/input.vue +241 -0
- package/components/keyboard/index.ts +1 -0
- package/components/keyboard/src/composables/index.ts +3 -0
- package/components/keyboard/src/composables/use-keyboard-car.ts +99 -0
- package/components/keyboard/src/composables/use-keyboard-number.ts +81 -0
- package/components/keyboard/src/composables/use-keyboard.ts +61 -0
- package/components/keyboard/src/keyboard-car.ts +53 -0
- package/components/{fu-keyboard → keyboard/src}/keyboard-car.vue +37 -199
- package/components/keyboard/src/keyboard-number.ts +44 -0
- package/components/keyboard/src/keyboard-number.vue +108 -0
- package/components/keyboard/src/keyboard.ts +174 -0
- package/components/{fu-keyboard/fu-keyboard.vue → keyboard/src/keyboard.vue} +38 -63
- package/components/line/index.ts +1 -0
- package/components/line/src/composables/index.ts +1 -0
- package/components/line/src/composables/line-custom.ts +30 -0
- package/components/line/src/line.ts +82 -0
- package/components/line/src/line.vue +44 -0
- package/components/link/index.ts +1 -0
- package/components/link/src/composables/index.ts +2 -0
- package/components/link/src/composables/link-custom.ts +19 -0
- package/components/link/src/composables/use-link.ts +33 -0
- package/components/link/src/link.ts +61 -0
- package/components/link/src/link.vue +62 -0
- package/components/loading/index.ts +1 -0
- package/{libs/function/colorGradient.js → components/loading/src/composables/colorGradient.ts} +4 -4
- package/components/loading/src/composables/index.ts +2 -0
- package/components/loading/src/composables/loading-custom.ts +21 -0
- package/components/loading/src/composables/use-loading.ts +100 -0
- package/components/loading/src/loading.ts +77 -0
- package/components/{fu-loading/fu-loading.vue → loading/src/loading.vue} +23 -119
- package/components/loading-more/index.ts +1 -0
- package/components/loading-more/src/loading-more.ts +75 -0
- package/components/{fu-loading-more/fu-loading-more.vue → loading-more/src/loading-more.vue} +18 -19
- package/components/modal/index.ts +1 -0
- package/components/modal/src/composables/index.ts +2 -0
- package/components/modal/src/composables/modal-custom.ts +17 -0
- package/components/modal/src/composables/use-modal.ts +56 -0
- package/components/modal/src/modal.ts +152 -0
- package/components/{fu-modal/fu-modal.vue → modal/src/modal.vue} +41 -69
- package/components/navbar/index.ts +1 -0
- package/components/navbar/src/composables/index.ts +2 -0
- package/components/navbar/src/composables/navbar-custom.ts +62 -0
- package/components/navbar/src/composables/use-navbar.ts +42 -0
- package/components/navbar/src/navbar.ts +151 -0
- package/components/navbar/src/navbar.vue +249 -0
- package/components/notice-bar/index.ts +3 -0
- package/components/notice-bar/src/composables/index.ts +5 -0
- package/components/notice-bar/src/composables/notice-column-custom.ts +43 -0
- package/components/notice-bar/src/composables/notice-row-custom.ts +26 -0
- package/components/notice-bar/src/composables/use-notice-bar.ts +34 -0
- package/components/notice-bar/src/composables/use-notice-column.ts +31 -0
- package/components/notice-bar/src/composables/use-notice-row.ts +88 -0
- package/components/notice-bar/src/notice-bar.ts +197 -0
- package/components/{fu-notice-bar/fu-notice-bar.vue → notice-bar/src/notice-bar.vue} +28 -41
- package/components/notice-bar/src/notice-column.ts +172 -0
- package/components/notice-bar/src/notice-column.vue +129 -0
- package/components/notice-bar/src/notice-row.ts +155 -0
- package/components/notice-bar/src/notice-row.vue +135 -0
- package/components/number-box/index.ts +1 -0
- package/components/number-box/src/composables/index.ts +2 -0
- package/components/number-box/src/composables/number-box-custom.ts +16 -0
- package/components/number-box/src/composables/use-number-box.ts +84 -0
- package/components/number-box/src/number-box.ts +98 -0
- package/components/number-box/src/number-box.vue +123 -0
- package/components/parse/index.ts +1 -0
- package/components/parse/src/app-plus/html/js/handler.js +254 -0
- package/components/parse/src/app-plus/html/js/uni.webview.min.js +188 -0
- package/components/parse/src/app-plus/html/local.html +32 -0
- package/components/parse/src/composables/index.ts +1 -0
- package/components/parse/src/composables/use-parse.ts +428 -0
- package/components/parse/src/node/node.vue +635 -0
- package/components/parse/src/parse.ts +156 -0
- package/components/parse/src/parse.vue +131 -0
- package/components/parse/src/parser.ts +1402 -0
- package/components/picker/index.ts +1 -0
- package/components/picker/src/composables/index.ts +2 -0
- package/components/picker/src/composables/picker-custom.ts +40 -0
- package/components/picker/src/composables/use-picker.ts +179 -0
- package/components/picker/src/picker.ts +172 -0
- package/components/picker/src/picker.vue +197 -0
- package/components/popup/index.ts +1 -0
- package/components/popup/src/composables/index.ts +1 -0
- package/components/popup/src/composables/use-popup.ts +346 -0
- package/components/popup/src/keypress.ts +55 -0
- package/components/popup/src/popup.ts +101 -0
- package/components/popup/src/popup.vue +204 -0
- package/components/progress/index.ts +1 -0
- package/components/progress/src/composables/index.ts +2 -0
- package/components/progress/src/composables/progress-custom.ts +24 -0
- package/components/progress/src/composables/use-progress.ts +159 -0
- package/components/progress/src/progress.ts +84 -0
- package/components/progress/src/progress.vue +150 -0
- package/components/rate/index.ts +1 -0
- package/components/rate/src/composables/index.ts +1 -0
- package/components/rate/src/composables/use-rate.ts +196 -0
- package/components/rate/src/rate.ts +114 -0
- package/components/rate/src/rate.vue +113 -0
- package/components/read-more/index.ts +1 -0
- package/components/read-more/src/composables/index.ts +2 -0
- package/components/read-more/src/composables/read-more-custom.ts +46 -0
- package/components/read-more/src/composables/use-read-more.ts +72 -0
- package/components/read-more/src/read-more.ts +102 -0
- package/components/read-more/src/read-more.vue +104 -0
- package/components/safe-bottom/index.ts +1 -0
- package/components/safe-bottom/src/composables/index.ts +2 -0
- package/components/safe-bottom/src/composables/safe-bottom-custom.ts +18 -0
- package/components/safe-bottom/src/composables/use-safe-bottom.ts +17 -0
- package/components/safe-bottom/src/safe-bottom.ts +8 -0
- package/components/safe-bottom/src/safe-bottom.vue +43 -0
- package/components/scroll-list/index.ts +1 -0
- package/components/scroll-list/src/composables/index.ts +2 -0
- package/components/scroll-list/src/composables/scroll-list-custom.ts +41 -0
- package/components/scroll-list/src/composables/use-scroll-list.ts +126 -0
- package/components/scroll-list/src/scroll-list.ts +57 -0
- package/components/scroll-list/src/scroll-list.vue +143 -0
- package/components/{fu-scroll-list/scrollWxs.wxs → scroll-list/src/scroll-wxs.wxs} +2 -2
- package/components/search/index.ts +1 -0
- package/components/search/src/composables/index.ts +2 -0
- package/components/search/src/composables/search-custom.ts +25 -0
- package/components/search/src/composables/use-search.ts +106 -0
- package/components/search/src/search.ts +186 -0
- package/components/{fu-search/fu-search.vue → search/src/search.vue} +42 -154
- package/components/section/index.ts +1 -0
- package/components/section/src/composables/index.ts +1 -0
- package/components/section/src/composables/use-section.ts +19 -0
- package/components/section/src/section.ts +83 -0
- package/components/{fu-section/fu-section.vue → section/src/section.vue} +36 -35
- package/components/sign-board/index.ts +1 -0
- package/components/sign-board/src/composables/index.ts +1 -0
- package/components/sign-board/src/composables/use-sign-board.ts +552 -0
- package/components/sign-board/src/sign-board.ts +48 -0
- package/components/sign-board/src/sign-board.vue +191 -0
- package/components/skeleton/index.ts +1 -0
- package/components/skeleton/src/composables/index.ts +2 -0
- package/components/skeleton/src/composables/skeleton-custom.ts +23 -0
- package/components/skeleton/src/composables/use-skeleton.ts +102 -0
- package/components/skeleton/src/skeleton.ts +37 -0
- package/components/skeleton/src/skeleton.vue +147 -0
- package/components/status-bar/src/composables/index.ts +1 -0
- package/components/status-bar/src/composables/use-status-bar.ts +29 -0
- package/components/status-bar/src/status-bar.vue +21 -0
- package/components/steps/index.ts +1 -0
- package/components/steps/src/composables/index.ts +1 -0
- package/components/steps/src/composables/use-steps.ts +27 -0
- package/components/steps/src/steps.ts +65 -0
- package/components/steps/src/steps.vue +46 -0
- package/components/steps-item/index.ts +1 -0
- package/components/steps-item/src/composables/index.ts +2 -0
- package/components/steps-item/src/composables/steps-item-custom.ts +81 -0
- package/components/steps-item/src/composables/use-steps-item.ts +87 -0
- package/components/steps-item/src/steps-item.ts +38 -0
- package/components/steps-item/src/steps-item.vue +224 -0
- package/components/sticky/index.ts +1 -0
- package/components/sticky/src/composables/index.ts +2 -0
- package/components/sticky/src/composables/sticky-custom.ts +57 -0
- package/components/sticky/src/composables/use-sticky.ts +152 -0
- package/components/sticky/src/sticky.ts +62 -0
- package/components/sticky/src/sticky.vue +65 -0
- package/components/subsection/index.ts +1 -0
- package/components/subsection/src/composables/index.ts +2 -0
- package/components/subsection/src/composables/subsection-custom.ts +71 -0
- package/components/subsection/src/composables/use-subsection.ts +85 -0
- package/components/subsection/src/subsection.ts +107 -0
- package/components/subsection/src/subsection.vue +165 -0
- package/components/swipe-action/src/composables/index.ts +1 -0
- package/components/swipe-action/src/composables/use-swipe-action.ts +58 -0
- package/components/swipe-action/src/swipe-action.vue +81 -0
- package/components/swipe-action-item/index.ts +1 -0
- package/components/{fu-swipe-action-item/mpwxs.js → swipe-action-item/src/mpwxs.ts} +22 -27
- package/components/swipe-action-item/src/swipe-action-item.ts +68 -0
- package/components/{fu-swipe-action-item/fu-swipe-action-item.vue → swipe-action-item/src/swipe-action-item.vue} +24 -17
- package/components/{fu-swipe-action-item → swipe-action-item/src}/wx.wxs +2 -2
- package/components/swiper/index.ts +1 -0
- package/components/swiper/src/composables/index.ts +2 -0
- package/components/swiper/src/composables/swiper-custom.ts +40 -0
- package/components/swiper/src/composables/use-swiper.ts +75 -0
- package/components/swiper/src/swiper.ts +189 -0
- package/components/{fu-swiper/fu-swiper.vue → swiper/src/swiper.vue} +49 -118
- package/components/switch/index.ts +1 -0
- package/components/switch/src/composables/index.ts +2 -0
- package/components/switch/src/composables/switch-custom.ts +32 -0
- package/components/switch/src/composables/use-switch.ts +38 -0
- package/components/switch/src/switch.ts +115 -0
- package/components/{fu-switch/fu-switch.vue → switch/src/switch.vue} +25 -73
- package/components/tabs/index.ts +1 -0
- package/components/tabs/src/composables/index.ts +2 -0
- package/components/tabs/src/composables/tabs-custom.ts +43 -0
- package/components/tabs/src/composables/use-tabs.ts +210 -0
- package/components/tabs/src/tabs.ts +123 -0
- package/components/tabs/src/tabs.vue +153 -0
- package/components/tag/index.ts +1 -0
- package/components/tag/src/composables/index.ts +2 -0
- package/components/tag/src/composables/tag-custom.ts +61 -0
- package/components/tag/src/composables/use-tag.ts +23 -0
- package/components/tag/src/tag.ts +159 -0
- package/components/{fu-tag/fu-tag.vue → tag/src/tag.vue} +53 -93
- package/components/text/index.ts +1 -0
- package/components/text/src/composables/index.ts +2 -0
- package/components/text/src/composables/text-custom.ts +120 -0
- package/components/text/src/composables/use-text.ts +83 -0
- package/components/text/src/text.ts +261 -0
- package/components/text/src/text.vue +186 -0
- package/components/textarea/index.ts +1 -0
- package/components/textarea/src/composables/index.ts +2 -0
- package/components/textarea/src/composables/textarea-custom.ts +50 -0
- package/components/textarea/src/composables/use-textarea.ts +88 -0
- package/components/textarea/src/textarea.ts +250 -0
- package/components/textarea/src/textarea.vue +162 -0
- package/components/{fu-timeaxis/fu-timeaxis.vue → timeaxis/src/timeaxis.vue} +3 -9
- package/components/timeaxis-item/index.ts +1 -0
- package/components/timeaxis-item/src/timeaxis-item.ts +20 -0
- package/components/timeaxis-item/src/timeaxis-item.vue +50 -0
- package/components/transition/index.ts +1 -0
- package/components/transition/src/composables/createAnimation.ts +171 -0
- package/components/transition/src/composables/index.ts +2 -0
- package/components/transition/src/composables/transform-custom.ts +18 -0
- package/components/transition/src/composables/use-transition.ts +251 -0
- package/components/transition/src/transition.ts +64 -0
- package/components/transition/src/transition.vue +70 -0
- package/components/upload/index.ts +1 -0
- package/components/upload/src/composables/index.ts +5 -0
- package/components/upload/src/composables/upload-file-custom.ts +68 -0
- package/components/upload/src/composables/upload-image-custom.ts +76 -0
- package/components/upload/src/composables/use-upload-file.ts +27 -0
- package/components/upload/src/composables/use-upload-image.ts +38 -0
- package/components/upload/src/composables/use-upload.ts +388 -0
- package/components/upload/src/upload-file.ts +84 -0
- package/components/upload/src/upload-file.vue +193 -0
- package/components/upload/src/upload-image.ts +90 -0
- package/components/upload/src/upload-image.vue +158 -0
- package/components/upload/src/upload.ts +196 -0
- package/components/upload/src/upload.vue +151 -0
- package/components/{fu-upload/utils.js → upload/src/utils.ts} +12 -12
- package/components/vtabs/index.ts +1 -0
- package/components/vtabs/src/composables/index.ts +2 -0
- package/components/vtabs/src/composables/use-vtabs.ts +276 -0
- package/components/vtabs/src/composables/vtabs-custom.ts +54 -0
- package/components/vtabs/src/vtabs.ts +130 -0
- package/components/vtabs/src/vtabs.vue +189 -0
- package/components/vtabs-item/index.ts +1 -0
- package/components/vtabs-item/src/composables/index.ts +1 -0
- package/components/vtabs-item/src/composables/use-vtabs-item.ts +60 -0
- package/components/vtabs-item/src/vtabs-item.ts +10 -0
- package/components/vtabs-item/src/vtabs-item.vue +20 -0
- package/components/waterfall/index.ts +1 -0
- package/components/waterfall/src/composables/index.ts +2 -0
- package/components/waterfall/src/composables/use-waterfall.ts +139 -0
- package/components/waterfall/src/composables/waterfall-custom.ts +18 -0
- package/components/waterfall/src/waterfall.ts +114 -0
- package/components/waterfall/src/waterfall.vue +104 -0
- package/{libs/config/config.js → config/config.ts} +13 -7
- package/constants/images.ts +18 -0
- package/constants/index.ts +6 -0
- package/constants/open-types.ts +33 -0
- package/constants/props.ts +18 -0
- package/constants/shapes.ts +6 -0
- package/constants/types.ts +10 -0
- package/constants/z-index.ts +27 -0
- package/global.d.ts +103 -0
- package/hooks/index.ts +25 -0
- package/index.scss +3 -5
- package/index.ts +56 -0
- package/package.json +1 -1
- package/{libs/route/min.route.config.js → route/min.route.config.ts} +62 -23
- package/route/route.config.ts +93 -0
- package/style/color.scss +26 -0
- package/{libs/style → style}/common.scss +1 -14
- package/{libs/function/applyEven.js → utils/applyEven.ts} +21 -12
- package/utils/check.ts +276 -0
- package/{libs/function/chooseUploadFile.js → utils/chooseUploadFile.ts} +22 -26
- package/utils/common.ts +609 -0
- package/{libs/function/digit.js → utils/digit.ts} +63 -33
- package/{components/fu-swipe-action-item/isPC.js → utils/isPC.ts} +1 -1
- package/utils/toast.ts +42 -0
- package/components/fu-avatar/fu-avatar.vue +0 -157
- package/components/fu-avatar/props.js +0 -117
- package/components/fu-avatar-group/props.js +0 -74
- package/components/fu-badge/props.js +0 -112
- package/components/fu-banner-arc/fu-banner-arc.vue +0 -58
- package/components/fu-banner-arc/props.js +0 -35
- package/components/fu-button/props.js +0 -228
- package/components/fu-cell/props.js +0 -108
- package/components/fu-cell-group/props.js +0 -19
- package/components/fu-checkbox/fu-checkbox.vue +0 -469
- package/components/fu-checkbox/props.js +0 -126
- package/components/fu-code-input/fu-code-input.vue +0 -269
- package/components/fu-code-input/props.js +0 -136
- package/components/fu-code-verify/fu-code-verify.vue +0 -221
- package/components/fu-code-verify/props.js +0 -136
- package/components/fu-collapse/fu-collapse.vue +0 -143
- package/components/fu-collapse/props.js +0 -29
- package/components/fu-collapse-item/props.js +0 -101
- package/components/fu-countdown/fu-countdown.vue +0 -164
- package/components/fu-countdown/props.js +0 -35
- package/components/fu-datetime-picker/fu-datetime-picker.vue +0 -375
- package/components/fu-datetime-picker/props.js +0 -194
- package/components/fu-form/fu-form.vue +0 -284
- package/components/fu-form/props.js +0 -74
- package/components/fu-form-item/fu-form-item.vue +0 -535
- package/components/fu-form-item/props.js +0 -66
- package/components/fu-grid/fu-grid.vue +0 -113
- package/components/fu-grid/props.js +0 -44
- package/components/fu-grid-item/fu-grid-item.vue +0 -136
- package/components/fu-grid-item/props.js +0 -27
- package/components/fu-icon/fu-icon.vue +0 -107
- package/components/fu-icon/icon.js +0 -1031
- package/components/fu-icon/props.js +0 -55
- package/components/fu-image/fu-image.vue +0 -268
- package/components/fu-image/props.js +0 -145
- package/components/fu-index-anchor/fu-index-anchor.vue +0 -91
- package/components/fu-index-anchor/props.js +0 -43
- package/components/fu-index-item/fu-index-item.vue +0 -79
- package/components/fu-index-list/fu-index-list.vue +0 -426
- package/components/fu-index-list/props.js +0 -42
- package/components/fu-input/fu-input.vue +0 -393
- package/components/fu-input/props.js +0 -291
- package/components/fu-keyboard/keyboard-number.vue +0 -195
- package/components/fu-keyboard/props.js +0 -138
- package/components/fu-line/fu-line.vue +0 -64
- package/components/fu-line/props.js +0 -58
- package/components/fu-link/fu-link.vue +0 -91
- package/components/fu-link/props.js +0 -49
- package/components/fu-loading/props.js +0 -60
- package/components/fu-loading-more/props.js +0 -59
- package/components/fu-modal/props.js +0 -128
- package/components/fu-navbar/fu-navbar.vue +0 -271
- package/components/fu-navbar/props.js +0 -72
- package/components/fu-navbar/status-bar.vue +0 -27
- package/components/fu-notice-bar/notice-column.vue +0 -313
- package/components/fu-notice-bar/notice-row.vue +0 -363
- package/components/fu-notice-bar/props.js +0 -173
- package/components/fu-number-box/fu-number-box.vue +0 -210
- package/components/fu-number-box/props.js +0 -79
- package/components/fu-parse/fu-parse.vue +0 -508
- package/components/fu-parse/node/node.vue +0 -576
- package/components/fu-parse/parser.js +0 -1335
- package/components/fu-picker/fu-picker.vue +0 -347
- package/components/fu-picker/props.js +0 -150
- package/components/fu-popup/fu-popup.vue +0 -475
- package/components/fu-popup/keypress.js +0 -45
- package/components/fu-popup/props.js +0 -83
- package/components/fu-progress/fu-progress.vue +0 -292
- package/components/fu-progress/props.js +0 -76
- package/components/fu-rate/fu-rate.vue +0 -301
- package/components/fu-rate/props.js +0 -103
- package/components/fu-read-more/fu-read-more.vue +0 -191
- package/components/fu-read-more/props.js +0 -72
- package/components/fu-ribbon/fu-ribbon.vue +0 -106
- package/components/fu-ribbon/props.js +0 -35
- package/components/fu-safe-area/fu-safe-area.vue +0 -61
- package/components/fu-scroll-list/fu-scroll-list.vue +0 -196
- package/components/fu-scroll-list/nvue.js +0 -28
- package/components/fu-scroll-list/props.js +0 -43
- package/components/fu-search/props.js +0 -149
- package/components/fu-section/props.js +0 -59
- package/components/fu-sign-board/fu-sign-board.vue +0 -728
- package/components/fu-sign-board/props.js +0 -34
- package/components/fu-skeleton/fu-skeleton.vue +0 -238
- package/components/fu-skeleton/props.js +0 -35
- package/components/fu-steps/fu-steps.vue +0 -81
- package/components/fu-steps/props.js +0 -55
- package/components/fu-steps-item/fu-steps-item.vue +0 -274
- package/components/fu-steps-item/props.js +0 -34
- package/components/fu-sticky/fu-sticky.vue +0 -232
- package/components/fu-sticky/props.js +0 -54
- package/components/fu-subsection/fu-subsection.vue +0 -288
- package/components/fu-subsection/props.js +0 -88
- package/components/fu-swipe-action/fu-swipe-action.vue +0 -64
- package/components/fu-swipe-action-item/props.js +0 -54
- package/components/fu-swiper/props.js +0 -163
- package/components/fu-switch/props.js +0 -102
- package/components/fu-tabs/fu-tabs.vue +0 -361
- package/components/fu-tabs/props.js +0 -109
- package/components/fu-tag/props.js +0 -135
- package/components/fu-text/button.js +0 -13
- package/components/fu-text/fu-text.vue +0 -254
- package/components/fu-text/openType.js +0 -47
- package/components/fu-text/props.js +0 -173
- package/components/fu-text/value.js +0 -88
- package/components/fu-textarea/fu-textarea.vue +0 -288
- package/components/fu-textarea/props.js +0 -206
- package/components/fu-timeaxis-item/fu-timeaxis-item.vue +0 -68
- package/components/fu-transition/createAnimation.js +0 -131
- package/components/fu-transition/fu-transition.vue +0 -292
- package/components/fu-transition/props.js +0 -21
- package/components/fu-upload/fu-upload.vue +0 -563
- package/components/fu-upload/props.js +0 -171
- package/components/fu-upload/upload-file.vue +0 -332
- package/components/fu-upload/upload-image.vue +0 -304
- package/components/fu-vtabs/fu-vtabs.vue +0 -443
- package/components/fu-vtabs/props.js +0 -114
- package/components/fu-vtabs-item/fu-vtabs-item.vue +0 -71
- package/components/fu-waterfall/fu-waterfall.vue +0 -238
- package/components/fu-waterfall/props.js +0 -85
- package/index.js +0 -71
- package/libs/function/check.js +0 -215
- package/libs/function/common.js +0 -527
- package/libs/function/message.js +0 -47
- package/libs/mixin/button.js +0 -85
- package/libs/mixin/mixin.js +0 -94
- package/libs/mixin/mpMixin.js +0 -8
- package/libs/mixin/mpShare.js +0 -15
- package/libs/route/route.config.js +0 -66
- package/libs/style/color.scss +0 -24
- /package/components/{fu-icon/icon.ttf → icon/src/fuicon.ttf} +0 -0
- /package/components/{fu-swipe-action-item → swipe-action-item/src}/bindingx.js +0 -0
- /package/components/{fu-swipe-action-item → swipe-action-item/src}/mpalipay.js +0 -0
- /package/components/{fu-swipe-action-item → swipe-action-item/src}/mpother.js +0 -0
- /package/components/{fu-swipe-action-item → swipe-action-item/src}/render.js +0 -0
- /package/{libs/style → style}/components.scss +0 -0
- /package/{libs/style → style}/style.h5.scss +0 -0
- /package/{libs/style → style}/style.mp.scss +0 -0
- /package/{libs/function → utils}/dayjs.js +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
props: {
|
|
3
|
-
/**
|
|
4
|
-
* @description 标题
|
|
5
|
-
*/
|
|
6
|
-
title: {
|
|
7
|
-
type: [String, Number],
|
|
8
|
-
default: ''
|
|
9
|
-
},
|
|
10
|
-
/**
|
|
11
|
-
* @description 描述文本
|
|
12
|
-
*/
|
|
13
|
-
desc: {
|
|
14
|
-
type: [String, Number],
|
|
15
|
-
default: ''
|
|
16
|
-
},
|
|
17
|
-
/**
|
|
18
|
-
* @description 图标大小
|
|
19
|
-
* @default 18
|
|
20
|
-
*/
|
|
21
|
-
iconSize: {
|
|
22
|
-
type: [String, Number],
|
|
23
|
-
default: 18
|
|
24
|
-
},
|
|
25
|
-
/**
|
|
26
|
-
* @description 当前步骤是否处于失败状态
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
29
|
-
error: {
|
|
30
|
-
type: Boolean,
|
|
31
|
-
default: false
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view :id="elId" class="fu-sticky" :class="[customClass]" :style="[stickyStyle]">
|
|
3
|
-
<view :style="[stickyContent]">
|
|
4
|
-
<slot />
|
|
5
|
-
</view>
|
|
6
|
-
</view>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script>
|
|
10
|
-
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
11
|
-
import mixin from '../../libs/mixin/mixin.js'
|
|
12
|
-
import props from './props.js';
|
|
13
|
-
/**
|
|
14
|
-
* Sticky 吸顶
|
|
15
|
-
* @description 此组件与CSS中position: sticky属性实现的效果一致,当组件达到预设的到顶部距离时, 就会固定在指定位置,组件位置大于预设的顶部距离时,会重新按照正常的布局排列。
|
|
16
|
-
* @property {String,Number} offsetTop 吸顶时与顶部的距离,单位px(默认 0 )
|
|
17
|
-
* @property {String,Number} customNavHeight 自定义导航栏的高度 (h5 默认44 其他默认 0 )
|
|
18
|
-
* @property {Boolean} disabled = [true|false] 是否禁用吸顶功能 (默认 false )
|
|
19
|
-
* @property {String} bgColor 背景颜色
|
|
20
|
-
* @property {String,Number} zIndex 吸顶时的z-index值(默认 99)
|
|
21
|
-
* @property {String,Number} index 自定义标识,用于区分是哪一个组件(默认 0)
|
|
22
|
-
* @property {String} customClass 自定义外部样式类
|
|
23
|
-
* @property {Object,String} customStyle 自定义外部的样式
|
|
24
|
-
*
|
|
25
|
-
* @example <fu-sticky offsetTop="200"><view>此处吸顶</view></fu-sticky>
|
|
26
|
-
*/
|
|
27
|
-
export default {
|
|
28
|
-
name: 'FuSticky',
|
|
29
|
-
mixins: [mpMixin, mixin, props],
|
|
30
|
-
data() {
|
|
31
|
-
const elId = this.$fu.uuid();
|
|
32
|
-
return {
|
|
33
|
-
cssSticky: false, // 是否使用css的sticky实现
|
|
34
|
-
stickyTop: 0, // 吸顶的top值,因为可能受自定义导航栏影响,最终的吸顶值非offsetTop值
|
|
35
|
-
elId: elId,
|
|
36
|
-
left: 0, // js模式时,吸顶的内容因为处于postition: fixed模式,为了和原来保持一致的样式,需要记录并重新设置它的left,height,width属性
|
|
37
|
-
width: 'auto',
|
|
38
|
-
height: 'auto',
|
|
39
|
-
fixed: false, // js模式时,是否处于吸顶模式
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
computed: {
|
|
43
|
-
stickyStyle() {
|
|
44
|
-
const style = {
|
|
45
|
-
backgroundColor: this.bgColor,
|
|
46
|
-
boxShadow: `0 -1px ${this.bgColor || '#ffffff'}`
|
|
47
|
-
};
|
|
48
|
-
if(!this.disabled) {
|
|
49
|
-
if (this.cssSticky) {
|
|
50
|
-
style.position = 'sticky';
|
|
51
|
-
style.zIndex = this.fuZindex;
|
|
52
|
-
style.top = this.$fu.addUnit(this.stickyTop);
|
|
53
|
-
} else {
|
|
54
|
-
style.height = this.fixed ? this.height + 'px' : 'auto';
|
|
55
|
-
}
|
|
56
|
-
} else {
|
|
57
|
-
// 无需吸顶时,设置会默认的relative(nvue)和非nvue的static静态模式即可
|
|
58
|
-
// #ifdef APP-NVUE
|
|
59
|
-
style.position = 'relative';
|
|
60
|
-
// #endif
|
|
61
|
-
// #ifndef APP-NVUE
|
|
62
|
-
style.position = 'static';
|
|
63
|
-
// #endif
|
|
64
|
-
}
|
|
65
|
-
return this.$fu.deepMerge(this.$fu.addStyle(this.customStyle), style)
|
|
66
|
-
},
|
|
67
|
-
// 吸顶内容的样式
|
|
68
|
-
stickyContent() {
|
|
69
|
-
const style = {}
|
|
70
|
-
if (!this.cssSticky) {
|
|
71
|
-
const { fixed, stickyTop, left, width, fuZindex } = this;
|
|
72
|
-
style.position = fixed ? 'fixed' : 'static';
|
|
73
|
-
style.top = stickyTop + 'px';
|
|
74
|
-
style.left = left + 'px';
|
|
75
|
-
style.width = width == 'auto' ? 'auto' : this.width + 'px';
|
|
76
|
-
style.zIndex = fuZindex;
|
|
77
|
-
}
|
|
78
|
-
return style
|
|
79
|
-
},
|
|
80
|
-
fuZindex() {
|
|
81
|
-
return this.zIndex ? this.zIndex : 998
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
mounted() {
|
|
85
|
-
this.init()
|
|
86
|
-
},
|
|
87
|
-
methods: {
|
|
88
|
-
init() {
|
|
89
|
-
this.getStickyTop()
|
|
90
|
-
// 判断使用的模式
|
|
91
|
-
this.checkSupportCssSticky()
|
|
92
|
-
// 如果不支持css sticky,则使用js方案,此方案性能比不上css方案
|
|
93
|
-
if (!this.cssSticky) {
|
|
94
|
-
!this.disabled && this.initObserveContent()
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
initObserveContent() {
|
|
99
|
-
// 获取吸顶内容的高度,用于在js吸顶模式时,给父元素一个填充高度,防止"塌陷"
|
|
100
|
-
this.getElementData('#' + this.elId, res => {
|
|
101
|
-
this.height = res.height;
|
|
102
|
-
this.left = res.left;
|
|
103
|
-
this.width = res.width;
|
|
104
|
-
this.$nextTick(() => {
|
|
105
|
-
this.observeContent()
|
|
106
|
-
})
|
|
107
|
-
})
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
// 获取所有标签节点
|
|
111
|
-
getElementData(el, callback){
|
|
112
|
-
uni.createSelectorQuery().in(this).selectAll(el).boundingClientRect().exec((data) => {
|
|
113
|
-
// #ifndef MP-ALIPAY
|
|
114
|
-
callback(data[0]);
|
|
115
|
-
// #endif
|
|
116
|
-
// #ifdef MP-ALIPAY
|
|
117
|
-
callback(data[0][0]);
|
|
118
|
-
// #endif
|
|
119
|
-
});
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
observeContent() {
|
|
123
|
-
// 先断掉之前的观察
|
|
124
|
-
this.disconnectObserver('contentObserver')
|
|
125
|
-
const contentObserver = uni.createIntersectionObserver({
|
|
126
|
-
// 检测的区间范围
|
|
127
|
-
thresholds: [0.95, 0.98, 1]
|
|
128
|
-
})
|
|
129
|
-
// 到屏幕顶部的高度时触发
|
|
130
|
-
contentObserver.relativeToViewport({
|
|
131
|
-
top: -this.stickyTop
|
|
132
|
-
})
|
|
133
|
-
// 绑定观察的元素
|
|
134
|
-
contentObserver.observe(`#${this.elId}`, res => {
|
|
135
|
-
this.setFixed(res.boundingClientRect.top)
|
|
136
|
-
})
|
|
137
|
-
this.contentObserver = contentObserver;
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
setFixed(top) {
|
|
141
|
-
// 判断是否出于吸顶条件范围
|
|
142
|
-
const fixed = top <= this.stickyTop;
|
|
143
|
-
this.fixed = fixed;
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
disconnectObserver(observerName) {
|
|
147
|
-
// 断掉观察,释放资源
|
|
148
|
-
const observer = this[observerName]
|
|
149
|
-
observer && observer.disconnect()
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
getStickyTop() {
|
|
153
|
-
this.stickyTop = this.$fu.getPx(this.offsetTop) + this.$fu.getPx(this.customNavHeight);
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
async checkSupportCssSticky() {
|
|
157
|
-
// #ifdef H5
|
|
158
|
-
// H5,一般都是现代浏览器,是支持css sticky的,这里使用创建元素嗅探的形式判断
|
|
159
|
-
if (this.checkCssStickyForH5()) {
|
|
160
|
-
this.cssSticky = true;
|
|
161
|
-
}
|
|
162
|
-
// #endif
|
|
163
|
-
|
|
164
|
-
// 如果安卓版本高于8.0,依然认为是支持css sticky的(因为安卓7在某些机型,可能不支持sticky)
|
|
165
|
-
if (this.$fu.os() === 'android' && Number(this.$fu.sys().system) > 8) {
|
|
166
|
-
this.cssSticky = true;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// APP-Vue和微信平台,通过computedStyle判断是否支持css sticky
|
|
170
|
-
// #ifdef APP-VUE || MP-WEIXIN
|
|
171
|
-
this.cssSticky = await this.checkComputedStyle();
|
|
172
|
-
// #endif
|
|
173
|
-
|
|
174
|
-
// ios上,从ios6开始,都是支持css sticky的
|
|
175
|
-
if (this.$fu.os() === 'ios') {
|
|
176
|
-
this.cssSticky = true;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// nvue,是支持css sticky的
|
|
180
|
-
// #ifdef APP-NVUE
|
|
181
|
-
this.cssSticky = true;
|
|
182
|
-
// #endif
|
|
183
|
-
},
|
|
184
|
-
|
|
185
|
-
// 在APP和微信小程序上,通过uni.createSelectorQuery可以判断是否支持css sticky
|
|
186
|
-
checkComputedStyle() {
|
|
187
|
-
// 方法内进行判断,避免在其他平台生成无用代码
|
|
188
|
-
// #ifdef APP-VUE || MP-WEIXIN
|
|
189
|
-
return new Promise(resolve => {
|
|
190
|
-
uni.createSelectorQuery().in(this).select('.fu-sticky').fields({
|
|
191
|
-
computedStyle: ["position"]
|
|
192
|
-
}).exec(e => {
|
|
193
|
-
resolve('sticky' === e[0].position)
|
|
194
|
-
})
|
|
195
|
-
})
|
|
196
|
-
// #endif
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
// H5通过创建元素的形式嗅探是否支持css sticky
|
|
200
|
-
// 判断浏览器是否支持sticky属性
|
|
201
|
-
checkCssStickyForH5() {
|
|
202
|
-
// 方法内进行判断,避免在其他平台生成无用代码
|
|
203
|
-
// #ifdef H5
|
|
204
|
-
const vendorList = ['', '-webkit-', '-ms-', '-moz-', '-o-'],
|
|
205
|
-
vendorListLength = vendorList.length,
|
|
206
|
-
stickyElement = document.createElement('div')
|
|
207
|
-
for (let i = 0; i < vendorListLength; i++) {
|
|
208
|
-
stickyElement.style.position = vendorList[i] + 'sticky'
|
|
209
|
-
if (stickyElement.style.position !== '') {
|
|
210
|
-
return true
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return false;
|
|
214
|
-
// #endif
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
beforeDestroy() {
|
|
218
|
-
this.disconnectObserver('contentObserver')
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
</script>
|
|
222
|
-
|
|
223
|
-
<style lang="scss" scoped>
|
|
224
|
-
.fu-sticky {
|
|
225
|
-
/* #ifdef APP-VUE || MP-WEIXIN */
|
|
226
|
-
// 此处默认写sticky属性,是为了给微信和APP通过uni.createSelectorQuery查询是否支持css sticky使用
|
|
227
|
-
position: sticky;
|
|
228
|
-
/* #endif */
|
|
229
|
-
// 此处为解决个别机型会出现缝隙
|
|
230
|
-
// box-shadow: 0 -1px #ffffff;
|
|
231
|
-
}
|
|
232
|
-
</style>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
props: {
|
|
3
|
-
/**
|
|
4
|
-
* @description 吸顶容器到顶部某个距离的时候,进行吸顶,在H5平台,NavigationBar为44px
|
|
5
|
-
*/
|
|
6
|
-
offsetTop: {
|
|
7
|
-
type: [String, Number],
|
|
8
|
-
default: 0
|
|
9
|
-
},
|
|
10
|
-
/**
|
|
11
|
-
* @description 自定义导航栏的高度
|
|
12
|
-
*/
|
|
13
|
-
customNavHeight: {
|
|
14
|
-
type: [String, Number],
|
|
15
|
-
// #ifdef H5
|
|
16
|
-
// H5端的导航栏属于“自定义”导航栏的范畴,因为它是非原生的,与普通元素一致
|
|
17
|
-
default: 44,
|
|
18
|
-
// #endif
|
|
19
|
-
// #ifndef H5
|
|
20
|
-
default: 0
|
|
21
|
-
// #endif
|
|
22
|
-
},
|
|
23
|
-
/**
|
|
24
|
-
* @description 是否禁用吸顶功能
|
|
25
|
-
* @default false
|
|
26
|
-
*/
|
|
27
|
-
disabled: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: false
|
|
30
|
-
},
|
|
31
|
-
/**
|
|
32
|
-
* @description 吸顶区域的背景颜色
|
|
33
|
-
*/
|
|
34
|
-
bgColor: {
|
|
35
|
-
type: String,
|
|
36
|
-
default: ''
|
|
37
|
-
},
|
|
38
|
-
/**
|
|
39
|
-
* @description z-index值
|
|
40
|
-
* @default 99
|
|
41
|
-
*/
|
|
42
|
-
zIndex: {
|
|
43
|
-
type: [String, Number],
|
|
44
|
-
default: 99
|
|
45
|
-
},
|
|
46
|
-
/**
|
|
47
|
-
* @description 列表中的索引值
|
|
48
|
-
*/
|
|
49
|
-
index: {
|
|
50
|
-
type: [String, Number],
|
|
51
|
-
default: 0
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view ref="fu-subsection" class="fu-subsection" :class="[`fu-subsection--${mode}`]" :style="[$fu.addStyle(this.customStyle), wrapperStyle]">
|
|
3
|
-
<view
|
|
4
|
-
ref="fu-subsection__bar"
|
|
5
|
-
class="fu-subsection__bar"
|
|
6
|
-
:style="[barStyle]"
|
|
7
|
-
:class="[
|
|
8
|
-
mode === 'button' && 'fu-subsection--button__bar',
|
|
9
|
-
current === 0 && mode === 'subsection' && 'fu-subsection__bar--first',
|
|
10
|
-
current > 0 && current < list.length - 1 && mode === 'subsection' && 'fu-subsection__bar--center',
|
|
11
|
-
current === list.length - 1 && mode === 'subsection' && 'fu-subsection__bar--last'
|
|
12
|
-
]"></view>
|
|
13
|
-
<view
|
|
14
|
-
:ref="`fu-subsection__item--${index}`"
|
|
15
|
-
class="fu-subsection__item"
|
|
16
|
-
:class="[
|
|
17
|
-
`fu-subsection__item--${index}`,
|
|
18
|
-
index < list.length - 1 && 'fu-subsection__item--no-border-right',
|
|
19
|
-
index === 0 && 'fu-subsection__item--first',
|
|
20
|
-
index === list.length - 1 && 'fu-subsection__item--last'
|
|
21
|
-
]" :style="[itemStyle(index)]" v-for="(item, index) in list" :key="index" @tap="handleClick(index)">
|
|
22
|
-
<text class="fu-subsection__item__text" :style="[textStyle(index)]">{{ getText(item) }}</text>
|
|
23
|
-
</view>
|
|
24
|
-
</view>
|
|
25
|
-
</template>
|
|
26
|
-
|
|
27
|
-
<script>
|
|
28
|
-
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
29
|
-
import mixin from '../../libs/mixin/mixin.js'
|
|
30
|
-
import props from "./props.js";
|
|
31
|
-
// #ifdef APP-NVUE
|
|
32
|
-
const dom = uni.requireNativePlugin("dom");
|
|
33
|
-
const animation = uni.requireNativePlugin("animation");
|
|
34
|
-
// #endif
|
|
35
|
-
/**
|
|
36
|
-
* Subsection 分段器
|
|
37
|
-
* @description 此组件分段器一般用于用户从几个选项中选择某一个的场景
|
|
38
|
-
* @property {String,Number} duration 滑块的移动过渡时间,单位ms (默认 300)
|
|
39
|
-
* @property {Array} list 选项的数组
|
|
40
|
-
* @property {String,Number} current 当前激活的选项索引index(默认 0 )
|
|
41
|
-
* @property {String} activeColor 激活时的颜色(默认 '#2979ff' )
|
|
42
|
-
* @property {String} inactiveColor 未激活时的颜色(默认 '#303133' )
|
|
43
|
-
* @property {String} mode = [button|subsection] 模式选择(默认 'button' )
|
|
44
|
-
* @value button 按钮模式
|
|
45
|
-
* @value subsection 分段器模式
|
|
46
|
-
* @property {String,Number} size 字体大小,单位px(默认 12 )
|
|
47
|
-
* @property {Boolean} bold = [true|false] 激活选项的字体是否加粗(默认 true )
|
|
48
|
-
* @property {String} bgColor 组件背景颜色,mode为button时有效(默认 '#efeff0' )
|
|
49
|
-
* @property {String,Object} customStyle 定义需要用到的外部样式
|
|
50
|
-
* @property {String,Object} customItemStyle 自定义选项样式
|
|
51
|
-
* @property {String} keyName 从`list`元素对象中读取的键名(默认 'name' )
|
|
52
|
-
*
|
|
53
|
-
* @event {Function} change 分段器选项发生改变时触发 回调 index:选项的index索引值,从0开始
|
|
54
|
-
* @example <fu-subsection :list="list" :current="current" @change="sectionChange"></fu-subsection>
|
|
55
|
-
*/
|
|
56
|
-
export default {
|
|
57
|
-
name: "fuSubsection",
|
|
58
|
-
emits: ['change'],
|
|
59
|
-
mixins: [mpMixin, mixin, props],
|
|
60
|
-
data() {
|
|
61
|
-
return {
|
|
62
|
-
firstTime: true,
|
|
63
|
-
// 组件尺寸
|
|
64
|
-
itemRect: {
|
|
65
|
-
width: 0,
|
|
66
|
-
height: 0,
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
computed: {
|
|
71
|
-
wrapperStyle() {
|
|
72
|
-
const style = {};
|
|
73
|
-
// button模式时,设置背景色
|
|
74
|
-
if (this.mode === "button") {
|
|
75
|
-
style.backgroundColor = this.bgColor;
|
|
76
|
-
}
|
|
77
|
-
return style;
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
// 滑块的样式
|
|
81
|
-
barStyle() {
|
|
82
|
-
const style = {
|
|
83
|
-
width: `${this.itemRect.width}px`,
|
|
84
|
-
height: `${this.itemRect.height}px`
|
|
85
|
-
};
|
|
86
|
-
// 通过translateX移动滑块,其移动的距离为索引*item的宽度
|
|
87
|
-
// #ifndef APP-NVUE
|
|
88
|
-
style.transform = `translateX(${ this.current * this.itemRect.width }px)`;
|
|
89
|
-
style.transitionDuration = `${this.firstTime ? 0 : parseInt(this.duration)}ms`;
|
|
90
|
-
// 如果是第一次执行此方法,让滑块在初始化时,瞬间滑动到默认的current第一个subsection item的中间
|
|
91
|
-
// 这里需要一个定时器,因为在非nvue下,是直接通过style绑定过渡时间,需要等其过渡完成后,再设置为false(非第一次移动滑块)
|
|
92
|
-
if (this.firstTime) {
|
|
93
|
-
setTimeout(() => {
|
|
94
|
-
this.firstTime = false;
|
|
95
|
-
}, 50);
|
|
96
|
-
}
|
|
97
|
-
// #endif
|
|
98
|
-
if (this.mode === "subsection") {
|
|
99
|
-
// 在subsection模式下,需要动态设置滑块的圆角,因为移动滑块使用的是translateX,无法通过父元素设置overflow: hidden隐藏滑块的直角
|
|
100
|
-
style.backgroundColor = this.activeColor;
|
|
101
|
-
}
|
|
102
|
-
return this.$fu.deepMerge(style, this.$fu.addStyle(this.customItemStyle));
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
// 分段器item的样式
|
|
106
|
-
itemStyle(index) {
|
|
107
|
-
return (index) => {
|
|
108
|
-
if (this.mode !== "subsection") return {};
|
|
109
|
-
return {
|
|
110
|
-
borderColor: this.activeColor,
|
|
111
|
-
borderWidth: "1px",
|
|
112
|
-
borderStyle: "solid"
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
// 分段器文字颜色
|
|
118
|
-
textStyle(index) {
|
|
119
|
-
return (index) => {
|
|
120
|
-
const isActive = this.current === index;
|
|
121
|
-
const { mode, inactiveColor, activeColor, size, bold, $fu } = this;
|
|
122
|
-
|
|
123
|
-
return {
|
|
124
|
-
fontWeight: bold && isActive ? "bold" : "normal",
|
|
125
|
-
fontSize: $fu.addUnit(size), // 单位转换结果缓存
|
|
126
|
-
color: mode === "subsection"? (isActive ? "#fff" : inactiveColor): (isActive ? activeColor : inactiveColor)
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
mounted() {
|
|
132
|
-
this.init();
|
|
133
|
-
},
|
|
134
|
-
methods: {
|
|
135
|
-
// 初始化
|
|
136
|
-
init() {
|
|
137
|
-
this.$fu.sleep().then(() => this.getRect());
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
// 判断展示文本
|
|
141
|
-
getText(item) {
|
|
142
|
-
return typeof item === 'object' ? item[this.keyName] : item
|
|
143
|
-
},
|
|
144
|
-
|
|
145
|
-
// 获取组件的尺寸
|
|
146
|
-
getRect() {
|
|
147
|
-
// #ifndef APP-NVUE
|
|
148
|
-
this.$fuGetRect(".fu-subsection__item--0").then((size) => {
|
|
149
|
-
this.itemRect = size;
|
|
150
|
-
});
|
|
151
|
-
// #endif
|
|
152
|
-
|
|
153
|
-
// #ifdef APP-NVUE
|
|
154
|
-
const ref = this.$refs["fu-subsection__item--0"][0];
|
|
155
|
-
ref && dom.getComponentRect(ref, (res) => {
|
|
156
|
-
this.itemRect = res.size;
|
|
157
|
-
});
|
|
158
|
-
// #endif
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
handleClick(index) {
|
|
162
|
-
this.$emit("change", index);
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
watch: {
|
|
166
|
-
list: {
|
|
167
|
-
deep: true,
|
|
168
|
-
handler(){
|
|
169
|
-
this.init();
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
current: {
|
|
173
|
-
immediate: true,
|
|
174
|
-
handler(n) {
|
|
175
|
-
// #ifdef APP-NVUE
|
|
176
|
-
// 在安卓nvue上,如果通过translateX进行位移,到最后一个时,会导致右侧无法绘制圆角
|
|
177
|
-
// 故用animation模块进行位移
|
|
178
|
-
const ref = this.$refs?.["fu-subsection__bar"]?.ref;
|
|
179
|
-
// 不存在ref的时候(理解为第一次初始化时,需要渲染dom,进行一定延时再获取ref),这里的100ms是经过测试得出的结果(某些安卓需要延时久一点),勿随意修改
|
|
180
|
-
this.$fu.sleep(ref? 0 : 150).then(() => {
|
|
181
|
-
animation.transition(this.$refs["fu-subsection__bar"].ref, {
|
|
182
|
-
styles: {
|
|
183
|
-
transform: `translateX(${ n * this.itemRect.width }px)`,
|
|
184
|
-
transformOrigin: "center center"
|
|
185
|
-
},
|
|
186
|
-
duration: 300,
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
// #endif
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
</script>
|
|
195
|
-
|
|
196
|
-
<style lang="scss" scoped>
|
|
197
|
-
@import '../../libs/style/components.scss';
|
|
198
|
-
$padding: 3px;
|
|
199
|
-
$border-radius: 3px;
|
|
200
|
-
|
|
201
|
-
.fu-subsection {
|
|
202
|
-
@include flex(row);
|
|
203
|
-
position: relative;
|
|
204
|
-
/* #ifndef APP-NVUE */
|
|
205
|
-
width: 100%;
|
|
206
|
-
box-sizing: border-box;
|
|
207
|
-
overflow: hidden;
|
|
208
|
-
/* #endif */
|
|
209
|
-
|
|
210
|
-
&--button {
|
|
211
|
-
height: 32px;
|
|
212
|
-
background-color: rgb(238, 238, 239);
|
|
213
|
-
padding: $padding;
|
|
214
|
-
border-radius: $border-radius;
|
|
215
|
-
align-items: stretch;
|
|
216
|
-
|
|
217
|
-
&__bar {
|
|
218
|
-
background-color: #ffffff;
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
&--subsection {
|
|
223
|
-
height: 30px;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
&__bar {
|
|
227
|
-
position: absolute;
|
|
228
|
-
/* #ifndef APP-NVUE */
|
|
229
|
-
transition-property: transform, color;
|
|
230
|
-
transition-duration: 0.3s;
|
|
231
|
-
transition-timing-function: ease-in-out;
|
|
232
|
-
/* #endif */
|
|
233
|
-
|
|
234
|
-
&--first {
|
|
235
|
-
border-top-left-radius: $border-radius;
|
|
236
|
-
border-bottom-left-radius: $border-radius;
|
|
237
|
-
border-top-right-radius: 0px;
|
|
238
|
-
border-bottom-right-radius: 0px;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
&--center {
|
|
242
|
-
border-top-left-radius: 0px;
|
|
243
|
-
border-bottom-left-radius: 0px;
|
|
244
|
-
border-top-right-radius: 0px;
|
|
245
|
-
border-bottom-right-radius: 0px;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
&--last {
|
|
249
|
-
border-top-left-radius: 0px;
|
|
250
|
-
border-bottom-left-radius: 0px;
|
|
251
|
-
border-top-right-radius: $border-radius;
|
|
252
|
-
border-bottom-right-radius: $border-radius;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
&__item {
|
|
257
|
-
@include flex(row);
|
|
258
|
-
justify-content: center;
|
|
259
|
-
align-items: center;
|
|
260
|
-
flex: 1;
|
|
261
|
-
// vue环境下,需要设置相对定位,因为滑块为绝对定位,item需要在滑块的上面
|
|
262
|
-
position: relative;
|
|
263
|
-
|
|
264
|
-
&--no-border-right {
|
|
265
|
-
border-right-width: 0 !important;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
&--first {
|
|
269
|
-
border-top-left-radius: $border-radius;
|
|
270
|
-
border-bottom-left-radius: $border-radius;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
&--last {
|
|
274
|
-
border-top-right-radius: $border-radius;
|
|
275
|
-
border-bottom-right-radius: $border-radius;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
&__text {
|
|
279
|
-
@include flex(row);
|
|
280
|
-
font-size: 12px;
|
|
281
|
-
line-height: 12px;
|
|
282
|
-
align-items: center;
|
|
283
|
-
transition-property: color;
|
|
284
|
-
transition-duration: 0.3s;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
</style>
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
props: {
|
|
3
|
-
/**
|
|
4
|
-
* @description 滑块的移动过渡时间,单位ms
|
|
5
|
-
* @default 300
|
|
6
|
-
*/
|
|
7
|
-
duration: {
|
|
8
|
-
type: [String,Number],
|
|
9
|
-
default: 300
|
|
10
|
-
},
|
|
11
|
-
/**
|
|
12
|
-
* @description subsection的数据
|
|
13
|
-
*/
|
|
14
|
-
list: {
|
|
15
|
-
type: Array,
|
|
16
|
-
default: () => []
|
|
17
|
-
},
|
|
18
|
-
/**
|
|
19
|
-
* @description 当前活动的subsection的index
|
|
20
|
-
*/
|
|
21
|
-
current: {
|
|
22
|
-
type: [String,Number],
|
|
23
|
-
default: 0
|
|
24
|
-
},
|
|
25
|
-
/**
|
|
26
|
-
* @description 激活的颜色
|
|
27
|
-
*/
|
|
28
|
-
activeColor: {
|
|
29
|
-
type: String,
|
|
30
|
-
default: '#2979ff'
|
|
31
|
-
},
|
|
32
|
-
/**
|
|
33
|
-
* @description 未激活的颜色
|
|
34
|
-
*/
|
|
35
|
-
inactiveColor: {
|
|
36
|
-
type: String,
|
|
37
|
-
default: '#303133'
|
|
38
|
-
},
|
|
39
|
-
// 模式选择(默认 'button')
|
|
40
|
-
/**
|
|
41
|
-
* @description 模式选择
|
|
42
|
-
* @values 'button' - 按钮模式, 'subsection' - 分段器模式
|
|
43
|
-
*/
|
|
44
|
-
mode: {
|
|
45
|
-
type: String,
|
|
46
|
-
default: 'button'
|
|
47
|
-
},
|
|
48
|
-
/**
|
|
49
|
-
* @description 字体大小
|
|
50
|
-
* @default 12
|
|
51
|
-
*/
|
|
52
|
-
size: {
|
|
53
|
-
type: [String,Number],
|
|
54
|
-
default: 12
|
|
55
|
-
},
|
|
56
|
-
/**
|
|
57
|
-
* @description 激活subsection的字体是否加粗
|
|
58
|
-
* @default true
|
|
59
|
-
*/
|
|
60
|
-
bold: {
|
|
61
|
-
type: Boolean,
|
|
62
|
-
default: true
|
|
63
|
-
},
|
|
64
|
-
/**
|
|
65
|
-
* @description 组件背景颜色(仅mode=button时生效)
|
|
66
|
-
* @default '#efeff0'
|
|
67
|
-
*/
|
|
68
|
-
bgColor: {
|
|
69
|
-
type: String,
|
|
70
|
-
default: '#efeff0'
|
|
71
|
-
},
|
|
72
|
-
/**
|
|
73
|
-
* @description 从list元素对象中读取的键名
|
|
74
|
-
* @default 'name'
|
|
75
|
-
*/
|
|
76
|
-
keyName: {
|
|
77
|
-
type: String,
|
|
78
|
-
default: 'name'
|
|
79
|
-
},
|
|
80
|
-
/**
|
|
81
|
-
* @description 自定义item外部样式
|
|
82
|
-
*/
|
|
83
|
-
customItemStyle: {
|
|
84
|
-
type: [String, Object],
|
|
85
|
-
default: ''
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|