@10yun/cv-mobile-ui 0.5.29 → 0.5.31
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/package.json +5 -1
- package/plugins/luch-request/adapters/index.js +131 -0
- package/plugins/luch-request/core/InterceptorManager.js +50 -0
- package/plugins/luch-request/core/Request.js +199 -0
- package/plugins/luch-request/core/buildFullPath.js +20 -0
- package/plugins/luch-request/core/defaults.js +32 -0
- package/plugins/luch-request/core/dispatchRequest.js +5 -0
- package/plugins/luch-request/core/mergeConfig.js +125 -0
- package/plugins/luch-request/core/settle.js +16 -0
- package/plugins/luch-request/helpers/buildURL.js +71 -0
- package/plugins/luch-request/helpers/combineURLs.js +12 -0
- package/plugins/luch-request/helpers/isAbsoluteURL.js +14 -0
- package/plugins/luch-request/index.d.ts +197 -0
- package/plugins/luch-request/index.js +2 -0
- package/plugins/luch-request/readme.md +3 -0
- package/plugins/luch-request/utils/clone.js +264 -0
- package/plugins/luch-request/utils.js +131 -0
- package/plugins/request.js +2 -2
- package/ui-cv/components/cv-btn-base/cv-btn-base.vue +1 -1
- package/ui-cv/components/cv-form-item/cv-form-item.vue +1 -1
- package/ui-fireui/fui-actionsheet/fui-actionsheet.vue +202 -0
- package/ui-fireui/fui-alert/fui-alert.vue +141 -0
- package/ui-fireui/fui-badge/fui-badge.vue +158 -0
- package/ui-fireui/fui-bottom-navigation/fui-bottom-navigation.vue +390 -0
- package/ui-fireui/fui-bottom-popup/fui-bottom-popup.vue +100 -0
- package/ui-fireui/fui-bubble-popup/fui-bubble-popup.vue +236 -0
- package/ui-fireui/fui-button/fui-button.vue +424 -0
- package/ui-fireui/fui-calendar/fui-calendar.js +915 -0
- package/ui-fireui/fui-calendar/fui-calendar.vue +868 -0
- package/ui-fireui/fui-card/fui-card.vue +231 -0
- package/ui-fireui/fui-cascade-selection/fui-cascade-selection.vue +538 -0
- package/ui-fireui/fui-circular-progress/fui-circular-progress.vue +261 -0
- package/ui-fireui/fui-collapse/fui-collapse.vue +179 -0
- package/ui-fireui/fui-countdown/fui-countdown.vue +301 -0
- package/ui-fireui/fui-datetime/fui-datetime.vue +570 -0
- package/ui-fireui/fui-divider/fui-divider.vue +118 -0
- package/ui-fireui/fui-drawer/fui-drawer.vue +103 -0
- package/ui-fireui/fui-dropdown-list/fui-dropdown-list.vue +70 -0
- package/ui-fireui/fui-fab/fui-fab.vue +284 -0
- package/ui-fireui/fui-footer/fui-footer.vue +131 -0
- package/ui-fireui/fui-grid/fui-grid.vue +42 -0
- package/ui-fireui/fui-grid-item/fui-grid-item.vue +142 -0
- package/ui-fireui/fui-icon/fui-icon.vue +820 -0
- package/ui-fireui/fui-image-cropper/fui-image-cropper.vue +1058 -0
- package/ui-fireui/fui-image-group/fui-image-group.vue +149 -0
- package/ui-fireui/fui-keyboard/fui-keyboard.vue +254 -0
- package/ui-fireui/fui-keyboard-input/fui-keyboard-input.vue +78 -0
- package/ui-fireui/fui-list-cell/fui-list-cell.vue +178 -0
- package/ui-fireui/fui-list-view/fui-list-view.vue +87 -0
- package/ui-fireui/fui-loading/fui-loading.vue +78 -0
- package/ui-fireui/fui-loadmore/fui-loadmore.vue +163 -0
- package/ui-fireui/fui-modal/fui-modal.vue +392 -0
- package/ui-fireui/fui-navigation-bar/fui-navigation-bar.vue +180 -0
- package/ui-fireui/fui-no-data/fui-no-data.vue +116 -0
- package/ui-fireui/fui-nomore/fui-nomore.vue +116 -0
- package/ui-fireui/fui-numberbox/fui-numberbox.vue +234 -0
- package/ui-fireui/fui-numberbox-border/fui-numberbox-border.vue +232 -0
- package/ui-fireui/fui-picture-cropper/fui-picture-cropper.vue +682 -0
- package/ui-fireui/fui-picture-cropper/fui-picture-cropper.wxs +560 -0
- package/ui-fireui/fui-rate/fui-rate.vue +167 -0
- package/ui-fireui/fui-round-progress/fui-round-progress.vue +306 -0
- package/ui-fireui/fui-scroll-top/fui-scroll-top.vue +189 -0
- package/ui-fireui/fui-sharemodel/fui-sharemodel.vue +181 -0
- package/ui-fireui/fui-skeleton/fui-skeleton.vue +248 -0
- package/ui-fireui/fui-steps/fui-steps.vue +214 -0
- package/ui-fireui/fui-sticky/fui-sticky.vue +155 -0
- package/ui-fireui/fui-sticky-wxs/fui-sticky-wxs.vue +133 -0
- package/ui-fireui/fui-sticky-wxs/fui-sticky.wxs +44 -0
- package/ui-fireui/fui-swipe-action/fui-swipe-action.vue +301 -0
- package/ui-fireui/fui-tabbar/fui-tabbar.vue +283 -0
- package/ui-fireui/fui-tabs/fui-tabs.vue +284 -0
- package/ui-fireui/fui-tabs2/fui-tabs2.vue +284 -0
- package/ui-fireui/fui-tag/fui-tag.vue +374 -0
- package/ui-fireui/fui-time-axis/fui-time-axis.vue +36 -0
- package/ui-fireui/fui-timeaxis-item/fui-timeaxis-item.vue +48 -0
- package/ui-fireui/fui-tips/fui-tips.vue +161 -0
- package/ui-fireui/fui-toast/fui-toast.vue +117 -0
- package/ui-fireui/fui-top-dropdown/fui-top-dropdown.vue +129 -0
- package/ui-fireui/fui-upload/fui-upload.vue +446 -0
- package/ui-fireui/fui-uploadsamll/fui-uploadsamll.vue +472 -0
- package/uview-plus/README.md +2 -2
- package/uview-plus/changelog-wu-tool.md +21 -0
- package/uview-plus/changelog-wu.md +91 -0
- package/uview-plus/components/u-action-sheet/_doc/changelog.md +12 -0
- package/uview-plus/components/u-action-sheet/_doc/package.json +92 -0
- package/uview-plus/components/u-action-sheet/_doc/readme.md +16 -0
- package/uview-plus/components/u-action-sheet/u-action-sheet.vue +8 -8
- package/uview-plus/components/u-album/u-album.vue +1 -1
- package/uview-plus/components/u-alert/u-alert.vue +5 -5
- package/uview-plus/components/u-app-update/_doc/changelog.md +26 -0
- package/uview-plus/components/u-app-update/_doc/package.json +89 -0
- package/uview-plus/components/u-app-update/_doc/readme.md +16 -0
- package/uview-plus/components/u-app-update/config.js +120 -0
- package/uview-plus/components/u-app-update/img/act.png +0 -0
- package/uview-plus/components/u-app-update/img/appUploadAlertBoxBg.png +0 -0
- package/uview-plus/components/u-app-update/img/close.png +0 -0
- package/uview-plus/components/u-app-update/js-sdk/checkVersion.js +81 -0
- package/uview-plus/components/u-app-update/js-sdk/silentlyAppUpdate.js +41 -0
- package/uview-plus/components/u-app-update/pages/index.vue +8 -0
- package/uview-plus/components/u-app-update/u-app-update.vue +583 -0
- package/uview-plus/components/u-avatar/u-avatar.vue +2 -2
- package/uview-plus/components/u-avatar-group/u-avatar-group.vue +79 -3
- package/uview-plus/components/u-back-top/u-back-top.vue +4 -4
- package/uview-plus/components/u-badge/u-badge.vue +1 -1
- package/uview-plus/components/u-button/u-button.vue +8 -8
- package/uview-plus/components/u-button-wu/_doc/changelog.md +6 -0
- package/uview-plus/components/u-button-wu/_doc/package.json +89 -0
- package/uview-plus/components/u-button-wu/_doc/readme.md +16 -0
- package/uview-plus/components/u-button-wu/u-button-wu.vue +522 -0
- package/uview-plus/components/u-button-wu/vue.scss +81 -0
- package/uview-plus/components/u-calendar/u-calendar.vue +5 -6
- package/uview-plus/components/u-calendar-wu/_doc/changelog.md +145 -0
- package/uview-plus/components/u-calendar-wu/_doc/package.json +90 -0
- package/uview-plus/components/u-calendar-wu/_doc/readme.md +16 -0
- package/uview-plus/components/u-calendar-wu/calendar.js +664 -0
- package/uview-plus/components/u-calendar-wu/i18n/en.json +14 -0
- package/uview-plus/components/u-calendar-wu/i18n/index.js +8 -0
- package/uview-plus/components/u-calendar-wu/i18n/zh-Hans.json +14 -0
- package/uview-plus/components/u-calendar-wu/i18n/zh-Hant.json +14 -0
- package/uview-plus/components/u-calendar-wu/props.js +166 -0
- package/uview-plus/components/u-calendar-wu/style.css +196 -0
- package/uview-plus/components/u-calendar-wu/u-calendar-wu.vue +921 -0
- package/uview-plus/components/u-calendar-wu/util.js +552 -0
- package/uview-plus/components/u-calendar-wu/wu-calendar-block/props.js +73 -0
- package/uview-plus/components/u-calendar-wu/wu-calendar-block/wu-calendar-block.vue +122 -0
- package/uview-plus/components/u-calendar-wu/wu-calendar-item/props.js +55 -0
- package/uview-plus/components/u-calendar-wu/wu-calendar-item/wu-calendar-item.vue +293 -0
- package/uview-plus/components/u-car-keyboard/u-car-keyboard.vue +2 -2
- package/uview-plus/components/u-card/u-card.vue +139 -3
- package/uview-plus/components/u-cell/_doc/changelog.md +6 -0
- package/uview-plus/components/u-cell/_doc/package.json +89 -0
- package/uview-plus/components/u-cell/_doc/readme.md +25 -0
- package/uview-plus/components/u-cell/u-cell.vue +4 -4
- package/uview-plus/components/u-cell-group/u-cell-group.vue +2 -2
- package/uview-plus/components/u-checkbox/_doc/changelog.md +8 -0
- package/uview-plus/components/u-checkbox/_doc/package.json +88 -0
- package/uview-plus/components/u-checkbox/_doc/readme.md +25 -0
- package/uview-plus/components/u-checkbox/u-checkbox.vue +4 -4
- package/uview-plus/components/u-checkbox-group/u-checkbox-group.vue +1 -1
- package/uview-plus/components/u-code/_doc/changelog.md +6 -0
- package/uview-plus/components/u-code/_doc/package.json +86 -0
- package/uview-plus/components/u-code/_doc/readme.md +16 -0
- package/uview-plus/components/u-code/u-code.vue +1 -1
- package/uview-plus/components/u-code-input/u-code-input.vue +1 -1
- package/uview-plus/components/u-col/u-col.vue +1 -1
- package/uview-plus/components/u-collapse/u-collapse.vue +2 -2
- package/uview-plus/components/u-collapse-item/u-collapse-item.vue +218 -3
- package/uview-plus/components/u-column-notice/u-column-notice.vue +3 -3
- package/uview-plus/components/u-count-down/u-count-down.vue +1 -1
- package/uview-plus/components/u-count-to/u-count-to.vue +1 -1
- package/uview-plus/components/u-datetime-picker/u-datetime-picker.vue +3 -3
- package/uview-plus/components/u-divider/u-divider.vue +3 -3
- package/uview-plus/components/u-drag-sort/_doc/changelog.md +0 -0
- package/uview-plus/components/u-drag-sort/_doc/package.json +85 -0
- package/uview-plus/components/u-drag-sort/_doc/readme.md +16 -0
- package/uview-plus/components/u-drag-sort/u-drag-sort.vue +3 -0
- package/uview-plus/components/u-dropdown/u-dropdown.vue +3 -3
- package/uview-plus/components/u-dropdown-item/u-dropdown-item.vue +1 -1
- package/uview-plus/components/u-empty/u-empty.vue +30 -4
- package/uview-plus/components/u-form-item/u-form-item.vue +4 -4
- package/uview-plus/components/u-gap/_doc/changelog.md +4 -0
- package/uview-plus/components/u-gap/_doc/package.json +86 -0
- package/uview-plus/components/u-gap/_doc/readme.md +22 -0
- package/uview-plus/components/u-gap/u-gap.vue +1 -1
- package/uview-plus/components/u-grid/u-grid.vue +1 -1
- package/uview-plus/components/u-grid-item/u-grid-item.vue +1 -1
- package/uview-plus/components/u-icon/_doc/changelog.md +10 -0
- package/uview-plus/components/u-icon/_doc/package.json +85 -0
- package/uview-plus/components/u-icon/_doc/readme.md +10 -0
- package/uview-plus/components/u-icon/icon.js +23 -25
- package/uview-plus/components/u-icon/icons.js +213 -213
- package/uview-plus/components/u-icon/style.css +3 -3
- package/uview-plus/components/u-icon/u-icon.vue +1 -1
- package/uview-plus/components/u-icon/u-icon2.vue +149 -0
- package/uview-plus/components/u-image/u-image.vue +5 -5
- package/uview-plus/components/u-image-wu/_doc/changelog.md +21 -0
- package/uview-plus/components/u-image-wu/_doc/package.json +88 -0
- package/uview-plus/components/u-image-wu/_doc/readme.md +11 -0
- package/uview-plus/components/u-image-wu/props.js +94 -0
- package/uview-plus/components/u-image-wu/u-image-wu.vue +243 -0
- package/uview-plus/components/u-index-anchor/u-index-anchor.vue +1 -1
- package/uview-plus/components/u-index-list/u-index-list.vue +2 -2
- package/uview-plus/components/u-input/_doc/changelog.md +6 -0
- package/uview-plus/components/u-input/_doc/package.json +88 -0
- package/uview-plus/components/u-input/_doc/readme.md +16 -0
- package/uview-plus/components/u-input/u-input.vue +4 -4
- package/uview-plus/components/u-keyboard/u-keyboard.vue +6 -6
- package/uview-plus/components/u-lazy-load/u-lazy-load.vue +257 -3
- package/uview-plus/components/u-line/_doc/changelog.md +8 -0
- package/uview-plus/components/u-line/_doc/package.json +86 -0
- package/uview-plus/components/u-line/_doc/readme.md +16 -0
- package/uview-plus/components/u-line/u-line.vue +1 -1
- package/uview-plus/components/u-line-progress/u-line-progress.vue +1 -1
- package/uview-plus/components/u-link/_doc/changelog.md +8 -0
- package/uview-plus/components/u-link/_doc/package.json +86 -0
- package/uview-plus/components/u-link/_doc/readme.md +20 -0
- package/uview-plus/components/u-link/u-link.vue +1 -1
- package/uview-plus/components/u-list/u-list.vue +1 -1
- package/uview-plus/components/u-list-item/u-list-item.vue +1 -1
- package/uview-plus/components/u-loading-icon/_doc/changelog.md +12 -0
- package/uview-plus/components/u-loading-icon/_doc/package.json +86 -0
- package/uview-plus/components/u-loading-icon/_doc/readme.md +16 -0
- package/uview-plus/components/u-loading-icon/props.js +1 -1
- package/uview-plus/components/u-loading-icon/u-loading-icon.vue +191 -3
- package/uview-plus/components/u-loading-page/u-loading-page.vue +4 -4
- package/uview-plus/components/u-loadmore/u-loadmore.vue +4 -4
- package/uview-plus/components/u-mask/u-mask.vue +120 -113
- package/uview-plus/components/u-message-input/u-message-input.vue +1 -1
- package/uview-plus/components/u-modal/u-modal.vue +6 -6
- package/uview-plus/components/u-navbar/_doc/changelog.md +6 -0
- package/uview-plus/components/u-navbar/_doc/package.json +89 -0
- package/uview-plus/components/u-navbar/_doc/readme.md +16 -0
- package/uview-plus/components/u-navbar/u-navbar.vue +4 -4
- package/uview-plus/components/u-navbar-mini/u-navbar-mini.vue +2 -2
- package/uview-plus/components/u-navbar-wu/props.js +102 -0
- package/uview-plus/components/u-navbar-wu/u-navbar-wu.vue +196 -0
- package/uview-plus/components/u-no-network/u-no-network.vue +5 -5
- package/uview-plus/components/u-notice-bar/u-notice-bar.vue +5 -5
- package/uview-plus/components/u-notify/u-notify.vue +6 -6
- package/uview-plus/components/u-number-box/_doc/changelog.md +19 -0
- package/uview-plus/components/u-number-box/_doc/package.json +88 -0
- package/uview-plus/components/u-number-box/_doc/readme.md +16 -0
- package/uview-plus/components/u-number-box/u-number-box.vue +9 -3
- package/uview-plus/components/u-number-keyboard/u-number-keyboard.vue +1 -1
- package/uview-plus/components/u-overlay/_doc/changelog.md +4 -0
- package/uview-plus/components/u-overlay/_doc/package.json +88 -0
- package/uview-plus/components/u-overlay/_doc/readme.md +16 -0
- package/uview-plus/components/u-overlay/u-overlay.vue +3 -3
- package/uview-plus/components/u-picker/u-picker.vue +5 -5
- package/uview-plus/components/u-popup/_doc/changelog.md +4 -0
- package/uview-plus/components/u-popup/_doc/package.json +92 -0
- package/uview-plus/components/u-popup/_doc/readme.md +16 -0
- package/uview-plus/components/u-popup/u-popup.vue +8 -8
- package/uview-plus/components/u-popup-wu/keypress.js +45 -0
- package/uview-plus/components/u-popup-wu/u-popup-wu.vue +519 -0
- package/uview-plus/components/u-radio/_doc/changelog.md +6 -0
- package/uview-plus/components/u-radio/_doc/package.json +88 -0
- package/uview-plus/components/u-radio/_doc/readme.md +25 -0
- package/uview-plus/components/u-radio/u-radio.vue +4 -4
- package/uview-plus/components/u-radio-group/u-radio-group.vue +1 -1
- package/uview-plus/components/u-rate/u-rate.vue +5 -5
- package/uview-plus/components/u-read-more/u-read-more.vue +126 -3
- package/uview-plus/components/u-row/_doc/changelog.md +8 -0
- package/uview-plus/components/u-row/_doc/package.json +86 -0
- package/uview-plus/components/u-row/_doc/readme.md +16 -0
- package/uview-plus/components/u-row/u-row.vue +1 -1
- package/uview-plus/components/u-row-notice/u-row-notice.vue +3 -3
- package/uview-plus/components/u-safe-bottom/_doc/changelog.md +6 -0
- package/uview-plus/components/u-safe-bottom/_doc/package.json +86 -0
- package/uview-plus/components/u-safe-bottom/_doc/readme.md +16 -0
- package/uview-plus/components/u-safe-bottom/u-safe-bottom.vue +48 -3
- package/uview-plus/components/u-search/u-search.vue +4 -4
- package/uview-plus/components/u-select/u-select.vue +175 -3
- package/uview-plus/components/u-skeleton/u-skeleton.vue +3 -3
- package/uview-plus/components/u-sku-wu/_doc/changelog.md +27 -0
- package/uview-plus/components/u-sku-wu/_doc/package.json +93 -0
- package/uview-plus/components/u-sku-wu/_doc/readme.md +16 -0
- package/uview-plus/components/u-sku-wu/props.js +86 -0
- package/uview-plus/components/u-sku-wu/style.css +271 -0
- package/uview-plus/components/u-sku-wu/u-sku-wu.vue +864 -0
- package/uview-plus/components/u-status-bar/_doc/changelog.md +4 -0
- package/uview-plus/components/u-status-bar/_doc/package.json +86 -0
- package/uview-plus/components/u-status-bar/_doc/readme.md +16 -0
- package/uview-plus/components/u-status-bar/u-status-bar.vue +1 -1
- package/uview-plus/components/u-steps/u-steps.vue +1 -1
- package/uview-plus/components/u-steps-item/u-steps-item.vue +7 -7
- package/uview-plus/components/u-sticky/u-sticky.vue +1 -1
- package/uview-plus/components/u-subsection/u-subsection.vue +1 -1
- package/uview-plus/components/u-swipe-action/u-swipe-action.vue +1 -1
- package/uview-plus/components/u-swipe-action-item/u-swipe-action-item.vue +3 -3
- package/uview-plus/components/u-swiper/u-swiper.vue +1 -1
- package/uview-plus/components/u-swiper-indicator/u-swiper-indicator.vue +1 -1
- package/uview-plus/components/u-switch/u-switch.vue +2 -2
- package/uview-plus/components/u-tabbar/u-tabbar.vue +2 -2
- package/uview-plus/components/u-tabbar-item/u-tabbar-item.vue +9 -4
- package/uview-plus/components/u-table/u-table.vue +1 -1
- package/uview-plus/components/u-tabs/u-tabs.vue +3 -3
- package/uview-plus/components/u-tag/u-tag.vue +5 -5
- package/uview-plus/components/u-text/_doc/changelog.md +10 -0
- package/uview-plus/components/u-text/_doc/package.json +89 -0
- package/uview-plus/components/u-text/_doc/readme.md +20 -0
- package/uview-plus/components/u-text/u-text.vue +159 -3
- package/uview-plus/components/u-textarea/_doc/changelog.md +6 -0
- package/uview-plus/components/u-textarea/_doc/package.json +86 -0
- package/uview-plus/components/u-textarea/_doc/readme.md +25 -0
- package/uview-plus/components/u-toast/u-toast.vue +8 -8
- package/uview-plus/components/u-tooltip/u-tooltip.vue +6 -6
- package/uview-plus/components/u-transition/_doc/changelog.md +14 -0
- package/uview-plus/components/u-transition/_doc/package.json +86 -0
- package/uview-plus/components/u-transition/_doc/readme.md +16 -0
- package/uview-plus/components/u-transition-wu/createAnimation.js +148 -0
- package/uview-plus/components/u-transition-wu/props.js +32 -0
- package/uview-plus/components/u-transition-wu/u-transition.vue +300 -0
- package/uview-plus/components/u-upload/u-upload.vue +10 -10
- package/uview-plus/components/u-verification-code/u-verification-code.vue +161 -0
- package/uview-plus/components/u-waterfall/u-waterfall.vue +221 -3
- package/uview-plus/index.js +109 -94
- package/uview-plus/libs/config/config.js +46 -48
- package/uview-plus/libs/css/color.scss +32 -311
- package/uview-plus/libs/css/components-wu.scss +30 -0
- package/uview-plus/libs/css/vue.scss +10 -10
- package/uview-plus/libs/ctocode/index.js +120 -0
- package/uview-plus/libs/function/calc.js +61 -55
- package/uview-plus/libs/function/color/color-convert/CHANGELOG.md +54 -0
- package/uview-plus/libs/function/color/color-convert/LICENSE +21 -0
- package/uview-plus/libs/function/color/color-convert/README.md +68 -0
- package/uview-plus/libs/function/color/color-convert/conversions.js +839 -0
- package/uview-plus/libs/function/color/color-convert/index.js +81 -0
- package/uview-plus/libs/function/color/color-convert/package.json +48 -0
- package/uview-plus/libs/function/color/color-convert/route.js +97 -0
- package/uview-plus/libs/function/color/color-name/LICENSE +8 -0
- package/uview-plus/libs/function/color/color-name/README.md +11 -0
- package/uview-plus/libs/function/color/color-name/index.js +152 -0
- package/uview-plus/libs/function/color/color-name/package.json +28 -0
- package/uview-plus/libs/function/color/color-string/LICENSE +21 -0
- package/uview-plus/libs/function/color/color-string/README.md +62 -0
- package/uview-plus/libs/function/color/color-string/index.js +244 -0
- package/uview-plus/libs/function/color/color-string/package.json +39 -0
- package/uview-plus/libs/function/color/color.js +496 -0
- package/uview-plus/libs/function/color/index.js +158 -0
- package/uview-plus/libs/function/color/is-arrayish/LICENSE +21 -0
- package/uview-plus/libs/function/color/is-arrayish/README.md +16 -0
- package/uview-plus/libs/function/color/is-arrayish/index.js +9 -0
- package/uview-plus/libs/function/color/is-arrayish/package.json +45 -0
- package/uview-plus/libs/function/color/is-arrayish/yarn-error.log +1443 -0
- package/uview-plus/libs/function/color/simple-swizzle/LICENSE +21 -0
- package/uview-plus/libs/function/color/simple-swizzle/README.md +39 -0
- package/uview-plus/libs/function/color/simple-swizzle/index.js +29 -0
- package/uview-plus/libs/function/color/simple-swizzle/package.json +36 -0
- package/uview-plus/libs/function/colorGradient.js +108 -106
- package/uview-plus/libs/function/debounce.js +17 -17
- package/uview-plus/libs/function/digit.js +1 -3
- package/uview-plus/libs/function/http.js +3 -3
- package/uview-plus/libs/function/index-wu.js +198 -0
- package/uview-plus/libs/function/index.js +579 -566
- package/uview-plus/libs/function/platform.js +18 -18
- package/uview-plus/libs/function/test.js +135 -137
- package/uview-plus/libs/function/throttle.js +17 -17
- package/uview-plus/libs/luch-request/core/Request.js +199 -199
- package/uview-plus/libs/mixin/mpMixin.js +1 -0
- package/uview-plus/libs/mixin/openType.js +33 -0
- package/uview-plus/libs/util/async-validator.js +1343 -1343
- package/uview-plus/libs/util/dayjs.js +404 -0
- package/uview-plus/libs/util/route.js +101 -105
- package/uview-plus/package-wu-tool.json +84 -0
- package/uview-plus/package-wu.json +112 -0
- package/uview-plus/package.json +106 -95
- package/uview-plus/readme-wu.md +148 -0
- package/uview-ui/index.js +51 -52
- package/plugins/uni-upgrade.js +0 -294
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-code-wrap">
|
|
3
|
+
<!-- 此组件功能由js完成,无需写html逻辑 -->
|
|
4
|
+
</view>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
/**
|
|
9
|
+
* verificationCode 验证码输入框
|
|
10
|
+
* @description 考虑到用户实际发送验证码的场景,可能是一个按钮,也可能是一段文字,提示语各有不同,所以本组件 不提供界面显示,只提供提示语,由用户将提示语嵌入到具体的场景
|
|
11
|
+
* @tutorial https://www.uviewui.com/components/verificationCode.html
|
|
12
|
+
* @property {Number String} seconds 倒计时所需的秒数(默认60)
|
|
13
|
+
* @property {String} start-text 开始前的提示语,见官网说明(默认获取验证码)
|
|
14
|
+
* @property {String} change-text 倒计时期间的提示语,必须带有字母"x",见官网说明(默认X秒重新获取)
|
|
15
|
+
* @property {String} end-text 倒计结束的提示语,见官网说明(默认重新获取)
|
|
16
|
+
* @property {Boolean} keep-running 是否在H5刷新或各端返回再进入时继续倒计时(默认false)
|
|
17
|
+
* @event {Function} change 倒计时期间,每秒触发一次
|
|
18
|
+
* @event {Function} start 开始倒计时触发
|
|
19
|
+
* @event {Function} end 结束倒计时触发
|
|
20
|
+
* @example <up-verification-code :seconds="seconds" @end="end" @start="start" ref="uCode"
|
|
21
|
+
*/
|
|
22
|
+
export default {
|
|
23
|
+
name: 'up-verification-code',
|
|
24
|
+
props: {
|
|
25
|
+
// 倒计时总秒数
|
|
26
|
+
seconds: {
|
|
27
|
+
type: [String, Number],
|
|
28
|
+
default: 60
|
|
29
|
+
},
|
|
30
|
+
// 尚未开始时提示
|
|
31
|
+
startText: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: '获取验证码'
|
|
34
|
+
},
|
|
35
|
+
// 正在倒计时中的提示
|
|
36
|
+
changeText: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'X秒重新获取'
|
|
39
|
+
},
|
|
40
|
+
// 倒计时结束时的提示
|
|
41
|
+
endText: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '重新获取'
|
|
44
|
+
},
|
|
45
|
+
// 是否在H5刷新或各端返回再进入时继续倒计时
|
|
46
|
+
keepRunning: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: false
|
|
49
|
+
},
|
|
50
|
+
// 为了区分多个页面,或者一个页面多个倒计时组件本地存储的继续倒计时变了
|
|
51
|
+
uniqueKey: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: ''
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
data() {
|
|
57
|
+
return {
|
|
58
|
+
secNum: this.seconds,
|
|
59
|
+
timer: null,
|
|
60
|
+
canGetCode: true // 是否可以执行验证码操作
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
mounted() {
|
|
64
|
+
this.checkKeepRunning();
|
|
65
|
+
},
|
|
66
|
+
watch: {
|
|
67
|
+
seconds: {
|
|
68
|
+
immediate: true,
|
|
69
|
+
handler(n) {
|
|
70
|
+
this.secNum = n;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
methods: {
|
|
75
|
+
checkKeepRunning() {
|
|
76
|
+
// 获取上一次退出页面(H5还包括刷新)时的时间戳,如果没有上次的保存,此值可能为空
|
|
77
|
+
let lastTimestamp = Number(uni.getStorageSync(this.uniqueKey + '_$uCountDownTimestamp'));
|
|
78
|
+
if (!lastTimestamp) return this.changeEvent(this.startText);
|
|
79
|
+
// 当前秒的时间戳
|
|
80
|
+
let nowTimestamp = Math.floor(+new Date() / 1000);
|
|
81
|
+
// 判断当前的时间戳,是否小于上一次的本该按设定结束,却提前结束的时间戳
|
|
82
|
+
if (this.keepRunning && lastTimestamp && lastTimestamp > nowTimestamp) {
|
|
83
|
+
// 剩余尚未执行完的倒计秒数
|
|
84
|
+
this.secNum = lastTimestamp - nowTimestamp;
|
|
85
|
+
// 清除本地保存的变量
|
|
86
|
+
uni.removeStorageSync(this.uniqueKey + '_$uCountDownTimestamp');
|
|
87
|
+
// 开始倒计时
|
|
88
|
+
this.start();
|
|
89
|
+
} else {
|
|
90
|
+
// 如果不存在需要继续上一次的倒计时,执行正常的逻辑
|
|
91
|
+
this.changeEvent(this.startText);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
// 开始倒计时
|
|
95
|
+
start() {
|
|
96
|
+
// 防止快速点击获取验证码的按钮而导致内部产生多个定时器导致混乱
|
|
97
|
+
if (this.timer) {
|
|
98
|
+
clearInterval(this.timer);
|
|
99
|
+
this.timer = null;
|
|
100
|
+
}
|
|
101
|
+
this.$emit('start');
|
|
102
|
+
this.canGetCode = false;
|
|
103
|
+
// 这里放这句,是为了一开始时就提示,否则要等setInterval的1秒后才会有提示
|
|
104
|
+
this.changeEvent(this.changeText.replace(/x|X/, this.secNum));
|
|
105
|
+
this.setTimeToStorage();
|
|
106
|
+
this.timer = setInterval(() => {
|
|
107
|
+
if (--this.secNum) {
|
|
108
|
+
// 用当前倒计时的秒数替换提示字符串中的"x"字母
|
|
109
|
+
this.changeEvent(this.changeText.replace(/x|X/, this.secNum));
|
|
110
|
+
} else {
|
|
111
|
+
clearInterval(this.timer);
|
|
112
|
+
this.timer = null;
|
|
113
|
+
this.changeEvent(this.endText);
|
|
114
|
+
this.secNum = this.seconds;
|
|
115
|
+
this.$emit('end');
|
|
116
|
+
this.canGetCode = true;
|
|
117
|
+
}
|
|
118
|
+
}, 1000);
|
|
119
|
+
},
|
|
120
|
+
// 重置,可以让用户再次获取验证码
|
|
121
|
+
reset() {
|
|
122
|
+
this.canGetCode = true;
|
|
123
|
+
clearInterval(this.timer);
|
|
124
|
+
this.secNum = this.seconds;
|
|
125
|
+
this.changeEvent(this.endText);
|
|
126
|
+
},
|
|
127
|
+
changeEvent(text) {
|
|
128
|
+
this.$emit('change', text);
|
|
129
|
+
},
|
|
130
|
+
// 保存时间戳,为了防止倒计时尚未结束,H5刷新或者各端的右上角返回上一页再进来
|
|
131
|
+
setTimeToStorage() {
|
|
132
|
+
if (!this.keepRunning || !this.timer) return;
|
|
133
|
+
// 记录当前的时间戳,为了下次进入页面,如果还在倒计时内的话,继续倒计时
|
|
134
|
+
// 倒计时尚未结束,结果大于0;倒计时已经开始,就会小于初始值,如果等于初始值,说明没有开始倒计时,无需处理
|
|
135
|
+
if (this.secNum > 0 && this.secNum <= this.seconds) {
|
|
136
|
+
// 获取当前时间戳(+ new Date()为特殊写法),除以1000变成秒,再去除小数部分
|
|
137
|
+
let nowTimestamp = Math.floor(+new Date() / 1000);
|
|
138
|
+
// 将本该结束时候的时间戳保存起来 => 当前时间戳 + 剩余的秒数
|
|
139
|
+
uni.setStorage({
|
|
140
|
+
key: this.uniqueKey + '_$uCountDownTimestamp',
|
|
141
|
+
data: nowTimestamp + Number(this.secNum)
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
// 组件销毁的时候,清除定时器,否则定时器会继续存在,系统不会自动清除
|
|
147
|
+
beforeDestroy() {
|
|
148
|
+
this.setTimeToStorage();
|
|
149
|
+
clearTimeout(this.timer);
|
|
150
|
+
this.timer = null;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
</script>
|
|
154
|
+
<style scoped>
|
|
155
|
+
.u-code-wrap {
|
|
156
|
+
width: 0;
|
|
157
|
+
height: 0;
|
|
158
|
+
position: fixed;
|
|
159
|
+
z-index: -1;
|
|
160
|
+
}
|
|
161
|
+
</style>
|
|
@@ -1,3 +1,221 @@
|
|
|
1
|
-
<template>
|
|
2
1
|
<view class="u-waterfall">
|
|
3
2
|
<view ref="u-left-column" id="u-left-column" class="u-column">
|
|
4
3
|
<slot name="left" :leftList="leftList"></slot>
|
|
5
4
|
</view>
|
|
6
5
|
<view ref="u-right-column" id="u-right-column" class="u-column">
|
|
7
6
|
<slot name="right" :rightList="rightList"></slot>
|
|
8
7
|
</view>
|
|
9
8
|
</view>
|
|
10
9
|
* waterfall 瀑布流
|
|
11
10
|
* @description 这是一个瀑布流形式的组件,内容分为左右两列,结合uview的懒加载组件效果更佳。相较于某些只是奇偶数左右分别,或者没有利用vue作用域插槽的做法,uview的瀑布流实现了真正的 组件化,搭配LazyLoad 懒加载和loadMore 加载更多组件,让您开箱即用,眼前一亮。
|
|
12
11
|
* @tutorial https://uview-plus.jiangruyi.com/components/waterfall.html
|
|
13
12
|
* @property {Array} flow-list 用于渲染的数据
|
|
14
13
|
* @property {String Number} add-time 单条数据添加到队列的时间间隔,单位ms,见上方注意事项说明(默认200)
|
|
15
14
|
* @example <u-waterfall :flowList="flowList"></u-waterfall>
|
|
16
15
|
*/
|
|
17
16
|
name: 'u-waterfall',
|
|
18
17
|
props: {
|
|
19
18
|
// #ifdef VUE2
|
|
20
19
|
value: {
|
|
21
20
|
// 瀑布流数据
|
|
22
21
|
type: Array,
|
|
23
22
|
required: true,
|
|
24
23
|
default: function () {
|
|
25
24
|
return [];
|
|
26
25
|
}
|
|
27
26
|
},
|
|
28
27
|
// #endif
|
|
29
28
|
// #ifdef VUE3
|
|
30
29
|
modelValue: {
|
|
31
30
|
// 瀑布流数据
|
|
32
31
|
type: Array,
|
|
33
32
|
required: true,
|
|
34
33
|
default: function () {
|
|
35
34
|
return [];
|
|
36
35
|
}
|
|
37
36
|
},
|
|
38
37
|
// #endif
|
|
39
38
|
// 每次向结构插入数据的时间间隔,间隔越长,越能保证两列高度相近,但是对用户体验越不好
|
|
40
39
|
// 单位ms
|
|
41
40
|
addTime: {
|
|
42
41
|
type: [Number, String],
|
|
43
42
|
default: 200
|
|
44
43
|
},
|
|
45
44
|
// id值,用于清除某一条数据时,根据此idKey名称找到并移除,如数据为{idx: 22, name: 'lisa'}
|
|
46
45
|
// 那么该把idKey设置为idx
|
|
47
46
|
idKey: {
|
|
48
47
|
type: String,
|
|
49
48
|
default: 'id'
|
|
50
49
|
}
|
|
51
50
|
},
|
|
52
51
|
mixins: [mpMixin, mixin],
|
|
53
52
|
data() {
|
|
54
53
|
return {
|
|
55
54
|
leftList: [],
|
|
56
55
|
rightList: [],
|
|
57
56
|
tempList: [],
|
|
58
57
|
children: []
|
|
59
58
|
};
|
|
60
59
|
},
|
|
61
60
|
watch: {
|
|
62
61
|
copyFlowList(nVal, oVal) {
|
|
63
62
|
if (!nVal || nVal.length == 0) {
|
|
64
63
|
this.clear(false);
|
|
65
64
|
// console.log('clear');
|
|
66
65
|
} else {
|
|
67
66
|
// 取差值,即这一次数组变化新增的部分
|
|
68
67
|
let startIndex = Array.isArray(oVal) && oVal.length > 0 ? oVal.length : 0;
|
|
69
68
|
// 拼接上原有数据
|
|
70
69
|
this.tempList = this.tempList.concat(this.cloneData(nVal.slice(startIndex)));
|
|
71
70
|
this.splitData();
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
73
|
},
|
|
75
74
|
mounted() {
|
|
76
75
|
this.tempList = this.cloneData(this.copyFlowList);
|
|
77
76
|
this.splitData();
|
|
78
77
|
},
|
|
79
78
|
computed: {
|
|
80
79
|
// 破坏flowList变量的引用,否则watch的结果新旧值是一样的
|
|
81
80
|
copyFlowList() {
|
|
82
81
|
// #ifdef VUE3
|
|
83
82
|
if (!this.modelValue || this.modelValue.length == 0) {
|
|
84
83
|
this.clear(false);
|
|
85
84
|
// console.log('clear');
|
|
86
85
|
return [];
|
|
87
86
|
} else {
|
|
88
87
|
return this.cloneData(this.modelValue);
|
|
89
88
|
}
|
|
90
89
|
// #endif
|
|
91
90
|
// #ifdef VUE2
|
|
92
91
|
return this.cloneData(this.value);
|
|
93
92
|
// #endif
|
|
94
93
|
}
|
|
95
94
|
},
|
|
96
95
|
emits: ['update:modelValue'],
|
|
97
96
|
methods: {
|
|
98
97
|
async splitData() {
|
|
99
98
|
if (!this.tempList.length) return;
|
|
100
99
|
let leftRect = await this.$uGetRect('#u-left-column');
|
|
101
100
|
let rightRect = await this.$uGetRect('#u-right-column');
|
|
102
101
|
// 如果左边小于或等于右边,就添加到左边,否则添加到右边
|
|
103
102
|
let item = this.tempList[0];
|
|
104
103
|
// 解决多次快速上拉后,可能数据会乱的问题,因为经过上面的两个await节点查询阻塞一定时间,加上后面的定时器干扰
|
|
105
104
|
// 数组可能变成[],导致此item值可能为undefined
|
|
106
105
|
if (!item) return;
|
|
107
106
|
if (leftRect.height < rightRect.height) {
|
|
108
107
|
this.leftList.push(item);
|
|
109
108
|
} else if (leftRect.height > rightRect.height) {
|
|
110
109
|
this.rightList.push(item);
|
|
111
110
|
} else {
|
|
112
111
|
// 这里是为了保证第一和第二张添加时,左右都能有内容
|
|
113
112
|
// 因为添加第一张,实际队列的高度可能还是0,这时需要根据队列元素长度判断下一个该放哪边
|
|
114
113
|
if (this.leftList.length <= this.rightList.length) {
|
|
115
114
|
this.leftList.push(item);
|
|
116
115
|
} else {
|
|
117
116
|
this.rightList.push(item);
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
// 移除临时列表的第一项
|
|
121
120
|
this.tempList.splice(0, 1);
|
|
122
121
|
// 如果临时数组还有数据,继续循环
|
|
123
122
|
if (this.tempList.length) {
|
|
124
123
|
setTimeout(() => {
|
|
125
124
|
this.splitData();
|
|
126
125
|
}, this.addTime);
|
|
127
126
|
}
|
|
128
127
|
},
|
|
129
128
|
// 复制而不是引用对象和数组
|
|
130
129
|
cloneData(data) {
|
|
131
130
|
return JSON.parse(JSON.stringify(data));
|
|
132
131
|
},
|
|
133
132
|
// 清空数据列表
|
|
134
133
|
clear(bak = true) {
|
|
135
134
|
this.leftList = [];
|
|
136
135
|
this.rightList = [];
|
|
137
136
|
// 同时清除父组件列表中的数据
|
|
138
137
|
if (bak) {
|
|
139
138
|
// #ifdef VUE2
|
|
140
139
|
this.$emit('input', []);
|
|
141
140
|
// #endif
|
|
142
141
|
// #ifdef VUE3
|
|
143
142
|
this.$emit('update:modelValue', []);
|
|
144
143
|
// #endif
|
|
145
144
|
}
|
|
146
145
|
this.tempList = [];
|
|
147
146
|
},
|
|
148
147
|
// 清除某一条指定的数据,根据id实现
|
|
149
148
|
remove(id) {
|
|
150
149
|
// 如果findIndex找不到合适的条件,就会返回-1
|
|
151
150
|
let index = -1;
|
|
152
151
|
index = this.leftList.findIndex((val) => val[this.idKey] == id);
|
|
153
152
|
if (index != -1) {
|
|
154
153
|
// 如果index不等于-1,说明已经找到了要找的id,根据index索引删除这一条数据
|
|
155
154
|
this.leftList.splice(index, 1);
|
|
156
155
|
} else {
|
|
157
156
|
// 同理于上方面的方法
|
|
158
157
|
index = this.rightList.findIndex((val) => val[this.idKey] == id);
|
|
159
158
|
if (index != -1) this.rightList.splice(index, 1);
|
|
160
159
|
}
|
|
161
160
|
// 同时清除父组件的数据中的对应id的条目
|
|
162
161
|
// #ifdef VUE2
|
|
163
162
|
index = this.value.findIndex((val) => val[this.idKey] == id);
|
|
164
163
|
if (index != -1) this.$emit('input', this.value.splice(index, 1));
|
|
165
164
|
// #endif
|
|
166
165
|
// #ifdef VUE3
|
|
167
166
|
index = this.modelValue.findIndex((val) => val[this.idKey] == id);
|
|
168
167
|
if (index != -1) this.$emit('update:modelValue', this.modelValue.splice(index, 1));
|
|
169
168
|
// #endif
|
|
170
169
|
},
|
|
171
170
|
// 修改某条数据的某个属性
|
|
172
171
|
modify(id, key, value) {
|
|
173
172
|
// 如果findIndex找不到合适的条件,就会返回-1
|
|
174
173
|
let index = -1;
|
|
175
174
|
index = this.leftList.findIndex((val) => val[this.idKey] == id);
|
|
176
175
|
if (index != -1) {
|
|
177
176
|
// 如果index不等于-1,说明已经找到了要找的id,修改对应key的值
|
|
178
177
|
this.leftList[index][key] = value;
|
|
179
178
|
} else {
|
|
180
179
|
// 同理于上方面的方法
|
|
181
180
|
index = this.rightList.findIndex((val) => val[this.idKey] == id);
|
|
182
181
|
if (index != -1) this.rightList[index][key] = value;
|
|
183
182
|
}
|
|
184
183
|
// 修改父组件的数据中的对应id的条目
|
|
185
184
|
// #ifdef VUE2
|
|
186
185
|
index = this.value.findIndex((val) => val[this.idKey] == id);
|
|
187
186
|
// #endif
|
|
188
187
|
// #ifdef VUE3
|
|
189
188
|
index = this.modelValue.findIndex((val) => val[this.idKey] == id);
|
|
190
189
|
// #endif
|
|
191
190
|
if (index != -1) {
|
|
192
191
|
// 首先复制一份value的数据
|
|
193
192
|
// #ifdef VUE2
|
|
194
193
|
let data = this.cloneData(this.value);
|
|
195
194
|
// #endif
|
|
196
195
|
// #ifdef VUE3
|
|
197
196
|
let data = this.cloneData(this.modelValue);
|
|
198
197
|
// #endif
|
|
199
198
|
// 修改对应索引的key属性的值为value
|
|
200
199
|
data[index][key] = value;
|
|
201
200
|
// 修改父组件通过v-model绑定的变量的值
|
|
202
201
|
// #ifdef VUE2
|
|
203
202
|
this.$emit('input', data);
|
|
204
203
|
// #endif
|
|
205
204
|
// #ifdef VUE3
|
|
206
205
|
this.$emit('update:modelValue', data);
|
|
207
206
|
// #endif
|
|
208
207
|
}
|
|
209
208
|
}
|
|
210
209
|
}
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
<template>
|
|
211
|
+
<view class="u-waterfall">
|
|
212
|
+
<view ref="u-left-column" id="u-left-column" class="u-column">
|
|
213
|
+
<slot name="left" :leftList="leftList"></slot>
|
|
214
|
+
</view>
|
|
215
|
+
<view ref="u-right-column" id="u-right-column" class="u-column">
|
|
216
|
+
<slot name="right" :rightList="rightList"></slot>
|
|
217
|
+
</view>
|
|
218
|
+
</view>
|
|
219
|
+
</template>
|
|
220
|
+
<script>
|
|
221
|
+
/**
|
|
222
|
+
* waterfall 瀑布流
|
|
223
|
+
* @description 这是一个瀑布流形式的组件,内容分为左右两列,结合uview的懒加载组件效果更佳。相较于某些只是奇偶数左右分别,或者没有利用vue作用域插槽的做法,uview的瀑布流实现了真正的 组件化,搭配LazyLoad 懒加载和loadMore 加载更多组件,让您开箱即用,眼前一亮。
|
|
224
|
+
* @tutorial https://uview-plus.jiangruyi.com/components/waterfall.html
|
|
225
|
+
* @property {Array} flow-list 用于渲染的数据
|
|
226
|
+
* @property {String Number} add-time 单条数据添加到队列的时间间隔,单位ms,见上方注意事项说明(默认200)
|
|
227
|
+
* @example <up-waterfall :flowList="flowList"></up-waterfall>
|
|
228
|
+
*/
|
|
229
|
+
import { mpMixin } from '../../libs/mixin/mpMixin';
|
|
230
|
+
import { mixin } from '../../libs/mixin/mixin';
|
|
231
|
+
export default {
|
|
232
|
+
name: 'u-waterfall',
|
|
233
|
+
props: {
|
|
234
|
+
// #ifdef VUE2
|
|
235
|
+
value: {
|
|
236
|
+
// 瀑布流数据
|
|
237
|
+
type: Array,
|
|
238
|
+
required: true,
|
|
239
|
+
default: function () {
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
// #endif
|
|
244
|
+
// #ifdef VUE3
|
|
245
|
+
modelValue: {
|
|
246
|
+
// 瀑布流数据
|
|
247
|
+
type: Array,
|
|
248
|
+
required: true,
|
|
249
|
+
default: function () {
|
|
250
|
+
return [];
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
// #endif
|
|
254
|
+
// 每次向结构插入数据的时间间隔,间隔越长,越能保证两列高度相近,但是对用户体验越不好
|
|
255
|
+
// 单位ms
|
|
256
|
+
addTime: {
|
|
257
|
+
type: [Number, String],
|
|
258
|
+
default: 200
|
|
259
|
+
},
|
|
260
|
+
// id值,用于清除某一条数据时,根据此idKey名称找到并移除,如数据为{idx: 22, name: 'lisa'}
|
|
261
|
+
// 那么该把idKey设置为idx
|
|
262
|
+
idKey: {
|
|
263
|
+
type: String,
|
|
264
|
+
default: 'id'
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
mixins: [mpMixin, mixin],
|
|
268
|
+
data() {
|
|
269
|
+
return {
|
|
270
|
+
leftList: [],
|
|
271
|
+
rightList: [],
|
|
272
|
+
tempList: [],
|
|
273
|
+
children: []
|
|
274
|
+
};
|
|
275
|
+
},
|
|
276
|
+
watch: {
|
|
277
|
+
copyFlowList(nVal, oVal) {
|
|
278
|
+
if (!nVal || nVal.length == 0) {
|
|
279
|
+
this.clear(false);
|
|
280
|
+
// console.log('clear');
|
|
281
|
+
} else {
|
|
282
|
+
// 取差值,即这一次数组变化新增的部分
|
|
283
|
+
let startIndex = Array.isArray(oVal) && oVal.length > 0 ? oVal.length : 0;
|
|
284
|
+
// 拼接上原有数据
|
|
285
|
+
this.tempList = this.tempList.concat(this.cloneData(nVal.slice(startIndex)));
|
|
286
|
+
this.splitData();
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
mounted() {
|
|
291
|
+
this.tempList = this.cloneData(this.copyFlowList);
|
|
292
|
+
this.splitData();
|
|
293
|
+
},
|
|
294
|
+
computed: {
|
|
295
|
+
// 破坏flowList变量的引用,否则watch的结果新旧值是一样的
|
|
296
|
+
copyFlowList() {
|
|
297
|
+
// #ifdef VUE3
|
|
298
|
+
if (!this.modelValue || this.modelValue.length == 0) {
|
|
299
|
+
this.clear(false);
|
|
300
|
+
// console.log('clear');
|
|
301
|
+
return [];
|
|
302
|
+
} else {
|
|
303
|
+
return this.cloneData(this.modelValue);
|
|
304
|
+
}
|
|
305
|
+
// #endif
|
|
306
|
+
// #ifdef VUE2
|
|
307
|
+
return this.cloneData(this.value);
|
|
308
|
+
// #endif
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
emits: ['update:modelValue'],
|
|
312
|
+
methods: {
|
|
313
|
+
async splitData() {
|
|
314
|
+
if (!this.tempList.length) return;
|
|
315
|
+
let leftRect = await this.$uGetRect('#u-left-column');
|
|
316
|
+
let rightRect = await this.$uGetRect('#u-right-column');
|
|
317
|
+
// 如果左边小于或等于右边,就添加到左边,否则添加到右边
|
|
318
|
+
let item = this.tempList[0];
|
|
319
|
+
// 解决多次快速上拉后,可能数据会乱的问题,因为经过上面的两个await节点查询阻塞一定时间,加上后面的定时器干扰
|
|
320
|
+
// 数组可能变成[],导致此item值可能为undefined
|
|
321
|
+
if (!item) return;
|
|
322
|
+
if (leftRect.height < rightRect.height) {
|
|
323
|
+
this.leftList.push(item);
|
|
324
|
+
} else if (leftRect.height > rightRect.height) {
|
|
325
|
+
this.rightList.push(item);
|
|
326
|
+
} else {
|
|
327
|
+
// 这里是为了保证第一和第二张添加时,左右都能有内容
|
|
328
|
+
// 因为添加第一张,实际队列的高度可能还是0,这时需要根据队列元素长度判断下一个该放哪边
|
|
329
|
+
if (this.leftList.length <= this.rightList.length) {
|
|
330
|
+
this.leftList.push(item);
|
|
331
|
+
} else {
|
|
332
|
+
this.rightList.push(item);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
// 移除临时列表的第一项
|
|
336
|
+
this.tempList.splice(0, 1);
|
|
337
|
+
// 如果临时数组还有数据,继续循环
|
|
338
|
+
if (this.tempList.length) {
|
|
339
|
+
setTimeout(() => {
|
|
340
|
+
this.splitData();
|
|
341
|
+
}, this.addTime);
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
// 复制而不是引用对象和数组
|
|
345
|
+
cloneData(data) {
|
|
346
|
+
return JSON.parse(JSON.stringify(data));
|
|
347
|
+
},
|
|
348
|
+
// 清空数据列表
|
|
349
|
+
clear(bak = true) {
|
|
350
|
+
this.leftList = [];
|
|
351
|
+
this.rightList = [];
|
|
352
|
+
// 同时清除父组件列表中的数据
|
|
353
|
+
if (bak) {
|
|
354
|
+
// #ifdef VUE2
|
|
355
|
+
this.$emit('input', []);
|
|
356
|
+
// #endif
|
|
357
|
+
// #ifdef VUE3
|
|
358
|
+
this.$emit('update:modelValue', []);
|
|
359
|
+
// #endif
|
|
360
|
+
}
|
|
361
|
+
this.tempList = [];
|
|
362
|
+
},
|
|
363
|
+
// 清除某一条指定的数据,根据id实现
|
|
364
|
+
remove(id) {
|
|
365
|
+
// 如果findIndex找不到合适的条件,就会返回-1
|
|
366
|
+
let index = -1;
|
|
367
|
+
index = this.leftList.findIndex((val) => val[this.idKey] == id);
|
|
368
|
+
if (index != -1) {
|
|
369
|
+
// 如果index不等于-1,说明已经找到了要找的id,根据index索引删除这一条数据
|
|
370
|
+
this.leftList.splice(index, 1);
|
|
371
|
+
} else {
|
|
372
|
+
// 同理于上方面的方法
|
|
373
|
+
index = this.rightList.findIndex((val) => val[this.idKey] == id);
|
|
374
|
+
if (index != -1) this.rightList.splice(index, 1);
|
|
375
|
+
}
|
|
376
|
+
// 同时清除父组件的数据中的对应id的条目
|
|
377
|
+
// #ifdef VUE2
|
|
378
|
+
index = this.value.findIndex((val) => val[this.idKey] == id);
|
|
379
|
+
if (index != -1) this.$emit('input', this.value.splice(index, 1));
|
|
380
|
+
// #endif
|
|
381
|
+
// #ifdef VUE3
|
|
382
|
+
index = this.modelValue.findIndex((val) => val[this.idKey] == id);
|
|
383
|
+
if (index != -1) this.$emit('update:modelValue', this.modelValue.splice(index, 1));
|
|
384
|
+
// #endif
|
|
385
|
+
},
|
|
386
|
+
// 修改某条数据的某个属性
|
|
387
|
+
modify(id, key, value) {
|
|
388
|
+
// 如果findIndex找不到合适的条件,就会返回-1
|
|
389
|
+
let index = -1;
|
|
390
|
+
index = this.leftList.findIndex((val) => val[this.idKey] == id);
|
|
391
|
+
if (index != -1) {
|
|
392
|
+
// 如果index不等于-1,说明已经找到了要找的id,修改对应key的值
|
|
393
|
+
this.leftList[index][key] = value;
|
|
394
|
+
} else {
|
|
395
|
+
// 同理于上方面的方法
|
|
396
|
+
index = this.rightList.findIndex((val) => val[this.idKey] == id);
|
|
397
|
+
if (index != -1) this.rightList[index][key] = value;
|
|
398
|
+
}
|
|
399
|
+
// 修改父组件的数据中的对应id的条目
|
|
400
|
+
// #ifdef VUE2
|
|
401
|
+
index = this.value.findIndex((val) => val[this.idKey] == id);
|
|
402
|
+
// #endif
|
|
403
|
+
// #ifdef VUE3
|
|
404
|
+
index = this.modelValue.findIndex((val) => val[this.idKey] == id);
|
|
405
|
+
// #endif
|
|
406
|
+
if (index != -1) {
|
|
407
|
+
// 首先复制一份value的数据
|
|
408
|
+
// #ifdef VUE2
|
|
409
|
+
let data = this.cloneData(this.value);
|
|
410
|
+
// #endif
|
|
411
|
+
// #ifdef VUE3
|
|
412
|
+
let data = this.cloneData(this.modelValue);
|
|
413
|
+
// #endif
|
|
414
|
+
// 修改对应索引的key属性的值为value
|
|
415
|
+
data[index][key] = value;
|
|
416
|
+
// 修改父组件通过v-model绑定的变量的值
|
|
417
|
+
// #ifdef VUE2
|
|
418
|
+
this.$emit('input', data);
|
|
419
|
+
// #endif
|
|
420
|
+
// #ifdef VUE3
|
|
421
|
+
this.$emit('update:modelValue', data);
|
|
422
|
+
// #endif
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
</script>
|
|
428
|
+
<style scoped>
|
|
429
|
+
@import './style.css';
|
|
430
|
+
</style>
|