@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,864 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="u-sku" v-if="showSkuPopup" :class="skuPopupStyleShow ? 'show' : 'hide'" @click="isMaskClose ? close() : ''">
|
|
3
|
+
<view class="shopSpecsPopup" :class="shopSpecsPopupStyleShow ? 'show' : 'hide'" @click.stop>
|
|
4
|
+
<image
|
|
5
|
+
class="close"
|
|
6
|
+
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAABvhJREFUWEe1WX2MHVUV/507rxtcEXhRsWuUQNRKrFDUtJoWBayKWII2qSUSMV33zZypu6mK8ocR8ClqotFKgu6be7fbWrGGrpGIGgtqQIMUQT4KGGoTqzUQum6R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Ecf2MhA6kFAUx3FxEaGxtbG8fxev1XRNIenQHgtCTRzwB4gYiei+P4KWPMz5YsWbKnbC7T7av+D4gb+BxnKYJwAAAAAElFTkSuQmCC"
|
|
7
|
+
@click="close"
|
|
8
|
+
></image>
|
|
9
|
+
<view class="content">
|
|
10
|
+
<view class="info">
|
|
11
|
+
<image v-if="!isUseImgSku" class="cover" :src="selectSku.logo || defaultCover" mode=""></image>
|
|
12
|
+
<view class="right t-w" :class="{ useImgSku: isUseImgSku }">
|
|
13
|
+
<view class="price">
|
|
14
|
+
<text class="uity" :style="{ color: themeRGB }">¥</text>
|
|
15
|
+
<text class="value" :style="{ color: themeRGB }">
|
|
16
|
+
{{ selectSku.id !== undefined ? selectSku.price : `${showAreaPrice[0]}-${showAreaPrice[1]}` }}
|
|
17
|
+
</text>
|
|
18
|
+
</view>
|
|
19
|
+
<text class="stock" v-if="showStockNum">
|
|
20
|
+
库存: {{ selectSku.id !== undefined ? selectSku.stock : `${showAreaStock[0]}-${showAreaStock[1]}` }}
|
|
21
|
+
</text>
|
|
22
|
+
<text class="actSkuStr">
|
|
23
|
+
{{ getSelectedSkuAttrStr }}
|
|
24
|
+
</text>
|
|
25
|
+
</view>
|
|
26
|
+
</view>
|
|
27
|
+
<view class="number">
|
|
28
|
+
<text class="key">数量</text>
|
|
29
|
+
<up-number-box
|
|
30
|
+
width="200px"
|
|
31
|
+
integer
|
|
32
|
+
v-model="num"
|
|
33
|
+
:min="selectSku.stock == 0 ? 0 : 1"
|
|
34
|
+
:max="selectSku.id ? selectSku.stock : showAreaStock[1]"
|
|
35
|
+
></up-number-box>
|
|
36
|
+
</view>
|
|
37
|
+
<scroll-view :style="[specsListMaxHeight]" scroll-y="true" class="specsList">
|
|
38
|
+
<view class="item" v-for="(skuArr, skuArrKey) in r.result" :key="skuArrKey">
|
|
39
|
+
<text class="title">{{ skuArrKey }}</text>
|
|
40
|
+
<view class="specsValueList">
|
|
41
|
+
<view
|
|
42
|
+
class="specs"
|
|
43
|
+
v-for="(sku, skuKey) in skuArr"
|
|
44
|
+
:key="skuKey"
|
|
45
|
+
:style="[specsStyle(sku)]"
|
|
46
|
+
@click="bindEvent(sku, skuArr, skuArrKey)"
|
|
47
|
+
>
|
|
48
|
+
<!-- 带有图片的sku -->
|
|
49
|
+
<view v-if="sku.img" class="specs_img_box">
|
|
50
|
+
<!-- 禁用遮罩层 -->
|
|
51
|
+
<view class="specs_img_box_mask"></view>
|
|
52
|
+
<!-- 图片 -->
|
|
53
|
+
<image
|
|
54
|
+
class="specs_img_box_cover"
|
|
55
|
+
:src="sku.img"
|
|
56
|
+
:style="{
|
|
57
|
+
borderRadius: sku.img ? '15rpx' : '10rpx'
|
|
58
|
+
}"
|
|
59
|
+
></image>
|
|
60
|
+
<!-- 预览按钮 -->
|
|
61
|
+
<view class="specs_img_box_preview" @click.stop="preview(sku.img)">
|
|
62
|
+
<image
|
|
63
|
+
class="img"
|
|
64
|
+
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAADUxJREFUeF7tndnLb3UZxdf6A6LyJgzqJgpSilALJQilyAZMoswz6hn0ePQMeibnqckGcx7PcZ4HikIjLBK9KhukQYyKLqKiokBBvF+x5U3O8L7v+f32Xnv67rVv9GJ/1/M8n2cvfuf3Pr/9/RK5QiAEliTAsAmBEFiaQAySpyMEliEQg+TxCIEYJM9ACNQjkE+QetyyaiIEYpCJNDpl1iMQg9TjllUTIRCDTKTRKbMegRikHresmgiBGGQijU6Z9QjEIPW4ZdVECMQgE2l0yqxHIAapxy2rJkIgBplIo1NmPQIxSD1uWTURAjHIRBqdMusRiEHqccuqiRCIQSbS6JRZj0AMUo9bVk2EQAwykUanzHoEYpB63LJqIgRikIk0OmXWIxCD1OOWVRMhEINMpNEpsx6BGKQet6yaCIEYZCKNTpn1CMQg9bhl1UQIxCATaXTKrEcgBqnHLasmQiAGmUijU2Y9AjFIPW6DXSXpGACfBHDyYJNcOrE/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UDxNIlxmiQEw1NWUfyAYNOJAonMDaDONpxBknHvMSRSzQGTmBqBllL0jEvGXhbk56LwJQMsoakY17iYh+dERCYikFWk3TMS0bQ0qToJDAFg6wi6ZiXOLlHayQESjfISpKOeclI2pk03QRKNsgKko55iZt59EZEoFSDnE7yyRH1IakOlECJBnm+B9Z/BfALAL8i+WIP8ROyJQIlGqQlVDPLVpvT3UDyjzOvyI2DJRCDtNOaFwB8huSr7chHtSsCMUh7pL9H8ovtyUe5CwIxSHuUXyP51vbko9wFgRikXcrH5Ut7u4DbVo9B2iV8Esk+/qrWblUTUu/bINWs4rSCeb+X5F8Krq/40vo2iOtAm6E26i0kXx9qcsnr8AT6NsgRAF4C8M7Dpzq6O/aRrI57yzViAr0apOJmPFBzUG0g2TvbQQEZaTKDaKKk6nvIVQCOHinH/dO+juTuAupICQAGYZCFT5KjAFQ7s39kpJ35OYCnSVb/zVUIgcEYpBCeKaMwAjFIYQ1NOV4CMYiXZ9QKIxCDFNbQlOMlEIN4eUatMAIxSGENTTleAjGIl2fUCiMQgxTW0JTjJRCDeHlGrTACMUhhDU05XgIxiJdn1AojEIMU1tCU4yUQg3h5Rq0wAjFIYQ1NOV4CMYiXZ9QKIxCDFNbQlOMlEIN4eUatMAIxSGENTTleAjGIl2fUCiMQgxTW0JTjJRCDeHlGrTACMUhhDU05XgIxiJdn1AojEIMU1tCU4yUQg3h5Rq0wAjFIYQ1NOV4CMYiXZ9QKIxCDFNbQlOMlEIN4eUatMAIxSGENTTleAjGIl2fUCiPwP7pc5fax5w6YAAAAAElFTkSuQmCC"
|
|
65
|
+
></image>
|
|
66
|
+
</view>
|
|
67
|
+
<!-- 文字 -->
|
|
68
|
+
<text
|
|
69
|
+
class="specs_img_box_text t-c"
|
|
70
|
+
:style="{
|
|
71
|
+
color: sku.active ? themeRGB : '#999999',
|
|
72
|
+
borderBottomLeftRadius: sku.img ? '15rpx' : '10rpx',
|
|
73
|
+
borderBottomRightRadius: sku.img ? '15rpx' : '10rpx',
|
|
74
|
+
textDecoration: sku.discard ? 'line-through' : ''
|
|
75
|
+
}"
|
|
76
|
+
>
|
|
77
|
+
{{ sku.value }}
|
|
78
|
+
</text>
|
|
79
|
+
</view>
|
|
80
|
+
<!-- 普通sku -->
|
|
81
|
+
<text
|
|
82
|
+
v-else
|
|
83
|
+
class="specs_common"
|
|
84
|
+
:style="{
|
|
85
|
+
backgroundColor: sku.active ? themeRGBA : '',
|
|
86
|
+
color: sku.active ? themeRGB : '#999999',
|
|
87
|
+
textDecoration: sku.discard ? 'line-through' : ''
|
|
88
|
+
}"
|
|
89
|
+
>
|
|
90
|
+
{{ sku.value }}
|
|
91
|
+
</text>
|
|
92
|
+
</view>
|
|
93
|
+
</view>
|
|
94
|
+
</view>
|
|
95
|
+
</scroll-view>
|
|
96
|
+
</view>
|
|
97
|
+
<view class="btnBox">
|
|
98
|
+
<view
|
|
99
|
+
class="confirm"
|
|
100
|
+
:style="{
|
|
101
|
+
background: selectSku.id && selectSku.stock * 1 < 1 ? '#b4b4b4' : themeRGB
|
|
102
|
+
}"
|
|
103
|
+
@click="confirm"
|
|
104
|
+
>
|
|
105
|
+
<text class="confirm-text">
|
|
106
|
+
{{ btnConfirmShowText }}
|
|
107
|
+
</text>
|
|
108
|
+
</view>
|
|
109
|
+
</view>
|
|
110
|
+
</view>
|
|
111
|
+
</view>
|
|
112
|
+
</template>
|
|
113
|
+
|
|
114
|
+
<script>
|
|
115
|
+
// 引入 CryptoJS 库
|
|
116
|
+
import CryptoJS from 'crypto-js';
|
|
117
|
+
import { mpMixin } from '../../libs/mixin/mpMixin.js';
|
|
118
|
+
import { mixin } from '../../libs/mixin/mixin.js';
|
|
119
|
+
import { props } from './props.js';
|
|
120
|
+
/**
|
|
121
|
+
* geek-sku
|
|
122
|
+
* @description 商品sku组件。
|
|
123
|
+
* @tutorial https://ijry.github.io/uview-plus/components/sku.html
|
|
124
|
+
* @property {Array} data 源数据。
|
|
125
|
+
* @property {Boolean} modelValue 是否显示sku组件(默认值: false, v3显示)。
|
|
126
|
+
* @property {Boolean} value 是否显示sku组件(默认值: false, v2显示)。
|
|
127
|
+
* @property {Boolean} isMaskClose 是否可以点击遮罩层关闭(默认值: false)。
|
|
128
|
+
* @property {Boolean} isSelectMinPriceSku 是否默认选中最低价格的sku(默认值: true)。
|
|
129
|
+
* @property {Boolean} selectSkuIndex 默认选中的sku下标。
|
|
130
|
+
* @property {String} defaultCover 默认封面图,用于没有选中完整的sku时展示。
|
|
131
|
+
* @property {Number} defaultNum 默认购买商品数量。
|
|
132
|
+
* @property {Array} themeColor 主题色,需要传入一个数组长度为3的数组,分别对应rgb三个颜色的值,例如: [84, 164, 255]。
|
|
133
|
+
* @property {String} btnConfirmText 确认按钮文字(默认值: '确认')。
|
|
134
|
+
* @property {Boolean} skuUnrelatedDisabled 不相关sku是否禁用(默认值: false)。
|
|
135
|
+
* @property {Object} skuDisabledStyle sku禁用样式。
|
|
136
|
+
* @property {String} notStockText 库存不足文字(默认值: '库存不足')。
|
|
137
|
+
* @property {String} notSelectSku 未选择完整的sku时的文字提示(默认值: '请选择完整的sku属性')。
|
|
138
|
+
* @property {Boolean} showStockNum 是否展示库存数量。
|
|
139
|
+
* @event {Function} confirm 点击确认按钮时触发的事件,会返回e, e = { sku, skuText , num },分别对应选中的sku值 、sku属性名 、输入框内的数量。
|
|
140
|
+
* @event {Function} skuChange sku发生变化时出发的事件,如果有选中完整的sku则会返回该sku,否则会返回{}。
|
|
141
|
+
* @event {Function} close 关闭sku组件触发事件。
|
|
142
|
+
* @event {Function} open 打开sku组件触发事件。
|
|
143
|
+
* @event {Function} numChange 输入框内数量发生改变时触发事件。
|
|
144
|
+
* @example <up-sku-wu
|
|
145
|
+
v-model="skuShow"
|
|
146
|
+
:data="skus"
|
|
147
|
+
:defaultCover="logo"
|
|
148
|
+
@skuChange="skuChange"
|
|
149
|
+
@confirm="buyShop"
|
|
150
|
+
>
|
|
151
|
+
</up-sku-wu>
|
|
152
|
+
*/
|
|
153
|
+
export default {
|
|
154
|
+
name: 'u-sku-wu',
|
|
155
|
+
mixins: [mpMixin, mixin, props],
|
|
156
|
+
// data() 返回的属性将会成为响应式的状态
|
|
157
|
+
// 并且暴露在 `this` 上
|
|
158
|
+
data() {
|
|
159
|
+
return {
|
|
160
|
+
// sku所有属性得可能性集合
|
|
161
|
+
res: {},
|
|
162
|
+
// 拼接得字符
|
|
163
|
+
spliter: '\u2299',
|
|
164
|
+
// 组合数据
|
|
165
|
+
r: {},
|
|
166
|
+
// sku属性名合集
|
|
167
|
+
// 机身颜色: '深空黑色',
|
|
168
|
+
// 储存容量: '128G',
|
|
169
|
+
// 套装: '快充套装',
|
|
170
|
+
// keys = [机身颜色, 储存容量, 套装]
|
|
171
|
+
keys: [],
|
|
172
|
+
// 选中的sku的副本
|
|
173
|
+
selectedCache: [],
|
|
174
|
+
// 选中的sku
|
|
175
|
+
selectSku: {},
|
|
176
|
+
// 展示的区间价格
|
|
177
|
+
showAreaPrice: [0, 0],
|
|
178
|
+
// 展示的区间库存
|
|
179
|
+
showAreaStock: [0, 0],
|
|
180
|
+
// 购买的数量
|
|
181
|
+
num: 1,
|
|
182
|
+
// 主题色RGB
|
|
183
|
+
themeRGB: '',
|
|
184
|
+
// 主题色RGBA
|
|
185
|
+
themeRGBA: '',
|
|
186
|
+
// 是否使用带图sku
|
|
187
|
+
isUseImgSku: false,
|
|
188
|
+
// 是否v3
|
|
189
|
+
// #ifdef VUE3
|
|
190
|
+
isV3: true,
|
|
191
|
+
// #endif
|
|
192
|
+
// #ifndef VUE3
|
|
193
|
+
isV3: false,
|
|
194
|
+
// #endif
|
|
195
|
+
// 显示sku
|
|
196
|
+
showSkuPopup: false,
|
|
197
|
+
// 从低向上的动画显示
|
|
198
|
+
shopSpecsPopupStyleShow: false,
|
|
199
|
+
// 透明度消失动画, 让他关闭时看上不不那么生硬
|
|
200
|
+
skuPopupStyleShow: false
|
|
201
|
+
};
|
|
202
|
+
},
|
|
203
|
+
// methods 是一些用来更改状态与触发更新的函数
|
|
204
|
+
methods: {
|
|
205
|
+
/**
|
|
206
|
+
* 计算组合数据
|
|
207
|
+
*/
|
|
208
|
+
combineAttr(data, keys) {
|
|
209
|
+
var allKeys = [];
|
|
210
|
+
var result = {};
|
|
211
|
+
|
|
212
|
+
for (var i = 0; i < data.length; i++) {
|
|
213
|
+
var item = data[i].sku_attrs;
|
|
214
|
+
var values = [];
|
|
215
|
+
|
|
216
|
+
for (var j = 0; j < keys.length; j++) {
|
|
217
|
+
let key = keys[j];
|
|
218
|
+
// 属性名
|
|
219
|
+
let attr_info = this.getObjAppointAttr(item[key]);
|
|
220
|
+
|
|
221
|
+
if (!result[key]) result[key] = [];
|
|
222
|
+
if (result[key].indexOf(attr_info.value) < 0) result[key].push(item[key]);
|
|
223
|
+
|
|
224
|
+
values.push(attr_info.value);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
allKeys.push({
|
|
228
|
+
path: values.join(this.spliter),
|
|
229
|
+
sku: data[i].id,
|
|
230
|
+
stock: data[i].stock
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
for (let key in result) {
|
|
235
|
+
let obj = {};
|
|
236
|
+
result[key].forEach((item) => {
|
|
237
|
+
// 属性名
|
|
238
|
+
let attr_info = this.getObjAppointAttr(item);
|
|
239
|
+
// 如果本次的属性不存在 则 将该属性设置为空对象
|
|
240
|
+
if (!obj[attr_info.name]) obj[attr_info.name] = {};
|
|
241
|
+
// 本次要操作的属性 下面得赋值是为了防止已有属性被覆盖
|
|
242
|
+
obj[attr_info.name].value = attr_info.value;
|
|
243
|
+
obj[attr_info.name].active = false;
|
|
244
|
+
obj[attr_info.name].disabled = false;
|
|
245
|
+
// 如果不想关sku需要禁用
|
|
246
|
+
if (this.skuUnrelatedDisabled) {
|
|
247
|
+
obj[attr_info.name].discard = false; // 是否废弃
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// 如果该sku属性是对象则取其中的name属性
|
|
251
|
+
if (Object.prototype.toString.call(item) === '[object Object]') {
|
|
252
|
+
obj[attr_info.name] = {
|
|
253
|
+
...obj[attr_info.name],
|
|
254
|
+
...item
|
|
255
|
+
};
|
|
256
|
+
this.isUseImgSku = true;
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
result[key] = obj;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return {
|
|
263
|
+
result: result,
|
|
264
|
+
items: allKeys
|
|
265
|
+
};
|
|
266
|
+
},
|
|
267
|
+
getAllKeys(arr) {
|
|
268
|
+
var result = [];
|
|
269
|
+
for (var i = 0; i < arr.length; i++) {
|
|
270
|
+
result.push(arr[i].path);
|
|
271
|
+
}
|
|
272
|
+
return result;
|
|
273
|
+
},
|
|
274
|
+
/**
|
|
275
|
+
* 取得集合的所有子集「幂集」
|
|
276
|
+
arr = [1,2,3]
|
|
277
|
+
|
|
278
|
+
i = 0, ps = [[]]:
|
|
279
|
+
j = 0; j < ps.length => j < 1:
|
|
280
|
+
i=0, j=0 ps.push(ps[0].concat(arr[0])) => ps.push([].concat(1)) => [1]
|
|
281
|
+
ps = [[], [1]]
|
|
282
|
+
|
|
283
|
+
i = 1, ps = [[], [1]] :
|
|
284
|
+
j = 0; j < ps.length => j < 2
|
|
285
|
+
i=1, j=0 ps.push(ps[0].concat(arr[1])) => ps.push([].concat(2)) => [2]
|
|
286
|
+
i=1, j=1 ps.push(ps[1].concat(arr[1])) => ps.push([1].concat(2)) => [1,2]
|
|
287
|
+
ps = [[], [1], [2], [1,2]]
|
|
288
|
+
|
|
289
|
+
i = 2, ps = [[], [1], [2], [1,2]]
|
|
290
|
+
j = 0; j < ps.length => j < 4
|
|
291
|
+
i=2, j=0 ps.push(ps[0].concat(arr[2])) => ps.push([3]) => [3]
|
|
292
|
+
i=2, j=1 ps.push(ps[1].concat(arr[2])) => ps.push([1, 3]) => [1, 3]
|
|
293
|
+
i=2, j=2 ps.push(ps[2].concat(arr[2])) => ps.push([2, 3]) => [2, 3]
|
|
294
|
+
i=2, j=3 ps.push(ps[3].concat(arr[2])) => ps.push([2, 3]) => [1, 2, 3]
|
|
295
|
+
ps = [[], [1], [2], [1,2], [3], [1, 3], [2, 3], [1, 2, 3]]
|
|
296
|
+
*/
|
|
297
|
+
powerset(arr) {
|
|
298
|
+
var ps = [[]];
|
|
299
|
+
for (var i = 0; i < arr.length; i++) {
|
|
300
|
+
for (var j = 0, len = ps.length; j < len; j++) {
|
|
301
|
+
ps.push(ps[j].concat(arr[i]));
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return ps;
|
|
305
|
+
},
|
|
306
|
+
/**
|
|
307
|
+
* 生成所有子集是否可选、库存状态 map
|
|
308
|
+
*/
|
|
309
|
+
buildResult(items) {
|
|
310
|
+
var allKeys = this.getAllKeys(items);
|
|
311
|
+
|
|
312
|
+
for (var i = 0; i < allKeys.length; i++) {
|
|
313
|
+
var curr = allKeys[i];
|
|
314
|
+
var sku = items[i].sku;
|
|
315
|
+
var values = curr.split(this.spliter);
|
|
316
|
+
var allSets = this.powerset(values);
|
|
317
|
+
|
|
318
|
+
// 每个组合的子集
|
|
319
|
+
for (var j = 0; j < allSets.length; j++) {
|
|
320
|
+
var set = allSets[j];
|
|
321
|
+
// 使用CryptoJS的MD5对原属性名加密 用来禁绝因特殊符号带来的属性名错误
|
|
322
|
+
var key = CryptoJS.MD5(set.join(this.spliter)).toString();
|
|
323
|
+
|
|
324
|
+
if (this.res[key]) {
|
|
325
|
+
this.res[key].skus.push(sku);
|
|
326
|
+
} else {
|
|
327
|
+
this.res[key] = {
|
|
328
|
+
skus: [sku]
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
trimSpliter(str, spliter) {
|
|
335
|
+
// ⊙abc⊙ => abc
|
|
336
|
+
// ⊙a⊙⊙b⊙c⊙ => a⊙b⊙c
|
|
337
|
+
var reLeft = new RegExp('^' + spliter + '+', 'g');
|
|
338
|
+
var reRight = new RegExp(spliter + '+$', 'g');
|
|
339
|
+
var reSpliter = new RegExp(spliter + '+', 'g');
|
|
340
|
+
return str.replace(reLeft, '').replace(reRight, '').replace(reSpliter, spliter);
|
|
341
|
+
},
|
|
342
|
+
/**
|
|
343
|
+
* 获取当前选中的属性
|
|
344
|
+
*/
|
|
345
|
+
getSelectedItem() {
|
|
346
|
+
var result = [];
|
|
347
|
+
|
|
348
|
+
let resObj = this.r.result;
|
|
349
|
+
if (resObj) {
|
|
350
|
+
Object.keys(resObj).forEach((key1, index) => {
|
|
351
|
+
result[index] = '';
|
|
352
|
+
Object.keys(resObj[key1]).forEach((key2) => {
|
|
353
|
+
// 查找选中的属性
|
|
354
|
+
let item = resObj[key1][key2];
|
|
355
|
+
item.active ? (result[index] = item.value) : '';
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
return result;
|
|
361
|
+
},
|
|
362
|
+
/**
|
|
363
|
+
* 无效属性点击
|
|
364
|
+
*/
|
|
365
|
+
handleDisableClick(sku, skuArrKey, index) {
|
|
366
|
+
this.selectedCache[index] = sku;
|
|
367
|
+
|
|
368
|
+
// 清空所有sku选中属性
|
|
369
|
+
let resObj = this.r.result;
|
|
370
|
+
Object.keys(resObj).forEach((key1, index) => {
|
|
371
|
+
Object.keys(resObj[key1]).forEach((key2) => {
|
|
372
|
+
// 查找选中的属性
|
|
373
|
+
let item = resObj[key1][key2];
|
|
374
|
+
item.active = false;
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
// 删除无效属性的禁止状态 并 选中
|
|
379
|
+
sku.active = true;
|
|
380
|
+
sku.disabled = false;
|
|
381
|
+
|
|
382
|
+
this.updateStatus(this.getSelectedItem());
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* 恢复原来已选属性
|
|
386
|
+
* 遍历所有非当前属性行
|
|
387
|
+
* 1. 与 selectedCache 对比
|
|
388
|
+
* 2. 如果要恢复的属性存在(非 disable)且 和当前*未高亮行*已选择属性的*可组合*),高亮原来已选择的属性且更新
|
|
389
|
+
* 3. 否则什么也不做
|
|
390
|
+
*/
|
|
391
|
+
for (var i = 0; i < this.keys.length; i++) {
|
|
392
|
+
var item = this.keys[i];
|
|
393
|
+
if (item == skuArrKey) continue;
|
|
394
|
+
|
|
395
|
+
// 没有被禁用的属性 (可以被选择)
|
|
396
|
+
if (this.selectedCache[i] && !this.selectedCache[i].disabled && !this.selectedCache[i].discard) {
|
|
397
|
+
this.selectedCache[i].active = true;
|
|
398
|
+
this.updateStatus(this.getSelectedItem());
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* 更新所有属性状态
|
|
405
|
+
*/
|
|
406
|
+
updateStatus(selected) {
|
|
407
|
+
// 遍历sku属性名合集
|
|
408
|
+
for (var i = 0; i < this.keys.length; i++) {
|
|
409
|
+
// 如果这段看不懂将console.log的注释解开即可
|
|
410
|
+
var key = this.keys[i];
|
|
411
|
+
var data = this.r.result[key];
|
|
412
|
+
var hasActive = !!selected[i];
|
|
413
|
+
var copy = selected.slice();
|
|
414
|
+
// console.log(key, '属性名合集')
|
|
415
|
+
// console.log(i)
|
|
416
|
+
// console.log(copy, '已选属性');
|
|
417
|
+
// 遍历data所有属性
|
|
418
|
+
Object.keys(data).forEach((dataKey) => {
|
|
419
|
+
var item = data[dataKey];
|
|
420
|
+
if (selected[i] == item.value) return;
|
|
421
|
+
copy[i] = item.value;
|
|
422
|
+
// 加密后的属性名
|
|
423
|
+
var curr = CryptoJS.MD5(this.trimSpliter(copy.join(this.spliter), this.spliter)).toString();
|
|
424
|
+
// 从sku组合合集中找出这项
|
|
425
|
+
var resCurr = this.res[curr];
|
|
426
|
+
// console.log(this.res, 'sku组合合集')
|
|
427
|
+
// console.log(curr, '合集加密名称')
|
|
428
|
+
// console.log(this.trimSpliter(copy.join(this.spliter), this.spliter))
|
|
429
|
+
// 如果存在这种组合
|
|
430
|
+
if (resCurr) {
|
|
431
|
+
// console.log(resCurr)
|
|
432
|
+
if (this.skuUnrelatedDisabled) {
|
|
433
|
+
item.discard = false;
|
|
434
|
+
} else {
|
|
435
|
+
item.disabled = false;
|
|
436
|
+
}
|
|
437
|
+
} else {
|
|
438
|
+
if (this.skuUnrelatedDisabled) {
|
|
439
|
+
item.discard = true;
|
|
440
|
+
} else {
|
|
441
|
+
item.disabled = true;
|
|
442
|
+
}
|
|
443
|
+
item.active = false;
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// 获取当前选中的属性
|
|
449
|
+
var result = selected.slice();
|
|
450
|
+
// 如果所有属性都已选中
|
|
451
|
+
if (result.every((item) => item)) {
|
|
452
|
+
// 将属性合成r.items中的sku名称
|
|
453
|
+
let name = this.trimSpliter(result.join(this.spliter), this.spliter);
|
|
454
|
+
// 查找sku
|
|
455
|
+
let sku = this.r.items.find((item) => item.path == name);
|
|
456
|
+
// 如果找到该sku
|
|
457
|
+
if (sku) {
|
|
458
|
+
// 根据sku的sku属性(唯一标识,通常来说会是id)找到源数据中的匹配的那一项并选中;
|
|
459
|
+
this.selectSku = JSON.parse(JSON.stringify(this.data.find((item) => item.id == sku.sku)));
|
|
460
|
+
// 重置数量
|
|
461
|
+
this.num = Number(this.defaultNum);
|
|
462
|
+
}
|
|
463
|
+
} else {
|
|
464
|
+
this.selectSku = {};
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
bindEvent(sku, skuArr, skuArrKey) {
|
|
468
|
+
// 如果该sku属性被废弃则直接返回
|
|
469
|
+
if (sku.discard) return;
|
|
470
|
+
|
|
471
|
+
if (!sku.active) {
|
|
472
|
+
// 清空当前行的所有sku选中属性
|
|
473
|
+
Object.keys(skuArr).forEach((key) => {
|
|
474
|
+
skuArr[key].active = false;
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
sku.active = true;
|
|
478
|
+
|
|
479
|
+
// 当前选中的keys的index
|
|
480
|
+
let index = this.keys.findIndex((item) => item == skuArrKey);
|
|
481
|
+
|
|
482
|
+
if (sku.disabled) {
|
|
483
|
+
this.handleDisableClick(sku, skuArrKey, index);
|
|
484
|
+
} else {
|
|
485
|
+
this.selectedCache[index] = sku;
|
|
486
|
+
}
|
|
487
|
+
} else {
|
|
488
|
+
sku.active = false;
|
|
489
|
+
// 清空所有sku禁用状态
|
|
490
|
+
let resObj = this.r.result;
|
|
491
|
+
Object.keys(resObj).forEach((key1, index) => {
|
|
492
|
+
Object.keys(resObj[key1]).forEach((key2) => {
|
|
493
|
+
// 查找选中的属性
|
|
494
|
+
let item = resObj[key1][key2];
|
|
495
|
+
if (this.skuUnrelatedDisabled) {
|
|
496
|
+
item.discard = false;
|
|
497
|
+
} else {
|
|
498
|
+
item.disabled = false;
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
this.updateStatus(this.getSelectedItem());
|
|
505
|
+
},
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* 选中最便宜价格的sku
|
|
509
|
+
*/
|
|
510
|
+
selectMinPriceSku() {
|
|
511
|
+
let minPriceSku = null;
|
|
512
|
+
this.data.forEach((sku) => {
|
|
513
|
+
// 如果为空则直接赋值
|
|
514
|
+
if (minPriceSku === null) {
|
|
515
|
+
minPriceSku = sku;
|
|
516
|
+
} else if (minPriceSku.price > sku.price) {
|
|
517
|
+
// 如果比最小价格低 就赋值
|
|
518
|
+
minPriceSku = sku;
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
for (var key in minPriceSku.sku_attrs) {
|
|
523
|
+
let attr_info = this.getObjAppointAttr(minPriceSku.sku_attrs[key]);
|
|
524
|
+
// 找出对应项并选中
|
|
525
|
+
this.r.result[key][attr_info.name].active = true;
|
|
526
|
+
}
|
|
527
|
+
this.updateStatus(this.getSelectedItem());
|
|
528
|
+
},
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* 选中某项sku
|
|
532
|
+
* @param {Number} index 选中的skuIndex
|
|
533
|
+
*/
|
|
534
|
+
selectAppointSku(index) {
|
|
535
|
+
// 视图更新后在更新选中的skuIndex
|
|
536
|
+
this.$nextTick(() => {
|
|
537
|
+
if (!this.data[index]) return console.error('请输入正确的sku下标');
|
|
538
|
+
let sku_attrs = this.data[index].sku_attrs;
|
|
539
|
+
for (var key in sku_attrs) {
|
|
540
|
+
let attr_info = this.getObjAppointAttr(sku_attrs[key]);
|
|
541
|
+
// 找出对应项并选中
|
|
542
|
+
this.r.result[key][attr_info.name].active = true;
|
|
543
|
+
}
|
|
544
|
+
this.updateStatus(this.getSelectedItem());
|
|
545
|
+
});
|
|
546
|
+
},
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* 找出区间数据
|
|
550
|
+
*/
|
|
551
|
+
findAreaData() {
|
|
552
|
+
let minPrice = null;
|
|
553
|
+
let maxPrice = 0;
|
|
554
|
+
let minStock = null;
|
|
555
|
+
let maxStock = 0;
|
|
556
|
+
this.data.forEach((sku) => {
|
|
557
|
+
// 如果最小价格为空则直接赋值
|
|
558
|
+
if (minPrice === null) {
|
|
559
|
+
minPrice = sku.price;
|
|
560
|
+
} else if (minPrice * 1 > sku.price * 1) {
|
|
561
|
+
// 如果比最小价格低 就赋值
|
|
562
|
+
minPrice = sku.price;
|
|
563
|
+
}
|
|
564
|
+
// 如果大于最大价格则赋值
|
|
565
|
+
if (maxPrice < sku.price) {
|
|
566
|
+
maxPrice = sku.price;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
// 如果最小库存为空则直接赋值
|
|
570
|
+
if (minStock === null) {
|
|
571
|
+
minStock = sku.stock;
|
|
572
|
+
} else if (minStock * 1 > sku.stock * 1) {
|
|
573
|
+
// 如果比最小库存少 就赋值
|
|
574
|
+
minStock = sku.stock;
|
|
575
|
+
}
|
|
576
|
+
// 如果大于最大库存则赋值
|
|
577
|
+
if (maxStock * 1 < sku.stock * 1) {
|
|
578
|
+
maxStock = sku.stock;
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
// 赋值区间
|
|
582
|
+
this.showAreaPrice = [minPrice, maxPrice];
|
|
583
|
+
this.showAreaStock = [minStock, maxStock];
|
|
584
|
+
},
|
|
585
|
+
|
|
586
|
+
// 初始化
|
|
587
|
+
init(data) {
|
|
588
|
+
this.res = {};
|
|
589
|
+
this.r = {};
|
|
590
|
+
this.keys = [];
|
|
591
|
+
this.selectedCache = [];
|
|
592
|
+
this.isUseImgSku = false;
|
|
593
|
+
|
|
594
|
+
// skus 长度为空则没必要往下继续进行了
|
|
595
|
+
if (!data.length) return;
|
|
596
|
+
|
|
597
|
+
// 拼接主题色
|
|
598
|
+
this.joinThemColor(this.themeColor);
|
|
599
|
+
|
|
600
|
+
// 找出sku的可选属性的标题
|
|
601
|
+
for (var attr_key in data[0].sku_attrs) {
|
|
602
|
+
// 如果这个属性未定义存则跳过
|
|
603
|
+
if (!(attr_key in data[0].sku_attrs)) continue;
|
|
604
|
+
// 如果这个属性未赋值 或 不存在 则删除该属性
|
|
605
|
+
if (data[0].sku_attrs[attr_key] === null || data[0].sku_attrs[attr_key] === undefined) delete data[0].sku_attrs[attr_key];
|
|
606
|
+
// 否则添加属性
|
|
607
|
+
else this.keys.push(attr_key);
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
//计算组合数据
|
|
611
|
+
this.r = this.combineAttr(data, this.keys);
|
|
612
|
+
|
|
613
|
+
// 生成所有子集是否可选、库存状态 map
|
|
614
|
+
this.buildResult(this.r.items);
|
|
615
|
+
|
|
616
|
+
// 找到区间数据
|
|
617
|
+
this.findAreaData();
|
|
618
|
+
|
|
619
|
+
// 如果无库存不展示 则 更新一下数据 因为有可能某个属性没有库存
|
|
620
|
+
if (this.notSelectSku) {
|
|
621
|
+
this.updateStatus(this.getSelectedItem());
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// 如果需要选中某项sku
|
|
625
|
+
if (this.selectSkuIndex !== null && this.selectSkuIndex !== undefined && this.selectSkuIndex !== '') {
|
|
626
|
+
this.selectAppointSku(Number(this.selectSkuIndex));
|
|
627
|
+
} else if (this.isSelectMinPriceSku) {
|
|
628
|
+
// 如果需要选中默认最便宜的sku
|
|
629
|
+
this.selectMinPriceSku();
|
|
630
|
+
}
|
|
631
|
+
},
|
|
632
|
+
|
|
633
|
+
// 确认事件
|
|
634
|
+
confirm() {
|
|
635
|
+
// 如果已有选中的完整sku
|
|
636
|
+
if (this.selectSku.id) {
|
|
637
|
+
// 如果有库存
|
|
638
|
+
if (this.selectSku.stock * 1 > 0) {
|
|
639
|
+
// 按钮确认事件
|
|
640
|
+
this.$emit('confirm', {
|
|
641
|
+
sku: this.selectSku,
|
|
642
|
+
skuText: this.getSelectedItem(),
|
|
643
|
+
num: this.num * 1
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
} else {
|
|
647
|
+
uni.showToast({
|
|
648
|
+
title: this.notSelectSku,
|
|
649
|
+
icon: 'none',
|
|
650
|
+
duration: 1500
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
|
|
655
|
+
// 拼接主题色
|
|
656
|
+
joinThemColor(n) {
|
|
657
|
+
this.themeRGB = `rgb(${n[0]}, ${n[1]}, ${n[2]})`;
|
|
658
|
+
this.themeRGBA = `rgba(${n[0]}, ${n[1]}, ${n[2]}, 0.1)`;
|
|
659
|
+
},
|
|
660
|
+
|
|
661
|
+
// 关闭sku组件
|
|
662
|
+
close() {
|
|
663
|
+
// #ifdef VUE3
|
|
664
|
+
this.$emit('update:modelValue', false);
|
|
665
|
+
// #endif
|
|
666
|
+
|
|
667
|
+
// #ifndef VUE3
|
|
668
|
+
this.$emit('input', false);
|
|
669
|
+
// #endif
|
|
670
|
+
|
|
671
|
+
// #ifdef H5
|
|
672
|
+
// fix by mehaotian 处理 h5 滚动穿透的问题
|
|
673
|
+
document.getElementsByTagName('body')[0].style.overflow = 'visible';
|
|
674
|
+
// #endif
|
|
675
|
+
|
|
676
|
+
this.$emit('close');
|
|
677
|
+
|
|
678
|
+
this.skuPopupStyleShow = false;
|
|
679
|
+
this.shopSpecsPopupStyleShow = false;
|
|
680
|
+
|
|
681
|
+
setTimeout(() => {
|
|
682
|
+
this.showSkuPopup = false;
|
|
683
|
+
}, 300);
|
|
684
|
+
},
|
|
685
|
+
|
|
686
|
+
// 打开sku组件
|
|
687
|
+
open() {
|
|
688
|
+
// #ifdef VUE3
|
|
689
|
+
this.$emit('update:modelValue', true);
|
|
690
|
+
// #endif
|
|
691
|
+
|
|
692
|
+
// #ifndef VUE3
|
|
693
|
+
this.$emit('input', true);
|
|
694
|
+
// #endif
|
|
695
|
+
|
|
696
|
+
// #ifdef H5
|
|
697
|
+
// fix by mehaotian 处理 h5 滚动穿透的问题
|
|
698
|
+
document.getElementsByTagName('body')[0].style.overflow = 'hidden';
|
|
699
|
+
// #endif
|
|
700
|
+
|
|
701
|
+
this.$emit('open');
|
|
702
|
+
|
|
703
|
+
this.showSkuPopup = true;
|
|
704
|
+
|
|
705
|
+
setTimeout(() => {
|
|
706
|
+
this.skuPopupStyleShow = true;
|
|
707
|
+
this.shopSpecsPopupStyleShow = true;
|
|
708
|
+
});
|
|
709
|
+
},
|
|
710
|
+
|
|
711
|
+
// 重置购买数量
|
|
712
|
+
resetNum() {
|
|
713
|
+
this.num = Number(this.defaultNum);
|
|
714
|
+
},
|
|
715
|
+
|
|
716
|
+
// 获取对象中指定属性
|
|
717
|
+
getObjAppointAttr(obj, attr = 'name') {
|
|
718
|
+
// 用来储存属性中对应的值
|
|
719
|
+
let value = '';
|
|
720
|
+
// 如果该sku属性是对象则取其中的name属性
|
|
721
|
+
if (Object.prototype.toString.call(obj) === '[object Object]') {
|
|
722
|
+
value = obj[attr];
|
|
723
|
+
} else {
|
|
724
|
+
value = obj;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// 使用CryptoJS的MD5对原属性名加密 用来禁绝因特殊符号带来的属性名错误
|
|
728
|
+
let name = CryptoJS.MD5(value).toString();
|
|
729
|
+
|
|
730
|
+
return {
|
|
731
|
+
value,
|
|
732
|
+
name
|
|
733
|
+
};
|
|
734
|
+
},
|
|
735
|
+
|
|
736
|
+
// 预览图片
|
|
737
|
+
preview(img) {
|
|
738
|
+
uni.previewImage({
|
|
739
|
+
urls: [img]
|
|
740
|
+
});
|
|
741
|
+
},
|
|
742
|
+
|
|
743
|
+
// specs样式
|
|
744
|
+
specsStyle(sku) {
|
|
745
|
+
let style = {
|
|
746
|
+
borderRadius: sku.img ? '15rpx' : '10rpx'
|
|
747
|
+
};
|
|
748
|
+
// 选中的样式
|
|
749
|
+
if (sku.active) {
|
|
750
|
+
style.border = `3rpx solid ${this.themeRGB}`;
|
|
751
|
+
} else if (sku.disabled) {
|
|
752
|
+
// 禁用的样式
|
|
753
|
+
style.border = `3rpx solid transparent`;
|
|
754
|
+
style.background = '#f3f3f3';
|
|
755
|
+
} else {
|
|
756
|
+
// 默认状样式 或 废弃样式
|
|
757
|
+
style.background = '#fff';
|
|
758
|
+
style.border = `3rpx solid #e4e4e4`;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
if (sku.discard) {
|
|
762
|
+
// 废弃的样式
|
|
763
|
+
style = {
|
|
764
|
+
...style,
|
|
765
|
+
...this.skuDisabledStyle
|
|
766
|
+
};
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
return style;
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
// computed 计算属性
|
|
773
|
+
computed: {
|
|
774
|
+
// 获取已选中的sku属性字符串
|
|
775
|
+
getSelectedSkuAttrStr() {
|
|
776
|
+
let attrArr = this.getSelectedItem();
|
|
777
|
+
// 如果有未选中的数据
|
|
778
|
+
if (attrArr.findIndex((item) => !item) !== -1) {
|
|
779
|
+
// 获取sku属性名
|
|
780
|
+
let resultArr = Object.keys(this.r.result);
|
|
781
|
+
// 未选中的sku属性名
|
|
782
|
+
let noAttrNameArr = [];
|
|
783
|
+
attrArr.forEach((item, index) => {
|
|
784
|
+
if (!item) {
|
|
785
|
+
noAttrNameArr.push(resultArr[index]);
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
return `请选择:${noAttrNameArr.join('、')}`;
|
|
790
|
+
} else {
|
|
791
|
+
return `已选择:${attrArr.join(',')}`;
|
|
792
|
+
}
|
|
793
|
+
return this.getSelectedItem();
|
|
794
|
+
},
|
|
795
|
+
// 获取确认按钮显示文字
|
|
796
|
+
btnConfirmShowText() {
|
|
797
|
+
return this.selectSku.id && this.selectSku.stock * 1 < 1 ? this.notStockText : this.btnConfirmText;
|
|
798
|
+
},
|
|
799
|
+
// 获取 specslist 最大高度
|
|
800
|
+
specsListMaxHeight() {
|
|
801
|
+
let style = {};
|
|
802
|
+
// #ifndef APP-NVUE
|
|
803
|
+
style.maxHeight = '45vh';
|
|
804
|
+
// #endif
|
|
805
|
+
// #ifdef APP-NVUE
|
|
806
|
+
style.height = uni.getWindowInfo().screenHeight * 0.65 + 'rpx';
|
|
807
|
+
// #endif
|
|
808
|
+
|
|
809
|
+
return style;
|
|
810
|
+
}
|
|
811
|
+
},
|
|
812
|
+
// 监听
|
|
813
|
+
watch: {
|
|
814
|
+
data: {
|
|
815
|
+
handler(n) {
|
|
816
|
+
this.init(n);
|
|
817
|
+
},
|
|
818
|
+
deep: true
|
|
819
|
+
},
|
|
820
|
+
// #ifdef VUE3
|
|
821
|
+
modelValue(n) {
|
|
822
|
+
if (n) {
|
|
823
|
+
this.open();
|
|
824
|
+
this.init(this.data);
|
|
825
|
+
} else {
|
|
826
|
+
this.close();
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
// #endif
|
|
830
|
+
// #ifndef VUE3
|
|
831
|
+
value(n) {
|
|
832
|
+
if (n) {
|
|
833
|
+
this.open();
|
|
834
|
+
this.init(this.data);
|
|
835
|
+
} else {
|
|
836
|
+
this.close();
|
|
837
|
+
}
|
|
838
|
+
},
|
|
839
|
+
// #endif
|
|
840
|
+
num(n) {
|
|
841
|
+
this.$emit('numChange', n);
|
|
842
|
+
},
|
|
843
|
+
selectSku(n) {
|
|
844
|
+
this.$emit('skuChange', n);
|
|
845
|
+
},
|
|
846
|
+
themeColor(n) {
|
|
847
|
+
this.joinThemColor(n);
|
|
848
|
+
},
|
|
849
|
+
selectSkuIndex(n) {
|
|
850
|
+
this.selectAppointSku(Number(n));
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
// 挂载时
|
|
854
|
+
mounted() {
|
|
855
|
+
// 赋值默认购买商品数量
|
|
856
|
+
this.num = Number(this.defaultNum);
|
|
857
|
+
this.init(this.data);
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
</script>
|
|
861
|
+
|
|
862
|
+
<style scoped>
|
|
863
|
+
@import './style.css';
|
|
864
|
+
</style>
|