stellar-ui-v2 1.37.0 → 1.38.0
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/.babelrc +8 -0
- package/App.vue +22 -0
- package/LICENSE +21 -0
- package/README.md +8 -8
- package/common/account.js +59 -0
- package/common/app-mixin.js +61 -0
- package/common/config.js +69 -0
- package/common/css/common.scss +155 -54
- package/common/css/vars.scss +51 -0
- package/common/request.js +38 -0
- package/common/token.js +13 -0
- package/common/uploadFile.js +21 -0
- package/common/usePosition.js +159 -0
- package/common/utils.js +303 -0
- package/components/item-view/item-view.vue +84 -0
- package/components/page-nav/page-nav.vue +245 -0
- package/components/t-color-picker/t-color-picker.vue +820 -0
- package/index.html +20 -0
- package/main.js +22 -0
- package/manifest.json +84 -0
- package/mp/animate-demo/animate-demo.vue +132 -0
- package/mp/badge-demo/badge-demo.vue +211 -0
- package/mp/barcode-demo/barcode-demo.vue +59 -0
- package/mp/button-demo/button-demo.vue +211 -0
- package/mp/calendar-demo/calendar-demo.vue +266 -0
- package/mp/checkbox-demo/checkbox-demo.vue +274 -0
- package/mp/code-input-demo/code-input-demo.vue +113 -0
- package/mp/color-demo/color-demo.vue +363 -0
- package/mp/date-picker-demo/date-picker-demo.vue +158 -0
- package/mp/drag-demo/drag-demo.vue +112 -0
- package/mp/dropdown-menu-demo/dropdown-menu-demo.vue +380 -0
- package/mp/icon-demo/icon-demo.vue +223 -0
- package/mp/icon-demo/icon-vertical-align.vue +236 -0
- package/mp/image-demo/image-demo.vue +140 -0
- package/mp/index/index.vue +588 -0
- package/mp/index-list-demo/index-list-demo.vue +111 -0
- package/mp/input-demo/input-demo.vue +230 -0
- package/mp/loading-demo/loading-demo.vue +71 -0
- package/mp/media-preview-demo/media-preview-demo.vue +139 -0
- package/mp/message-box-demo/message-box-demo.vue +200 -0
- package/mp/notice-bar-demo/notice-bar-demo.vue +107 -0
- package/mp/number-keyboard-demo/number-keyboard-demo.vue +138 -0
- package/mp/popup-demo/popup-demo.vue +351 -0
- package/mp/price-demo/price-demo.vue +163 -0
- package/mp/progress-demo/progress-demo.vue +219 -0
- package/mp/qrcode-demo/qrcode-demo.vue +74 -0
- package/mp/radio-demo/radio-demo.vue +276 -0
- package/mp/rate-demo/rate-demo.vue +112 -0
- package/mp/read-more-demo/read-more-demo.vue +118 -0
- package/mp/rich-text-demo/rich-text-demo.vue +58 -0
- package/mp/scroll-to-demo/scroll-to-demo.vue +65 -0
- package/mp/search-demo/search-demo.vue +225 -0
- package/mp/select-demo/select-demo.vue +245 -0
- package/mp/signature-demo/signature-demo.vue +74 -0
- package/mp/slider-demo/slider-demo.vue +197 -0
- package/mp/stepper-demo/stepper-demo.vue +201 -0
- package/mp/steps-demo/steps-demo.vue +119 -0
- package/mp/sticky-demo/sticky-demo.vue +64 -0
- package/mp/swipe-action-demo/swipe-action-demo.vue +223 -0
- package/mp/swiper-demo/swiper-demo.vue +120 -0
- package/mp/switch-demo/switch-demo.vue +108 -0
- package/mp/table-demo/table-demo.vue +647 -0
- package/mp/tabs-demo/tabs-demo.vue +518 -0
- package/mp/test-demo/test-demo.vue +248 -0
- package/mp/text-demo/text-demo.vue +109 -0
- package/mp/toast-demo/toast-demo.vue +189 -0
- package/mp/touch-swipe-demo/touch-swipe-demo.vue +97 -0
- package/mp/tour-demo/tour-demo.vue +103 -0
- package/mp/tree-demo/tree-demo.vue +156 -0
- package/mp/upload-demo/upload-demo.vue +176 -0
- package/mp/video-demo/video-demo.vue +61 -0
- package/package.json +27 -6
- package/pages/404/404.vue +194 -0
- package/pages/gitlab/gitlab.vue +50 -0
- package/pages/index/index.vue +36 -0
- package/pages/login/login.vue +149 -0
- package/pages/user/user.vue +277 -0
- package/pages.json +809 -0
- package/pc/index/components/append-link.vue +61 -0
- package/pc/index/components/comment.vue +347 -0
- package/pc/index/components/comp-nav.vue +135 -0
- package/pc/index/components/header-nav.vue +74 -0
- package/pc/index/components/version-select.vue +217 -0
- package/pc/index/iPhone13.png +0 -0
- package/pc/index/index.vue +554 -0
- package/pc/index/login.vue +146 -0
- package/pc/index/md2html.js +163 -0
- package/pc/index/mdStyle.scss +270 -0
- package/pc/index/sse.js +22 -0
- package/pc/markdown/devGuide/93-/347/273/204/344/273/266/346/233/277/346/215/242/350/247/204/350/214/203.md +18 -0
- package/pc/markdown/devGuide/94-/345/274/200/345/217/221/350/256/241/345/210/222.md +1083 -0
- package/pc/markdown/devGuide/95-/347/273/204/344/273/266/345/221/275/345/220/215/350/247/204/350/214/203.md +78 -0
- package/pc/markdown/devGuide/96-/347/273/204/344/273/266/347/244/272/344/276/213/346/250/241/346/235/277.md +49 -0
- package/pc/markdown/devGuide/99-/347/273/204/344/273/266/345/272/223/345/274/200/345/217/221/346/214/207/345/215/227.md +93 -0
- package/pc/markdown/devGuide/config.json +5 -0
- package/pc/markdown/handbook/1-/344/273/213/347/273/215.md +34 -0
- package/pc/markdown/handbook/2-/345/277/253/351/200/237/344/270/212/346/211/213.md +59 -0
- package/pc/markdown/handbook/3-/350/207/252/345/256/232/344/271/211/344/270/273/351/242/230.md +35 -0
- package/pc/markdown/handbook/4-/347/273/204/344/273/266/346/265/213/350/257/225.md +24 -0
- package/pc/markdown/handbook/97-/346/233/264/346/226/260/346/227/245/345/277/227.md +1773 -0
- package/pc/markdown/handbook/98-/345/205/266/344/273/226/346/217/222/344/273/266.md +28 -0
- package/pc/markdown/handbook/99-/345/217/213/346/203/205/351/223/276/346/216/245.md +71 -0
- package/pc/markdown/handbook/config.json +4 -0
- package/pc/markdown/index.js +75 -0
- package/pc/markdown/requireFiles.js +103 -0
- package/pc/service/app.js +33 -0
- package/pc/service/config.json +16 -0
- package/pc/service/datas/ste-rich-text.txt +2 -0
- package/pc/service/package-lock.json +1328 -0
- package/pc/service/package.json +27 -0
- package/pc/service/src/routers.js +100 -0
- package/pc/service/src/utils/Applet.js +7 -0
- package/pc/service/src/utils/Code.js +70 -0
- package/pc/service/src/utils/Data.js +84 -0
- package/pc/service/src/utils/Redis.js +35 -0
- package/pc/service/src/utils/User.js +65 -0
- package/pc/service/src/utils/Utils.js +31 -0
- package/pc/service/src/utils/getConfig.js +7 -0
- package/pc/service/webs/index.js +11 -0
- package/prettier.config.js +20 -0
- package/router.js +22 -0
- package/static/astronaut.svg +1 -0
- package/static/favicon.png +0 -0
- package/static/planet.svg +1 -0
- package/static/reset.png +0 -0
- package/static/tabbars/home.png +0 -0
- package/static/tabbars/home_fill.png +0 -0
- package/static/tabbars/people.png +0 -0
- package/static/tabbars/people_fill.png +0 -0
- package/template.h5.html +31 -0
- package/test/components/badge.test.js +75 -0
- package/test/components/barcode.test.js +22 -0
- package/test/components/button.test.js +52 -0
- package/test/components/calendar.test.js +105 -0
- package/test/components/checkbox.test.js +103 -0
- package/test/components/code-input.test.js +61 -0
- package/test/components/date-picker.test.js +18 -0
- package/test/components/drag.test.js +6 -0
- package/test/components/drop-down-menu.test.js +47 -0
- package/test/components/icon.test.js +65 -0
- package/test/components/image.test.js +64 -0
- package/test/components/index-list.test.js +77 -0
- package/test/components/input.test.js +82 -0
- package/test/components/loading.test.js +63 -0
- package/test/components/media-preview.test.js +46 -0
- package/test/components/message-box.test.js +118 -0
- package/test/components/notice-bar.test.js +59 -0
- package/test/components/number-keyboard.test.js +77 -0
- package/test/components/popup.test.js +20 -0
- package/test/components/price.test.js +116 -0
- package/test/components/progress.test.js +94 -0
- package/test/components/radio.test.js +98 -0
- package/test/components/rate.test.js +94 -0
- package/test/components/read-more.test.js +33 -0
- package/test/components/rich-text.test.js +20 -0
- package/test/components/scroll-to.test.js +54 -0
- package/test/components/search.test.js +107 -0
- package/test/components/select.test.js +111 -0
- package/test/components/signature.test.js +50 -0
- package/test/components/slider.test.js +69 -0
- package/test/components/stepper.test.js +113 -0
- package/test/components/steps.test.js +54 -0
- package/test/components/sticky.test.js +40 -0
- package/test/components/swipe-action.test.js +76 -0
- package/test/components/swiper.test.js +130 -0
- package/test/components/switch.test.js +53 -0
- package/test/components/tabs.test.js +273 -0
- package/test/components/text.test.js +17 -0
- package/test/components/touch-swipe.test.js +113 -0
- package/test/components/tour.test.js +146 -0
- package/test/components/tree.test.js +111 -0
- package/test/components/upload.test.js +116 -0
- package/test/components/video.test.js +48 -0
- package/test/methods.js +74 -0
- package/test/setup.js +32 -0
- package/test/utils/Color.test.js +26 -0
- package/test/utils/utils.test.js +42 -0
- package/uni.promisify.adaptor.js +10 -0
- package/uni.scss +4 -0
- package/uni_modules/stellar-ui/README.md +177 -0
- package/uni_modules/stellar-ui/common/css/common.scss +61 -0
- package/{components → uni_modules/stellar-ui/components}/ste-calendar/README.md +1 -1
- package/{components → uni_modules/stellar-ui/components}/ste-date-picker/ste-date-picker.vue +407 -407
- package/{components → uni_modules/stellar-ui/components}/ste-input/README.md +1 -1
- package/{components → uni_modules/stellar-ui/components}/ste-picker/ste-picker.vue +2 -2
- package/{components → uni_modules/stellar-ui/components}/ste-search/ste-search.vue +1 -1
- package/{components → uni_modules/stellar-ui/components}/ste-table/README.md +4 -4
- package/uni_modules/stellar-ui/package-lock.json +22 -0
- package/uni_modules/stellar-ui/package.json +18 -0
- package/vitest.config.js +14 -0
- package/vue.config.js +32 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-animate/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-animate/animate.scss +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-animate/ste-animate.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-badge/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-badge/ste-badge.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-barcode/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-barcode/encode2.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-barcode/ste-barcode.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-button/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-button/ste-button.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-calendar/self-date.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-calendar/ste-calendar.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-checkbox/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-checkbox/ste-checkbox.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-checkbox-group/ste-checkbox-group.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-code-input/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-code-input/ste-code-input.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-date-picker/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-drag/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-drag/ste-drag.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-dropdown-menu/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-dropdown-menu/ste-dropdown-menu.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-dropdown-menu-item/ste-dropdown-menu-item.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-icon/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-icon/iconfont.css +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-icon/ste-icon.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-image/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-image/ste-image.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-index-item/ste-index-item.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-index-list/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-index-list/ste-index-list.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-input/ste-input.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-loading/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-loading/ste-loading.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-media-preview/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-media-preview/TouchScaleing.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-media-preview/ste-media-preview.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-message-box/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-message-box/ste-message-box.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-message-box/ste-message-box.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-notice-bar/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-notice-bar/ste-notice-bar.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-number-keyboard/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-number-keyboard/keyboard.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-number-keyboard/ste-number-keyboard.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-popup/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-popup/ste-popup.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-price/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-price/ste-price.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-progress/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-progress/ste-progress.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-qrcode/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-qrcode/ste-qrcode.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-qrcode/uqrcode.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-radio/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-radio/ste-radio.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-radio-group/ste-radio-group.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-rate/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-rate/ste-rate.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-read-more/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-read-more/ste-read-more.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-rich-text/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-rich-text/ste-rich-text.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-scroll-to/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-scroll-to/mixin.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-scroll-to/ste-scroll-to.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-scroll-to-item/ste-scroll-to-item.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-search/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-select/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-select/datapager.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-select/datetime.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-select/defaultDate.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-select/ste-select.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-signature/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-signature/ste-signature.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-slider/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-slider/ste-slider.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-step/ste-step.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-stepper/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-stepper/ste-stepper.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-steps/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-steps/ste-steps.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-sticky/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-sticky/ste-sticky.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-swipe-action/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-swipe-action/ste-swipe-action.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-swipe-action-group/ste-swipe-action-group.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-swiper/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-swiper/ste-swiper.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-swiper-item/ste-swiper-item.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-switch/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-switch/ste-switch.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-tab/ste-tab.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-table/common.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-table/ste-table.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-table/utils.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-table-column/checkbox-icon.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-table-column/common.scss +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-table-column/radio-icon.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-table-column/ste-table-column.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-table-column/sub-table.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-table-column/table-popover.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-table-column/var.scss +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-tabs/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-tabs/props.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-tabs/ste-tabs.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-text/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-text/ste-text.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-toast/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-toast/ste-toast.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-toast/ste-toast.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-touch-swipe/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-touch-swipe/TouchEvent.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-touch-swipe/ste-touch-swipe.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-touch-swipe-item/ste-touch-swipe-item.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-tour/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-tour/ste-tour.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-tree/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-tree/ste-tree.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-upload/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-upload/ReadFile.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-upload/ste-upload.vue +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-video/README.md +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-video/props.js +0 -0
- /package/{components → uni_modules/stellar-ui/components}/ste-video/ste-video.vue +0 -0
- /package/{config → uni_modules/stellar-ui/config}/color.js +0 -0
- /package/{index.js → uni_modules/stellar-ui/index.js} +0 -0
- /package/{utils → uni_modules/stellar-ui/utils}/Color.js +0 -0
- /package/{utils → uni_modules/stellar-ui/utils}/System.js +0 -0
- /package/{utils → uni_modules/stellar-ui/utils}/dayjs.min.js +0 -0
- /package/{utils → uni_modules/stellar-ui/utils}/mixin.js +0 -0
- /package/{utils → uni_modules/stellar-ui/utils}/store.js +0 -0
- /package/{utils → uni_modules/stellar-ui/utils}/utils.js +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// 位置钩子函数
|
|
2
|
+
import utils from '@/common/utils.js';
|
|
3
|
+
|
|
4
|
+
let pxMenuButtonTop = -1; // 胶囊按钮top 单位 px
|
|
5
|
+
let pxMenuBottonBottom = -1; // 胶囊按钮bottom 单位 px
|
|
6
|
+
let pxMenuButtonHeight = -1; // 胶囊按钮height 单位 px
|
|
7
|
+
let pxMenuButtonWidth = -1; // 胶囊按钮width 单位 px
|
|
8
|
+
let pxMenuButtonLeft = -1; // 胶囊按钮left 单位 px
|
|
9
|
+
let pxMenuBottomRight = -1; // 胶囊按钮right 单位 px
|
|
10
|
+
let navbarHeight = -1; // 自定义导航栏高度 单位 rpx
|
|
11
|
+
let navbarWidth = -1; // 自定义导航栏宽度 单位 rpx
|
|
12
|
+
let navbarTop = -1; // 自定义导航栏顶部到屏幕顶部的高度 单位 rpx
|
|
13
|
+
let navbarBottom = -1; // 自定义导航栏底部到屏幕顶部的高度 单位 rpx
|
|
14
|
+
|
|
15
|
+
let tabbarHeight = -1;
|
|
16
|
+
|
|
17
|
+
let safeAreaInsetBottom = -1; // 底部安全距离
|
|
18
|
+
|
|
19
|
+
let addHeight = 16; // 加宽的高度,自定义导航的加宽的总高度为 addHeight * 2 单位rpx
|
|
20
|
+
|
|
21
|
+
let backgroundControlledHeight = 40; //背景图片可控距离 单位40rpx,背景图片会多做40px的高度
|
|
22
|
+
|
|
23
|
+
// ui设计图上使用的参考胶囊按钮bottom位置 单位rpx
|
|
24
|
+
// 设计图使用的iphone 13机型 px单位为83px,159.6153846153846为在iphone13下的rpx值
|
|
25
|
+
let designedMenuBottonBottom = 159.6153846153846;
|
|
26
|
+
let backgroundPositionY = -1; // 背景图片精确适配胶囊按钮后的 background-position ypos的值,单位rpx
|
|
27
|
+
|
|
28
|
+
let systemInfo = utils.getWindowInfo();
|
|
29
|
+
// 手机可使用区域的高度 单位rpx
|
|
30
|
+
let windowHeight = utils.px2rpx(systemInfo.windowHeight);
|
|
31
|
+
// 手机可使用区域的高度 单位px
|
|
32
|
+
let pxWindowHeight = systemInfo.windowHeight;
|
|
33
|
+
// 手机可使用区域的宽度 单位rpx
|
|
34
|
+
let windowWidth = utils.px2rpx(systemInfo.windowWidth);
|
|
35
|
+
// 手机可使用区域的宽度 单位px
|
|
36
|
+
let pxWindowWidth = systemInfo.windowWidth;
|
|
37
|
+
let flag = false;
|
|
38
|
+
function getData(menuButtonInfo) {
|
|
39
|
+
if (pxMenuButtonTop === -1) {
|
|
40
|
+
// #ifdef H5
|
|
41
|
+
|
|
42
|
+
pxMenuButtonTop = 55;
|
|
43
|
+
pxMenuBottonBottom = 92;
|
|
44
|
+
pxMenuButtonWidth = 87;
|
|
45
|
+
pxMenuButtonHeight = 26;
|
|
46
|
+
pxMenuButtonLeft = 281;
|
|
47
|
+
pxMenuBottomRight = 368;
|
|
48
|
+
// #endif
|
|
49
|
+
|
|
50
|
+
// #ifdef MP
|
|
51
|
+
pxMenuButtonTop = menuButtonInfo.top;
|
|
52
|
+
pxMenuBottonBottom = menuButtonInfo.bottom;
|
|
53
|
+
pxMenuButtonWidth = menuButtonInfo.width;
|
|
54
|
+
pxMenuButtonHeight = menuButtonInfo.height;
|
|
55
|
+
pxMenuButtonLeft = menuButtonInfo.left;
|
|
56
|
+
pxMenuBottomRight = menuButtonInfo.right;
|
|
57
|
+
// #endif
|
|
58
|
+
// 支付宝开发工具的胶囊按钮数据是错误的,使用固定数据适配开发工具
|
|
59
|
+
// #ifdef MP-ALIPAY
|
|
60
|
+
if (systemInfo.platform === 'devtools') {
|
|
61
|
+
pxMenuButtonTop = 55;
|
|
62
|
+
pxMenuBottonBottom = 92;
|
|
63
|
+
pxMenuButtonWidth = 87;
|
|
64
|
+
pxMenuButtonHeight = 26;
|
|
65
|
+
pxMenuButtonLeft = 281;
|
|
66
|
+
pxMenuBottomRight = 368;
|
|
67
|
+
}
|
|
68
|
+
// #endif
|
|
69
|
+
|
|
70
|
+
navbarTop = utils.px2rpx(pxMenuButtonTop - uni.upx2px(addHeight));
|
|
71
|
+
navbarWidth = utils.px2rpx(pxMenuButtonLeft);
|
|
72
|
+
navbarHeight = utils.px2rpx(pxMenuButtonHeight + uni.upx2px(addHeight * 2));
|
|
73
|
+
navbarBottom = utils.px2rpx(pxMenuBottonBottom + uni.upx2px(addHeight));
|
|
74
|
+
if (systemInfo.safeAreaInsets == null || systemInfo.safeAreaInsets.bottom == 0) {
|
|
75
|
+
safeAreaInsetBottom = 20;
|
|
76
|
+
} else {
|
|
77
|
+
safeAreaInsetBottom = utils.px2rpx(systemInfo.safeAreaInsets.bottom);
|
|
78
|
+
}
|
|
79
|
+
// 计算tabbar的总高度,包含安全距离 单位 rpx
|
|
80
|
+
tabbarHeight = 0;
|
|
81
|
+
tabbarHeight += 94;
|
|
82
|
+
tabbarHeight += safeAreaInsetBottom;
|
|
83
|
+
// 背景图片精确适配胶囊按钮后的 background-position ypos的值,单位rpx
|
|
84
|
+
backgroundPositionY = -backgroundControlledHeight + utils.px2rpx(pxMenuBottonBottom) - designedMenuBottonBottom;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// 仅支付宝用,支付宝偶尔会在第一时间拿不到数据,通过延迟方法得到数据
|
|
88
|
+
function refreshData(pageThis) {
|
|
89
|
+
setTimeout(() => {
|
|
90
|
+
let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
|
|
91
|
+
if (menuButtonInfo.error == 1111) {
|
|
92
|
+
// 支付宝有可能得不到胶囊按钮信息
|
|
93
|
+
refreshData(pageThis);
|
|
94
|
+
} else {
|
|
95
|
+
getData(menuButtonInfo);
|
|
96
|
+
pageThis.navbarTop = navbarTop;
|
|
97
|
+
pageThis.navbarBottom = navbarBottom;
|
|
98
|
+
pageThis.navbarWidth = navbarWidth;
|
|
99
|
+
pageThis.navbarHeight = navbarHeight;
|
|
100
|
+
pageThis.safeAreaInsetBottom = safeAreaInsetBottom;
|
|
101
|
+
pageThis.backgroundPositionY = backgroundPositionY;
|
|
102
|
+
pageThis.tabbarHeight = tabbarHeight;
|
|
103
|
+
pageThis.windowHeight = windowHeight;
|
|
104
|
+
pageThis.windowWidth = windowWidth;
|
|
105
|
+
}
|
|
106
|
+
}, 100);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
let usePosition = function () {
|
|
110
|
+
if (pxMenuButtonTop === -1) {
|
|
111
|
+
let menuButtonInfo = null;
|
|
112
|
+
// #ifdef H5
|
|
113
|
+
getData(menuButtonInfo);
|
|
114
|
+
// #endif
|
|
115
|
+
// #ifdef MP-WEIXIN
|
|
116
|
+
menuButtonInfo = wx.getMenuButtonBoundingClientRect();
|
|
117
|
+
getData(menuButtonInfo);
|
|
118
|
+
// #endif
|
|
119
|
+
|
|
120
|
+
// #ifdef MP-ALIPAY
|
|
121
|
+
menuButtonInfo = my.getMenuButtonBoundingClientRect();
|
|
122
|
+
if (menuButtonInfo.error == 1111) {
|
|
123
|
+
// 支付宝有可能得不到胶囊按钮信息
|
|
124
|
+
} else {
|
|
125
|
+
getData(menuButtonInfo);
|
|
126
|
+
}
|
|
127
|
+
// #endif
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
/**自定义导航栏高度 单位 rpx*/
|
|
131
|
+
navbarHeight,
|
|
132
|
+
/**自定义导航栏宽度 单位 rpx*/
|
|
133
|
+
navbarWidth,
|
|
134
|
+
/**自定义导航栏顶部到屏幕顶部的高度 单位 rpx*/
|
|
135
|
+
navbarTop,
|
|
136
|
+
/**自定义导航栏底部到屏幕顶部的高度 单位 rpx*/
|
|
137
|
+
navbarBottom,
|
|
138
|
+
/**安全距离*/
|
|
139
|
+
safeAreaInsetBottom,
|
|
140
|
+
/**背景图片精确适配胶囊按钮后的 background-position ypos的值,单位rpx*/
|
|
141
|
+
backgroundPositionY,
|
|
142
|
+
/**计算tabbar的总高度,包含安全距离 单位 rpx*/
|
|
143
|
+
tabbarHeight,
|
|
144
|
+
/**手机可使用区域的高度 单位rpx*/
|
|
145
|
+
windowHeight,
|
|
146
|
+
/**手机可使用区域的高度 单位px*/
|
|
147
|
+
pxWindowHeight,
|
|
148
|
+
/**手机可使用区域的宽度 单位rpx*/
|
|
149
|
+
windowWidth,
|
|
150
|
+
/**手机可使用区域的宽度 单位px*/
|
|
151
|
+
pxWindowWidth,
|
|
152
|
+
/**支付宝专用方法 刷新数据
|
|
153
|
+
/*@pageThis 将this传进入,会将所有this上和pos上名称一致的属性,自动赋值
|
|
154
|
+
*/
|
|
155
|
+
refreshData,
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export default usePosition;
|
package/common/utils.js
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import config from './config.js';
|
|
2
|
+
|
|
3
|
+
let throLast = 0; // 节流方法用变量
|
|
4
|
+
let throTimer = null; // 节流方法用的变量
|
|
5
|
+
let windowWidth = null;
|
|
6
|
+
let utils = {
|
|
7
|
+
/**px转rpx*/
|
|
8
|
+
px2rpx(px) {
|
|
9
|
+
if (windowWidth == null) {
|
|
10
|
+
windowWidth = this.getWindowInfo().windowWidth;
|
|
11
|
+
}
|
|
12
|
+
let rpx = (px * 750) / windowWidth;
|
|
13
|
+
return rpx;
|
|
14
|
+
},
|
|
15
|
+
/**rpx转px 比uni.upx2px精度更高*/
|
|
16
|
+
rpx2px(rpx) {
|
|
17
|
+
if (!rpx) return '0px';
|
|
18
|
+
if (windowWidth == null) {
|
|
19
|
+
windowWidth = this.getWindowInfo().windowWidth;
|
|
20
|
+
}
|
|
21
|
+
let px = (parseInt(rpx) * windowWidth) / 750;
|
|
22
|
+
return `${px}px`;
|
|
23
|
+
},
|
|
24
|
+
/**兼容css中的单位
|
|
25
|
+
* 如果值为数字,则拼接 'rpx',否则直接返回字符串的值
|
|
26
|
+
*/
|
|
27
|
+
addUnit(val) {
|
|
28
|
+
let newVal;
|
|
29
|
+
if (this.isNumber(val)) {
|
|
30
|
+
newVal = val + 'rpx';
|
|
31
|
+
} else {
|
|
32
|
+
newVal = val;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// #ifdef H5
|
|
36
|
+
if (newVal.indexOf('rpx') >= 0) {
|
|
37
|
+
newVal = this.rpx2px(newVal);
|
|
38
|
+
}
|
|
39
|
+
// #endif
|
|
40
|
+
return newVal;
|
|
41
|
+
},
|
|
42
|
+
/**拼接image的src
|
|
43
|
+
* val 图片地址
|
|
44
|
+
* isTheme 是否包含皮肤
|
|
45
|
+
* systemThemeBaseUrl 系统皮肤路径
|
|
46
|
+
*/
|
|
47
|
+
joinSrc(val, isTheme = false, systemTheme = null) {
|
|
48
|
+
if (val === '' || val == null) {
|
|
49
|
+
val = '空图片/空图片.png';
|
|
50
|
+
// val = 'none'
|
|
51
|
+
}
|
|
52
|
+
// 如果图片地址包含http https前缀,则不拼接全局图片前缀
|
|
53
|
+
let baseUrl = '';
|
|
54
|
+
systemTheme = systemTheme ?? config.IMAGE_SYSTEM_THENE;
|
|
55
|
+
if (/^(data:image|wxfile:)/g.test(val)) {
|
|
56
|
+
return val;
|
|
57
|
+
} else if (/^(http:|https:)/g.test(val)) {
|
|
58
|
+
return val + '?' + new Date().getTime();
|
|
59
|
+
} else {
|
|
60
|
+
baseUrl = config.IMAGE_BASE_URL;
|
|
61
|
+
baseUrl += isTheme ? systemTheme : config.IMAGE_COMMON;
|
|
62
|
+
return baseUrl + val + '?' + new Date().getTime();
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
/**拼接background的url,支持 joinUrl('图片.png no-repeat cover/100% 100%')完整写法
|
|
66
|
+
* val 图片地址
|
|
67
|
+
* isTheme 是否包含皮肤
|
|
68
|
+
* systemThemeBaseUrl 系统皮肤路径
|
|
69
|
+
*/
|
|
70
|
+
joinUrl(val, isTheme = false, systemTheme = null) {
|
|
71
|
+
if (val === '' || val == null) {
|
|
72
|
+
// val = '空图片/空图片.png'
|
|
73
|
+
return 'none';
|
|
74
|
+
}
|
|
75
|
+
// 如果图片地址包含http https前缀,则不拼接全局图片前缀
|
|
76
|
+
let baseUrl = '';
|
|
77
|
+
systemTheme = systemTheme ?? config.IMAGE_SYSTEM_THENE;
|
|
78
|
+
if (/^(http:|https:)/g.test(val) === false) {
|
|
79
|
+
baseUrl = config.IMAGE_BASE_URL;
|
|
80
|
+
baseUrl += isTheme ? systemTheme : config.IMAGE_COMMON;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 第一个空格后面的内容,拼接到url外面去
|
|
84
|
+
let index = val.indexOf(' ');
|
|
85
|
+
let str = '';
|
|
86
|
+
let url = '';
|
|
87
|
+
let other = '';
|
|
88
|
+
if (index > 0) {
|
|
89
|
+
url = val.substr(0, index) + '?' + new Date().getTime();
|
|
90
|
+
other = val.substr(index + 1);
|
|
91
|
+
str = `url('${baseUrl}${url}') ${other}`;
|
|
92
|
+
} else {
|
|
93
|
+
url = val + '?' + new Date().getTime();
|
|
94
|
+
str = `url('${baseUrl}${url}')`;
|
|
95
|
+
}
|
|
96
|
+
return str;
|
|
97
|
+
},
|
|
98
|
+
/**字符串是否为数字
|
|
99
|
+
*@value 要判断的字符串
|
|
100
|
+
*/
|
|
101
|
+
isNumber(value) {
|
|
102
|
+
return !isNaN(parseFloat(value)) && isFinite(value);
|
|
103
|
+
},
|
|
104
|
+
/**分转元
|
|
105
|
+
*@val 传入的分
|
|
106
|
+
*@digits 精度,-1 不使用精度 0 保留0位小数 1 保留1位小数 2保留2位小数
|
|
107
|
+
*@defaultVal 默认值
|
|
108
|
+
*@part 取值部分 0 取全部值 1 取元部分 2取角分部分
|
|
109
|
+
*/
|
|
110
|
+
fenToYuan(val, digits = -1, defaultVal = '', part = 0) {
|
|
111
|
+
let part1 = Math.floor(val / 100); // 元部分
|
|
112
|
+
let part2 = val % 100; // 角分部分
|
|
113
|
+
let newVal = '';
|
|
114
|
+
if (val == null || val === '') {
|
|
115
|
+
newVal = defaultVal;
|
|
116
|
+
} else {
|
|
117
|
+
if (digits === -1) {
|
|
118
|
+
newVal = val / 100;
|
|
119
|
+
} else {
|
|
120
|
+
newVal = (val / 100).toFixed(digits);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
newVal = String(newVal);
|
|
124
|
+
// 取全部
|
|
125
|
+
if (part === 0) {
|
|
126
|
+
return newVal;
|
|
127
|
+
// 取元部分
|
|
128
|
+
} else if (part === 1) {
|
|
129
|
+
return newVal.split('.')[0];
|
|
130
|
+
// 取角分部分
|
|
131
|
+
} else if (part === 2) {
|
|
132
|
+
if (newVal.split('.').length > 1) {
|
|
133
|
+
return '.' + newVal.split('.')[1];
|
|
134
|
+
} else {
|
|
135
|
+
return '';
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
/**节流
|
|
140
|
+
*@fn 要节流的方法
|
|
141
|
+
*@args 要节流方法的参数,如果最后一个参数是 {delay:2000},则该参数为节流时间参数,不记入方法参数
|
|
142
|
+
*/
|
|
143
|
+
thro(fn, ...args) {
|
|
144
|
+
let delay = 500;
|
|
145
|
+
let lastArgs = null;
|
|
146
|
+
if (args.length > 0) {
|
|
147
|
+
lastArgs = args[args.length - 1];
|
|
148
|
+
if (lastArgs?.delay != null) {
|
|
149
|
+
delay = lastArgs.delay;
|
|
150
|
+
args.pop();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
let now = new Date().getTime();
|
|
154
|
+
if (throLast === 0 || now - throLast > delay) {
|
|
155
|
+
clearTimeout(throTimer);
|
|
156
|
+
fn.call(this, ...args);
|
|
157
|
+
throLast = now;
|
|
158
|
+
throTimer = setTimeout(() => {
|
|
159
|
+
throLast = 0;
|
|
160
|
+
}, delay);
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
/**
|
|
164
|
+
* 替换html默认样式
|
|
165
|
+
* @html 要替换的文本
|
|
166
|
+
* @tag 标签名
|
|
167
|
+
* @checkProperties 检测的样式属性,如果存在该属性,则不添加样式,支持字符串和数组
|
|
168
|
+
* @replaceProperty 替换后的样式属性值
|
|
169
|
+
*/
|
|
170
|
+
richTextTagAddStyle(html, tag, checkProperties, replaceProperty) {
|
|
171
|
+
// 如果checkProperties为字符串,转成字符串数组
|
|
172
|
+
if (Object.prototype.toString.call(checkProperties) === '[object String]') {
|
|
173
|
+
checkProperties = [checkProperties];
|
|
174
|
+
}
|
|
175
|
+
// 构建正则表达式模式
|
|
176
|
+
var pattern = new RegExp(`<${tag}\\b((?:[^>]*\\s+)?style="[^"]*")?[^>]*>`, 'gi');
|
|
177
|
+
|
|
178
|
+
// 查找匹配的标签
|
|
179
|
+
var matches = html.match(pattern);
|
|
180
|
+
// 遍历匹配的标签并替换属性样式
|
|
181
|
+
if (matches) {
|
|
182
|
+
for (var i = 0; i < matches.length; i++) {
|
|
183
|
+
var match = matches[i];
|
|
184
|
+
var styleMatch = match.match(/style="([^"]+)"/i); // 提取标签中的style属性
|
|
185
|
+
|
|
186
|
+
if (styleMatch) {
|
|
187
|
+
var styleValue = styleMatch[1];
|
|
188
|
+
var styleProperties = styleValue.split(';');
|
|
189
|
+
|
|
190
|
+
// 检查样式属性是否符合要求
|
|
191
|
+
var hasMatchingProperty = false;
|
|
192
|
+
for (var j = 0; j < styleProperties.length; j++) {
|
|
193
|
+
var styleProperty = styleProperties[j].trim();
|
|
194
|
+
|
|
195
|
+
// 检查属性名是否完全匹配
|
|
196
|
+
var attributeName = styleProperty.split(':')[0].trim();
|
|
197
|
+
if (checkProperties.includes(attributeName)) {
|
|
198
|
+
hasMatchingProperty = true;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// 如果标签匹配且样式属性不符合要求,则替换或添加指定属性的样式
|
|
204
|
+
if (!hasMatchingProperty) {
|
|
205
|
+
var replacedMatch = match.replace(/(style="[^"]*)(")/, `$1${replaceProperty}"`);
|
|
206
|
+
html = html.replace(match, replacedMatch);
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
// 如果标签中没有样式属性,则添加指定属性的样式
|
|
210
|
+
var replacedMatch = match.replace('>', ` style="${replaceProperty}">`);
|
|
211
|
+
html = html.replace(match, replacedMatch);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// 返回替换后的HTML文本
|
|
217
|
+
return html;
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
220
|
+
* 获取设备设置
|
|
221
|
+
*/
|
|
222
|
+
getSystemSetting() {
|
|
223
|
+
// #ifdef MP-WEIXIN
|
|
224
|
+
return wx.getSystemSetting();
|
|
225
|
+
// #endif
|
|
226
|
+
|
|
227
|
+
// #ifndef MP-WEIXIN
|
|
228
|
+
return uni.getSystemInfoSync();
|
|
229
|
+
// #endif
|
|
230
|
+
},
|
|
231
|
+
/**
|
|
232
|
+
* 获取微信APP授权设置
|
|
233
|
+
*/
|
|
234
|
+
getAppAuthorizeSetting() {
|
|
235
|
+
// #ifdef MP-WEIXIN
|
|
236
|
+
return wx.getAppAuthorizeSetting();
|
|
237
|
+
// #endif
|
|
238
|
+
|
|
239
|
+
// #ifndef MP-WEIXIN
|
|
240
|
+
return uni.getSystemInfoSync();
|
|
241
|
+
// #endif
|
|
242
|
+
},
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* 获取设备基础信息
|
|
246
|
+
*/
|
|
247
|
+
getDeviceInfo() {
|
|
248
|
+
// #ifdef MP-WEIXIN
|
|
249
|
+
return wx.getDeviceInfo();
|
|
250
|
+
// #endif
|
|
251
|
+
|
|
252
|
+
// #ifndef MP-WEIXIN
|
|
253
|
+
return uni.getSystemInfoSync();
|
|
254
|
+
// #endif
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* 获取窗口信息
|
|
259
|
+
*/
|
|
260
|
+
getWindowInfo() {
|
|
261
|
+
// #ifdef MP-WEIXIN
|
|
262
|
+
let windowInfo = wx.getWindowInfo();
|
|
263
|
+
windowInfo.safeAreaInsets = {
|
|
264
|
+
bottom: windowInfo.screenHeight - windowInfo.safeArea.bottom,
|
|
265
|
+
};
|
|
266
|
+
return windowInfo;
|
|
267
|
+
// #endif
|
|
268
|
+
|
|
269
|
+
// #ifndef MP-WEIXIN
|
|
270
|
+
return uni.getSystemInfoSync();
|
|
271
|
+
// #endif
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* 获取微信APP基础信息
|
|
276
|
+
*/
|
|
277
|
+
getAppBaseInfo() {
|
|
278
|
+
// #ifdef MP-WEIXIN
|
|
279
|
+
return wx.getAppBaseInfo();
|
|
280
|
+
// #endif
|
|
281
|
+
|
|
282
|
+
// #ifndef MP-WEIXIN
|
|
283
|
+
return uni.getSystemInfoSync();
|
|
284
|
+
// #endif
|
|
285
|
+
},
|
|
286
|
+
querySelector(selectors, component, all = false) {
|
|
287
|
+
const selectFn = all ? 'selectAll' : 'select';
|
|
288
|
+
return new Promise((resolve, reject) => {
|
|
289
|
+
try {
|
|
290
|
+
uni.createSelectorQuery()
|
|
291
|
+
.in(component)[selectFn](selectors)
|
|
292
|
+
.boundingClientRect((data) => {
|
|
293
|
+
resolve(data);
|
|
294
|
+
})
|
|
295
|
+
.exec();
|
|
296
|
+
} catch (e) {
|
|
297
|
+
reject(e);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
},
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
export default utils;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="demo-view-item" :class="{ hidden: !dataOpen }">
|
|
3
|
+
<view class="item-title" @click="onOpen">
|
|
4
|
+
<view class="title-text">{{ title }}</view>
|
|
5
|
+
<view class="title-icon">
|
|
6
|
+
<ste-icon code="" size="20" />
|
|
7
|
+
</view>
|
|
8
|
+
</view>
|
|
9
|
+
<view class="item-content">
|
|
10
|
+
<slot />
|
|
11
|
+
</view>
|
|
12
|
+
</view>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
export default {
|
|
17
|
+
props: {
|
|
18
|
+
title: String,
|
|
19
|
+
open: Boolean,
|
|
20
|
+
},
|
|
21
|
+
data() {
|
|
22
|
+
return {
|
|
23
|
+
dataOpen: false,
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
watch: {
|
|
27
|
+
open: {
|
|
28
|
+
handler(v) {
|
|
29
|
+
this.dataOpen = v;
|
|
30
|
+
},
|
|
31
|
+
immediate: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
onOpen() {
|
|
36
|
+
this.dataOpen = !this.dataOpen;
|
|
37
|
+
this.$emit('change', this.dataOpen);
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<style lang="scss" scoped>
|
|
44
|
+
.demo-view-item {
|
|
45
|
+
width: 100%;
|
|
46
|
+
margin-bottom: 30rpx;
|
|
47
|
+
.item-title {
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 60rpx;
|
|
50
|
+
font-size: 28rpx;
|
|
51
|
+
color: #666;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: space-between;
|
|
55
|
+
background-color: #f5f5f5;
|
|
56
|
+
padding: 0 18rpx;
|
|
57
|
+
.title-icon {
|
|
58
|
+
width: 20rpx;
|
|
59
|
+
height: 20rpx;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
transition: 0.3s;
|
|
64
|
+
transform: rotate(180deg);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
.item-content {
|
|
68
|
+
top: -100%;
|
|
69
|
+
border: 1px solid #ddd;
|
|
70
|
+
padding: 18rpx;
|
|
71
|
+
}
|
|
72
|
+
&.hidden {
|
|
73
|
+
height: 60rpx;
|
|
74
|
+
.title-icon {
|
|
75
|
+
transform: rotate(0);
|
|
76
|
+
}
|
|
77
|
+
.item-content {
|
|
78
|
+
height: 0;
|
|
79
|
+
padding: 0 18rpx;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
</style>
|