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
|
@@ -23,15 +23,17 @@
|
|
|
23
23
|
:duration="duration"
|
|
24
24
|
:previous-margin="effect3D? effect3DPreviousSpacing + 'px' : '0'"
|
|
25
25
|
:next-margin="effect3D ? effect3DPreviousSpacing + 'px' : '0'"
|
|
26
|
-
@change="
|
|
26
|
+
@change="handleChange"
|
|
27
27
|
v-else>
|
|
28
28
|
<swiper-item class="fu-swiper__item" v-for="(item, index) in list" :key="index">
|
|
29
|
-
<view
|
|
30
|
-
|
|
29
|
+
<view
|
|
30
|
+
class="fu-swiper__item__wrap"
|
|
31
|
+
:class="[swiperIndex !== index ? 'fu-swiper__item__wrap__image--scale' : '']"
|
|
32
|
+
:style="[{
|
|
31
33
|
transform: effect3D && swiperIndex !== index ? 'scaleY(0.9)' : 'scaleY(1)',
|
|
32
34
|
margin: effect3D && swiperIndex !== index ? '0 20rpx' : 0
|
|
33
|
-
}]"
|
|
34
|
-
|
|
35
|
+
}]"
|
|
36
|
+
@tap="handleClick(item, index)">
|
|
35
37
|
<image
|
|
36
38
|
class="fu-swiper__item__wrap__image"
|
|
37
39
|
:src="getSource(item)"
|
|
@@ -57,7 +59,9 @@
|
|
|
57
59
|
v-if="getItemType(item) === 'video'">
|
|
58
60
|
</video>
|
|
59
61
|
|
|
60
|
-
<view
|
|
62
|
+
<view
|
|
63
|
+
class="fu-swiper__item__wrap__title fu-text-ellipsis"
|
|
64
|
+
:style="[titleStyle]"
|
|
61
65
|
v-if="showTitle && item[keyTitle]">
|
|
62
66
|
{{ item[keyTitle] }}
|
|
63
67
|
</view>
|
|
@@ -69,19 +73,22 @@
|
|
|
69
73
|
<view class="fu-swiper__indicator" :style="[indicatorStyle]" v-if="indicator">
|
|
70
74
|
<slot name="indicator">
|
|
71
75
|
<block v-if="mode === 'rect'">
|
|
72
|
-
<view
|
|
76
|
+
<view
|
|
77
|
+
class="fu-swiper__indicator__rect"
|
|
73
78
|
:class="{'fu-swiper__indicator__rect--active': swiperIndex === index}"
|
|
74
|
-
v-for="(
|
|
79
|
+
v-for="(_item, index) in list" :key="index"></view>
|
|
75
80
|
</block>
|
|
76
81
|
<block v-if="mode === 'dot'">
|
|
77
|
-
<view
|
|
82
|
+
<view
|
|
83
|
+
class="fu-swiper__indicator__dot"
|
|
78
84
|
:class="{'fu-swiper__indicator__dot--active': swiperIndex === index}"
|
|
79
|
-
v-for="(
|
|
85
|
+
v-for="(_item, index) in list" :key="index"></view>
|
|
80
86
|
</block>
|
|
81
87
|
<block v-if="mode === 'round'">
|
|
82
|
-
<view
|
|
88
|
+
<view
|
|
89
|
+
class="fu-swiper__indicator__round"
|
|
83
90
|
:class="{'fu-swiper__indicator__round--active': swiperIndex === index}"
|
|
84
|
-
v-for="(
|
|
91
|
+
v-for="(_item, index) in list" :key="index"></view>
|
|
85
92
|
</block>
|
|
86
93
|
<block v-if="mode === 'number'">
|
|
87
94
|
<view class="fu-swiper__indicator__number">{{ swiperIndex + 1 }}/{{ list.length }}</view>
|
|
@@ -91,16 +98,15 @@
|
|
|
91
98
|
</view>
|
|
92
99
|
</template>
|
|
93
100
|
|
|
94
|
-
<script>
|
|
95
|
-
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
96
|
-
import props from './props.js'
|
|
101
|
+
<script lang="ts" setup>
|
|
97
102
|
/**
|
|
98
103
|
* Swiper 轮播图
|
|
99
104
|
* @description 此组件一般用于导航轮播,广告展示等场景
|
|
105
|
+
* @tutorial http://www.fusions.top/components/swiper.html
|
|
100
106
|
* @property {Array} list 轮播图列表数据
|
|
101
|
-
* @property {String
|
|
107
|
+
* @property {String | Number} radius 圆角的值 (默认 5)
|
|
102
108
|
* @property {Number} current 初始化时,默认显示第几项
|
|
103
|
-
* @property {String
|
|
109
|
+
* @property {String | Number} height 高度 (默认 160)
|
|
104
110
|
* @property {String} bgColor 背景色 (默认 #f2f3f4)
|
|
105
111
|
* @property {String} keyName 图片的属性名 (默认 image)
|
|
106
112
|
* @property {Boolean} showTitle = [true|false] 是否显示标题(默认 false)
|
|
@@ -120,7 +126,7 @@
|
|
|
120
126
|
* @value bottomCenter 指示器位于底部中间位置,为默认值
|
|
121
127
|
* @value bottomRight 指示器位于右下角
|
|
122
128
|
* @property {Boolean} effect3D = [true|false] 开启3D缩放效果 (默认 false)
|
|
123
|
-
* @property {String
|
|
129
|
+
* @property {String | Number} effect3DPreviousSpacing 在3D缩放模式下,item之间的间隔(默认 25)
|
|
124
130
|
* @property {Boolean} autoplay = [true|false] 自定播放 (默认 true)
|
|
125
131
|
* @property {Number} interval 图片之间播放间隔多久 (默认 3000)
|
|
126
132
|
* @property {Number} duration 轮播间隔时间 (默认 500)
|
|
@@ -132,110 +138,35 @@
|
|
|
132
138
|
* @event {Function} change 轮播图切换时触发
|
|
133
139
|
* @example <fu-swiper :list="list"></fu-swiper>
|
|
134
140
|
*/
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
style.padding = `0 ${this.effect3D? '74rpx': '24rpx'}`;
|
|
159
|
-
|
|
160
|
-
return style
|
|
161
|
-
},
|
|
162
|
-
swiperTitleStyle() {
|
|
163
|
-
let style = {}
|
|
164
|
-
if (this.mode === 'none' || this.mode === '') style.paddingBottom = '12rpx'
|
|
165
|
-
if (['bottomLeft', 'bottomCenter', 'bottomRight'].indexOf(this.indicatorPosition) >= 0 && this.mode === 'number') {
|
|
166
|
-
style.paddingBottom = '60rpx';
|
|
167
|
-
} else if (['bottomLeft', 'bottomCenter', 'bottomRight'].indexOf(this.indicatorPosition) >= 0 && this.mode !== 'number') {
|
|
168
|
-
style.paddingBottom = '40rpx';
|
|
169
|
-
} else {
|
|
170
|
-
style.paddingBottom = '12rpx';
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
return Object.assign(style, this.titleStyle)
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
methods: {
|
|
177
|
-
getItemType(e) {
|
|
178
|
-
if (typeof e === 'string') return this.$fu.isVideo(this.getSource(e)) ? 'video' : 'image'
|
|
179
|
-
if (typeof e === 'object' && this.keyName) {
|
|
180
|
-
if (!e.type) return this.$fu.isVideo(this.getSource(e))? 'video': 'image'
|
|
181
|
-
if (e.type === 'image') return 'image'
|
|
182
|
-
if (e.type === 'video') return 'video'
|
|
183
|
-
return 'image'
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
getSource(e) {
|
|
188
|
-
if (typeof e === 'string') return e
|
|
189
|
-
if (typeof e === 'object' && this.keyName) return e[this.keyName]
|
|
190
|
-
else this.$fu.error('请按格式传递列表参数')
|
|
191
|
-
return ''
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
// 点击某个item
|
|
195
|
-
handleClick(index) {
|
|
196
|
-
this.$emit('click', index)
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
// 轮播切换时触发
|
|
200
|
-
change(event) {
|
|
201
|
-
const current = event.detail.current;
|
|
202
|
-
this.pauseVideo(this.swiperIndex)
|
|
203
|
-
this.swiperIndex = current
|
|
204
|
-
this.$emit('change', current)
|
|
205
|
-
},
|
|
206
|
-
|
|
207
|
-
// 切换轮播时,暂停视频播放
|
|
208
|
-
pauseVideo(index) {
|
|
209
|
-
const lastItem = this.getSource(this.list[index])
|
|
210
|
-
if (this.$fu.isVideo(lastItem)) {
|
|
211
|
-
// 当视频隐藏时,暂停播放
|
|
212
|
-
const video = uni.createVideoContext(`video-${index}`, this)
|
|
213
|
-
video.pause()
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
// 当一个轮播item为视频时,获取它的视频海报
|
|
217
|
-
getPoster(item) {
|
|
218
|
-
return typeof item === 'object' && item.poster ? item.poster : ''
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
watch: {
|
|
222
|
-
list(newVal, oldVal) {
|
|
223
|
-
// 如果修改了list的数据,重置current的值
|
|
224
|
-
if (newVal.length !== oldVal.length) this.swiperIndex = 0
|
|
225
|
-
},
|
|
226
|
-
current(value) {
|
|
227
|
-
// 监听外部current的变化,实时修改内部依赖于此测swiperIndex值,如果更新了current,而不是更新swiperIndex,就会错乱,因为指示器是依赖于swiperIndex的
|
|
228
|
-
this.swiperIndex = value
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
141
|
+
import { swiperEmits, swiperProps } from './swiper';
|
|
142
|
+
import { useSwiper, useSwiperCustomStyle } from './composables';
|
|
143
|
+
|
|
144
|
+
defineOptions({ name: 'FuSwiper', options: { } });
|
|
145
|
+
|
|
146
|
+
const props = defineProps(swiperProps);
|
|
147
|
+
const $emit = defineEmits(swiperEmits);
|
|
148
|
+
|
|
149
|
+
const {
|
|
150
|
+
swiperIndex,
|
|
151
|
+
getItemType,
|
|
152
|
+
getSource,
|
|
153
|
+
handleClick,
|
|
154
|
+
handleChange,
|
|
155
|
+
pauseVideo,
|
|
156
|
+
getPoster
|
|
157
|
+
} = useSwiper(props, $emit);
|
|
158
|
+
|
|
159
|
+
const {
|
|
160
|
+
indicatorStyle,
|
|
161
|
+
swiperTitleStyle
|
|
162
|
+
} = useSwiperCustomStyle(props);
|
|
232
163
|
</script>
|
|
233
164
|
|
|
234
165
|
<style lang="scss" scoped>
|
|
235
|
-
@
|
|
166
|
+
@use "../../../style/components.scss";
|
|
236
167
|
|
|
237
168
|
.fu-swiper {
|
|
238
|
-
@include flex;
|
|
169
|
+
@include components.flex;
|
|
239
170
|
justify-content: center;
|
|
240
171
|
align-items: center;
|
|
241
172
|
position: relative;
|
|
@@ -252,7 +183,7 @@
|
|
|
252
183
|
flex: 1;
|
|
253
184
|
|
|
254
185
|
&__wrap {
|
|
255
|
-
@include flex;
|
|
186
|
+
@include components.flex;
|
|
256
187
|
position: relative;
|
|
257
188
|
/* #ifndef APP-NVUE */
|
|
258
189
|
overflow: hidden;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/switch'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Ref, computed } from 'vue';
|
|
2
|
+
import type { SwitchProps } from '../switch';
|
|
3
|
+
|
|
4
|
+
export const useSwitchCustomStyle = (props: SwitchProps, isActive: Ref<boolean | string | number>) => {
|
|
5
|
+
const switchStyle = computed(() => {
|
|
6
|
+
let style: Record<string, any> = {};
|
|
7
|
+
style.fontSize = uni.$fu.addUnit(props.size);
|
|
8
|
+
style.backgroundColor = isActive.value? props.activeColor: props.inactiveColor;
|
|
9
|
+
return style
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const switchNodeStyle = computed(() => {
|
|
13
|
+
let style: Record<string, any> = {};
|
|
14
|
+
style.width = uni.$fu.addUnit(props.size);
|
|
15
|
+
style.height = style.width;
|
|
16
|
+
return style
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const iconStyle = computed(() => {
|
|
20
|
+
let style: Record<string, any> = {}
|
|
21
|
+
style.fontSize = uni.$fu.addUnit(props.size - 20)
|
|
22
|
+
style.lineHeight = uni.$fu.addUnit(props.size)
|
|
23
|
+
return style
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
isActive,
|
|
28
|
+
switchStyle,
|
|
29
|
+
switchNodeStyle,
|
|
30
|
+
iconStyle
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ref, nextTick, computed, watch, type SetupContext } from 'vue';
|
|
2
|
+
import type { SwitchProps, SwitchEmits } from '../switch';
|
|
3
|
+
|
|
4
|
+
export const useSwitch = (props : SwitchProps, $emit : SetupContext<SwitchEmits>['emit']) => {
|
|
5
|
+
const innerValue = ref(props.modelValue);
|
|
6
|
+
|
|
7
|
+
const handleClick = () => {
|
|
8
|
+
if (!props.disabled && !props.loading) {
|
|
9
|
+
if (props.vibrateShort) uni.vibrateShort()
|
|
10
|
+
const oldVal = isActive.value? props.inactiveValue: props.activeValue;
|
|
11
|
+
$emit('input', oldVal)
|
|
12
|
+
$emit('update:modelValue', oldVal)
|
|
13
|
+
// 放到下一个生命周期,因为双向绑定的value修改父组件状态需要时间,且是异步的
|
|
14
|
+
nextTick(() => {
|
|
15
|
+
$emit('change', oldVal);
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// computed计算属性
|
|
21
|
+
const isActive = computed(() => {
|
|
22
|
+
return innerValue.value === props.activeValue;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// watch监听事件
|
|
26
|
+
watch(() => props.modelValue, (newVal) => {
|
|
27
|
+
if (newVal !== props.inactiveValue && newVal !== props.activeValue) {
|
|
28
|
+
return uni.$fu.error('v-model绑定的值必须为inactiveValue、activeValue二者之一')
|
|
29
|
+
}
|
|
30
|
+
innerValue.value = newVal;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
innerValue,
|
|
35
|
+
isActive,
|
|
36
|
+
handleClick
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { ExtractPropTypes } from 'vue';
|
|
2
|
+
import { componentShapes } from '../../../constants';
|
|
3
|
+
|
|
4
|
+
export const switchProps = {
|
|
5
|
+
/**
|
|
6
|
+
* @description v-model 绑定的值
|
|
7
|
+
*/
|
|
8
|
+
modelValue: {
|
|
9
|
+
type: [Boolean, String, Number],
|
|
10
|
+
default: false
|
|
11
|
+
},
|
|
12
|
+
/**
|
|
13
|
+
* @description 设置形状
|
|
14
|
+
* @values 'circle' - 圆角, 'square' - 方形
|
|
15
|
+
* @default 'circle'
|
|
16
|
+
*/
|
|
17
|
+
shape: {
|
|
18
|
+
type: String,
|
|
19
|
+
values: componentShapes,
|
|
20
|
+
default: 'circle'
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* @description 是否禁用
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
disabled: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* @description 设置尺寸
|
|
32
|
+
* @default 20
|
|
33
|
+
*/
|
|
34
|
+
size: {
|
|
35
|
+
type: [String, Number],
|
|
36
|
+
default: 20
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* @description 打开时的背景颜色
|
|
40
|
+
* @default '#2979ff'
|
|
41
|
+
*/
|
|
42
|
+
activeColor: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: '#2979ff'
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* @description 关闭时的背景颜色
|
|
48
|
+
* @default '#d6d6d6'
|
|
49
|
+
*/
|
|
50
|
+
inactiveColor: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: '#d6d6d6'
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* @description 激活时的值
|
|
56
|
+
* @default true
|
|
57
|
+
*/
|
|
58
|
+
activeValue: {
|
|
59
|
+
type: [Boolean, String, Number],
|
|
60
|
+
default: true
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* @description 关闭时的值
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
inactiveValue: {
|
|
67
|
+
type: [Boolean, String, Number],
|
|
68
|
+
default: false
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* @description 左图标
|
|
72
|
+
*/
|
|
73
|
+
leftIcon: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: ''
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* @description 右图标
|
|
79
|
+
*/
|
|
80
|
+
rightIcon: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: ''
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* @description 是否为加载状态
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
loading: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: false
|
|
91
|
+
},
|
|
92
|
+
/**
|
|
93
|
+
* @description 点击手机是否震动
|
|
94
|
+
* @default false
|
|
95
|
+
*/
|
|
96
|
+
vibrateShort: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: false
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const switchEmits = {
|
|
103
|
+
'update:modelValue': (_e: any) => true,
|
|
104
|
+
/**
|
|
105
|
+
* @description v-model 输入事件
|
|
106
|
+
*/
|
|
107
|
+
input: (_e: any) => true,
|
|
108
|
+
/**
|
|
109
|
+
* @description 开关状态变化时触发
|
|
110
|
+
*/
|
|
111
|
+
change: (_e: any) => true
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export type SwitchProps = ExtractPropTypes<typeof switchProps>;
|
|
115
|
+
export type SwitchEmits = typeof switchEmits;
|
|
@@ -17,22 +17,21 @@
|
|
|
17
17
|
</view>
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
|
-
<script>
|
|
21
|
-
import mpMixin from '../../libs/mixin/mpMixin.js'
|
|
22
|
-
import props from './props.js'
|
|
20
|
+
<script lang="ts" setup>
|
|
23
21
|
/**
|
|
24
22
|
* Switch 开关选择器
|
|
25
23
|
* @description 此组件选择开关一般用于只有两个选择,且只能选其一的场景。
|
|
26
|
-
* @
|
|
24
|
+
* @tutorial http://www.fusions.top/components/switch.html
|
|
25
|
+
* @property {Boolean | String | Number} v-model 绑定的值 (默认 false )
|
|
27
26
|
* @property {String} shape = [circle|square] 设置形状(默认 'circle')
|
|
28
27
|
* @value circle 圆角
|
|
29
28
|
* @value square 方形
|
|
30
29
|
* @property {Boolean} disabled = [true|false] 是否禁用(默认 false)
|
|
31
|
-
* @property {String
|
|
30
|
+
* @property {String | Number} size 尺寸(默认 20)
|
|
32
31
|
* @property {String} activeColor 打开时的背景颜色(默认 '#2979ff')
|
|
33
32
|
* @property {String} inactiveColor 关闭时的背景颜色(默认 '#d6d6d6')
|
|
34
|
-
* @property {Number
|
|
35
|
-
* @property {Number
|
|
33
|
+
* @property {Boolean | String | Number} activeValue 激活时的值 (默认 true)
|
|
34
|
+
* @property {Boolean | String | Number} inactiveValue 关闭时的值(默认false)
|
|
36
35
|
* @property {String} leftIcon 左图标
|
|
37
36
|
* @property {String} rightIcon 右图标
|
|
38
37
|
* @property {Boolean} loading = [true|false] 是否为加载状态
|
|
@@ -41,72 +40,25 @@
|
|
|
41
40
|
* @event {Function} change 在switch打开或关闭时触发
|
|
42
41
|
* @example <fu-switch v-model="checked"></fu-switch>
|
|
43
42
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
style.backgroundColor = this.isActive? this.activeColor: this.inactiveColor;
|
|
64
|
-
return style
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
switchNodeStyle() {
|
|
68
|
-
let style = {};
|
|
69
|
-
style.width = this.$fu.addUnit(this.size);
|
|
70
|
-
style.height = style.width;
|
|
71
|
-
return style
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
iconStyle() {
|
|
75
|
-
let style = {}
|
|
76
|
-
style.fontSize = this.$fu.addUnit(this.size - 20)
|
|
77
|
-
style.lineHeight = this.$fu.addUnit(this.size)
|
|
78
|
-
return style
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
methods: {
|
|
82
|
-
handleClick() {
|
|
83
|
-
if (!this.disabled && !this.loading) {
|
|
84
|
-
if (this.vibrateShort) uni.vibrateShort()
|
|
85
|
-
const oldVal = this.isActive? this.inactiveValue: this.activeValue;
|
|
86
|
-
this.$emit('input', oldVal)
|
|
87
|
-
this.$emit('update:modelValue', oldVal)
|
|
88
|
-
// 放到下一个生命周期,因为双向绑定的value修改父组件状态需要时间,且是异步的
|
|
89
|
-
this.$nextTick(() => {
|
|
90
|
-
this.$emit('change', oldVal);
|
|
91
|
-
})
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
watch: {
|
|
96
|
-
value(newVal) {
|
|
97
|
-
if (newVal !== this.inactiveValue && newVal !== this.activeValue) {
|
|
98
|
-
return this.$fu.error('v-model绑定的值必须为inactiveValue、activeValue二者之一')
|
|
99
|
-
}
|
|
100
|
-
this.innerValue = newVal;
|
|
101
|
-
},
|
|
102
|
-
modelValue(newVal) {
|
|
103
|
-
if (newVal !== this.inactiveValue && newVal !== this.activeValue) {
|
|
104
|
-
return this.$fu.error('v-model绑定的值必须为inactiveValue、activeValue二者之一')
|
|
105
|
-
}
|
|
106
|
-
this.innerValue = newVal;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
43
|
+
import { switchEmits, switchProps } from './switch';
|
|
44
|
+
import { useSwitch, useSwitchCustomStyle } from './composables';
|
|
45
|
+
|
|
46
|
+
defineOptions({ name: 'FuSwitch', options: { virtualHost: true } });
|
|
47
|
+
|
|
48
|
+
const props = defineProps(switchProps);
|
|
49
|
+
const $emit = defineEmits(switchEmits);
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
innerValue,
|
|
53
|
+
isActive,
|
|
54
|
+
handleClick
|
|
55
|
+
} = useSwitch(props, $emit);
|
|
56
|
+
|
|
57
|
+
const {
|
|
58
|
+
switchStyle,
|
|
59
|
+
switchNodeStyle,
|
|
60
|
+
iconStyle
|
|
61
|
+
} = useSwitchCustomStyle(props, isActive);
|
|
110
62
|
</script>
|
|
111
63
|
|
|
112
64
|
<style lang="scss" scoped>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/tabs'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { computed, Ref } from 'vue';
|
|
2
|
+
import type { TabsProps } from '../tabs';
|
|
3
|
+
|
|
4
|
+
export const useTabsCustomStyle = (
|
|
5
|
+
props: TabsProps,
|
|
6
|
+
firstTime: Ref<boolean>,
|
|
7
|
+
lineOffsetLeft: Ref<number>,
|
|
8
|
+
innerCurrent: Ref<number>
|
|
9
|
+
) => {
|
|
10
|
+
const textStyle = computed(() => {
|
|
11
|
+
return (index: number) => {
|
|
12
|
+
const style: Record<string, any> = {};
|
|
13
|
+
// 取当期是否激活的样式
|
|
14
|
+
const customeStyle = index == innerCurrent.value ? uni.$fu.addStyle(props.activeStyle) : uni.$fu.addStyle(props.inactiveStyle);
|
|
15
|
+
// 如果当前菜单被禁用,则加上对应颜色,需要在此做处理,是因为nvue下,无法在style样式中通过!import覆盖标签的内联样式
|
|
16
|
+
if ((props.list[index] as any)?.disabled) {
|
|
17
|
+
style.color = '#c8c9cc';
|
|
18
|
+
}
|
|
19
|
+
return uni.$fu.deepMerge(customeStyle, style)
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const lineStyle = computed(() => {
|
|
24
|
+
let style: Record<string, any> = {
|
|
25
|
+
width: `${props.lineWidth}px`,
|
|
26
|
+
height: firstTime.value? 0: `${props.lineHeight}px`,
|
|
27
|
+
background: props.lineColor,
|
|
28
|
+
backgroundSize: props.lineBgSize,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// #ifndef APP-NVUE
|
|
32
|
+
style.transform = `translate(${lineOffsetLeft.value}px)`;
|
|
33
|
+
style.transitionDuration = `${firstTime.value? 0 : props.duration}ms`;
|
|
34
|
+
// #endif
|
|
35
|
+
|
|
36
|
+
return style
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
textStyle,
|
|
41
|
+
lineStyle
|
|
42
|
+
}
|
|
43
|
+
}
|