stellar-ui-plus 1.16.18
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/README.md +176 -0
- package/common/css/common.scss +19 -0
- package/common/useProps.js +9 -0
- package/components/ste-animate/ATTRIBUTES.md +10 -0
- package/components/ste-animate/README.md +115 -0
- package/components/ste-animate/animate.scss +247 -0
- package/components/ste-animate/config.json +5 -0
- package/components/ste-animate/props.ts +9 -0
- package/components/ste-animate/ste-animate.easycom.json +39 -0
- package/components/ste-animate/ste-animate.scss +113 -0
- package/components/ste-animate/ste-animate.vue +67 -0
- package/components/ste-badge/ATTRIBUTES.md +17 -0
- package/components/ste-badge/README.md +162 -0
- package/components/ste-badge/config.json +5 -0
- package/components/ste-badge/props.ts +17 -0
- package/components/ste-badge/ste-badge.easycom.json +96 -0
- package/components/ste-badge/ste-badge.vue +157 -0
- package/components/ste-barcode/ATTRIBUTES.md +14 -0
- package/components/ste-barcode/README.md +28 -0
- package/components/ste-barcode/config.json +5 -0
- package/components/ste-barcode/encode.ts +317 -0
- package/components/ste-barcode/props.ts +7 -0
- package/components/ste-barcode/ste-barcode.easycom.json +44 -0
- package/components/ste-barcode/ste-barcode.vue +152 -0
- package/components/ste-button/ATTRIBUTES.md +32 -0
- package/components/ste-button/README.md +119 -0
- package/components/ste-button/config.json +5 -0
- package/components/ste-button/props.ts +21 -0
- package/components/ste-button/ste-button.easycom.json +168 -0
- package/components/ste-button/ste-button.vue +275 -0
- package/components/ste-calendar/ATTRIBUTES.md +31 -0
- package/components/ste-calendar/README.md +241 -0
- package/components/ste-calendar/config.json +5 -0
- package/components/ste-calendar/date.ts +110 -0
- package/components/ste-calendar/props.ts +26 -0
- package/components/ste-calendar/ste-calendar.easycom.json +172 -0
- package/components/ste-calendar/ste-calendar.vue +376 -0
- package/components/ste-calendar/useData.ts +30 -0
- package/components/ste-checkbox/ATTRIBUTES.md +25 -0
- package/components/ste-checkbox/README.md +302 -0
- package/components/ste-checkbox/config.json +5 -0
- package/components/ste-checkbox/props.ts +33 -0
- package/components/ste-checkbox/ste-checkbox.easycom.json +151 -0
- package/components/ste-checkbox/ste-checkbox.vue +206 -0
- package/components/ste-checkbox/type.d.ts +2 -0
- package/components/ste-checkbox-group/props.ts +34 -0
- package/components/ste-checkbox-group/ste-checkbox-group.vue +34 -0
- package/components/ste-code-input/ATTRIBUTES.md +22 -0
- package/components/ste-code-input/README.md +56 -0
- package/components/ste-code-input/config.json +5 -0
- package/components/ste-code-input/props.ts +19 -0
- package/components/ste-code-input/ste-code-input.easycom.json +99 -0
- package/components/ste-code-input/ste-code-input.vue +222 -0
- package/components/ste-date-picker/ATTRIBUTES.md +25 -0
- package/components/ste-date-picker/README.md +119 -0
- package/components/ste-date-picker/config.json +5 -0
- package/components/ste-date-picker/props.ts +62 -0
- package/components/ste-date-picker/ste-date-picker.easycom.json +137 -0
- package/components/ste-date-picker/ste-date-picker.vue +290 -0
- package/components/ste-date-picker/types.d.ts +3 -0
- package/components/ste-drag/ATTRIBUTES.md +13 -0
- package/components/ste-drag/README.md +88 -0
- package/components/ste-drag/config.json +5 -0
- package/components/ste-drag/props.ts +10 -0
- package/components/ste-drag/ste-drag.easycom.json +50 -0
- package/components/ste-drag/ste-drag.vue +172 -0
- package/components/ste-dropdown-menu/ATTRIBUTES.md +22 -0
- package/components/ste-dropdown-menu/README.md +325 -0
- package/components/ste-dropdown-menu/config.json +5 -0
- package/components/ste-dropdown-menu/constans.ts +4 -0
- package/components/ste-dropdown-menu/props.ts +30 -0
- package/components/ste-dropdown-menu/ste-dropdown-menu.easycom.json +111 -0
- package/components/ste-dropdown-menu/ste-dropdown-menu.scss +99 -0
- package/components/ste-dropdown-menu/ste-dropdown-menu.vue +223 -0
- package/components/ste-dropdown-menu-item/props.ts +17 -0
- package/components/ste-dropdown-menu-item/ste-dropdown-menu-item.scss +61 -0
- package/components/ste-dropdown-menu-item/ste-dropdown-menu-item.vue +84 -0
- package/components/ste-dropdown-menu-item/type.d.ts +4 -0
- package/components/ste-icon/ATTRIBUTES.md +19 -0
- package/components/ste-icon/README.md +72 -0
- package/components/ste-icon/config.json +5 -0
- package/components/ste-icon/iconfont.css +22 -0
- package/components/ste-icon/props.ts +14 -0
- package/components/ste-icon/ste-icon.easycom.json +71 -0
- package/components/ste-icon/ste-icon.vue +80 -0
- package/components/ste-image/ATTRIBUTES.md +21 -0
- package/components/ste-image/README.md +118 -0
- package/components/ste-image/config.json +5 -0
- package/components/ste-image/props.ts +15 -0
- package/components/ste-image/ste-image.easycom.json +189 -0
- package/components/ste-image/ste-image.vue +146 -0
- package/components/ste-index-item/props.ts +4 -0
- package/components/ste-index-item/ste-index-item.vue +83 -0
- package/components/ste-index-list/ATTRIBUTES.md +15 -0
- package/components/ste-index-list/README.md +138 -0
- package/components/ste-index-list/config.json +5 -0
- package/components/ste-index-list/props.ts +17 -0
- package/components/ste-index-list/ste-index-list.easycom.json +48 -0
- package/components/ste-index-list/ste-index-list.vue +109 -0
- package/components/ste-input/ATTRIBUTES.md +37 -0
- package/components/ste-input/README.md +130 -0
- package/components/ste-input/config.json +5 -0
- package/components/ste-input/props.ts +46 -0
- package/components/ste-input/ste-input.easycom.json +282 -0
- package/components/ste-input/ste-input.scss +124 -0
- package/components/ste-input/ste-input.vue +221 -0
- package/components/ste-loading/ATTRIBUTES.md +11 -0
- package/components/ste-loading/README.md +74 -0
- package/components/ste-loading/config.json +5 -0
- package/components/ste-loading/props.ts +8 -0
- package/components/ste-loading/ste-loading.easycom.json +54 -0
- package/components/ste-loading/ste-loading.vue +127 -0
- package/components/ste-media-preview/ATTRIBUTES.md +20 -0
- package/components/ste-media-preview/README.md +252 -0
- package/components/ste-media-preview/TouchScaleing.ts +117 -0
- package/components/ste-media-preview/config.json +5 -0
- package/components/ste-media-preview/props.ts +12 -0
- package/components/ste-media-preview/ste-media-preview.easycom.json +88 -0
- package/components/ste-media-preview/ste-media-preview.vue +201 -0
- package/components/ste-media-preview/useData.ts +63 -0
- package/components/ste-message-box/ATTRIBUTES.md +6 -0
- package/components/ste-message-box/README.md +222 -0
- package/components/ste-message-box/config.json +5 -0
- package/components/ste-message-box/constants.ts +25 -0
- package/components/ste-message-box/ste-message-box.easycom.json +14 -0
- package/components/ste-message-box/ste-message-box.ts +1 -0
- package/components/ste-message-box/ste-message-box.vue +355 -0
- package/components/ste-message-box/use-message-box.ts +26 -0
- package/components/ste-message-box/useData.ts +56 -0
- package/components/ste-notice-bar/ATTRIBUTES.md +22 -0
- package/components/ste-notice-bar/README.md +124 -0
- package/components/ste-notice-bar/config.json +5 -0
- package/components/ste-notice-bar/props.ts +15 -0
- package/components/ste-notice-bar/ste-notice-bar.easycom.json +109 -0
- package/components/ste-notice-bar/ste-notice-bar.vue +262 -0
- package/components/ste-number-keyboard/ATTRIBUTES.md +31 -0
- package/components/ste-number-keyboard/KeyboardVue.vue +142 -0
- package/components/ste-number-keyboard/README.md +192 -0
- package/components/ste-number-keyboard/config.json +5 -0
- package/components/ste-number-keyboard/props.ts +35 -0
- package/components/ste-number-keyboard/ste-number-keyboard.easycom.json +177 -0
- package/components/ste-number-keyboard/ste-number-keyboard.vue +81 -0
- package/components/ste-number-keyboard/useData.ts +144 -0
- package/components/ste-picker/props.ts +16 -0
- package/components/ste-picker/ste-picker.vue +194 -0
- package/components/ste-popup/ATTRIBUTES.md +24 -0
- package/components/ste-popup/README.md +135 -0
- package/components/ste-popup/config.json +6 -0
- package/components/ste-popup/event.ts +0 -0
- package/components/ste-popup/props.ts +19 -0
- package/components/ste-popup/ste-popup.easycom.json +122 -0
- package/components/ste-popup/ste-popup.vue +253 -0
- package/components/ste-price/ATTRIBUTES.md +26 -0
- package/components/ste-price/README.md +110 -0
- package/components/ste-price/config.json +5 -0
- package/components/ste-price/props.ts +23 -0
- package/components/ste-price/ste-price.easycom.json +154 -0
- package/components/ste-price/ste-price.vue +148 -0
- package/components/ste-progress/ATTRIBUTES.md +17 -0
- package/components/ste-progress/README.md +88 -0
- package/components/ste-progress/config.json +5 -0
- package/components/ste-progress/props.ts +16 -0
- package/components/ste-progress/ste-progress.easycom.json +80 -0
- package/components/ste-progress/ste-progress.vue +135 -0
- package/components/ste-qrcode/ATTRIBUTES.md +16 -0
- package/components/ste-qrcode/README.md +34 -0
- package/components/ste-qrcode/config.json +5 -0
- package/components/ste-qrcode/props.ts +16 -0
- package/components/ste-qrcode/ste-qrcode.easycom.json +56 -0
- package/components/ste-qrcode/ste-qrcode.vue +134 -0
- package/components/ste-qrcode/uqrcode.d.ts +57 -0
- package/components/ste-qrcode/uqrcode.js +34 -0
- package/components/ste-radio/ATTRIBUTES.md +25 -0
- package/components/ste-radio/README.md +260 -0
- package/components/ste-radio/config.json +5 -0
- package/components/ste-radio/props.ts +33 -0
- package/components/ste-radio/ste-radio.easycom.json +150 -0
- package/components/ste-radio/ste-radio.vue +188 -0
- package/components/ste-radio/type.d.ts +2 -0
- package/components/ste-radio-group/props.ts +33 -0
- package/components/ste-radio-group/ste-radio-group.vue +34 -0
- package/components/ste-rate/ATTRIBUTES.md +21 -0
- package/components/ste-rate/README.md +97 -0
- package/components/ste-rate/config.json +5 -0
- package/components/ste-rate/props.ts +16 -0
- package/components/ste-rate/ste-rate.easycom.json +85 -0
- package/components/ste-rate/ste-rate.vue +143 -0
- package/components/ste-read-more/ATTRIBUTES.md +16 -0
- package/components/ste-read-more/README.md +93 -0
- package/components/ste-read-more/config.json +5 -0
- package/components/ste-read-more/props.ts +9 -0
- package/components/ste-read-more/ste-read-more.easycom.json +54 -0
- package/components/ste-read-more/ste-read-more.vue +106 -0
- package/components/ste-rich-text/ATTRIBUTES.md +8 -0
- package/components/ste-rich-text/README.md +26 -0
- package/components/ste-rich-text/config.json +5 -0
- package/components/ste-rich-text/props.ts +8 -0
- package/components/ste-rich-text/ste-rich-text.easycom.json +40 -0
- package/components/ste-rich-text/ste-rich-text.vue +33 -0
- package/components/ste-scroll-to/ATTRIBUTES.md +11 -0
- package/components/ste-scroll-to/README.md +47 -0
- package/components/ste-scroll-to/config.json +5 -0
- package/components/ste-scroll-to/props.ts +17 -0
- package/components/ste-scroll-to/ste-scroll-to.easycom.json +25 -0
- package/components/ste-scroll-to/ste-scroll-to.vue +42 -0
- package/components/ste-scroll-to/useData.ts +214 -0
- package/components/ste-scroll-to-item/ste-scroll-to-item.vue +24 -0
- package/components/ste-search/ATTRIBUTES.md +39 -0
- package/components/ste-search/README.md +232 -0
- package/components/ste-search/config.json +5 -0
- package/components/ste-search/props.ts +124 -0
- package/components/ste-search/ste-search.easycom.json +232 -0
- package/components/ste-search/ste-search.vue +379 -0
- package/components/ste-search/useData.ts +34 -0
- package/components/ste-select/ATTRIBUTES.md +39 -0
- package/components/ste-select/README.md +324 -0
- package/components/ste-select/config.json +5 -0
- package/components/ste-select/datapager.vue +54 -0
- package/components/ste-select/datetime.vue +109 -0
- package/components/ste-select/defaultDate.ts +138 -0
- package/components/ste-select/props.ts +67 -0
- package/components/ste-select/ste-select.easycom.json +287 -0
- package/components/ste-select/ste-select.vue +437 -0
- package/components/ste-select/useData.ts +471 -0
- package/components/ste-signature/ATTRIBUTES.md +18 -0
- package/components/ste-signature/README.md +97 -0
- package/components/ste-signature/config.json +5 -0
- package/components/ste-signature/props.ts +12 -0
- package/components/ste-signature/ste-signature.easycom.json +74 -0
- package/components/ste-signature/ste-signature.vue +183 -0
- package/components/ste-signature/types.d.ts +4 -0
- package/components/ste-slider/ATTRIBUTES.md +25 -0
- package/components/ste-slider/README.md +149 -0
- package/components/ste-slider/config.json +5 -0
- package/components/ste-slider/props.ts +32 -0
- package/components/ste-slider/ste-slider.easycom.json +128 -0
- package/components/ste-slider/ste-slider.scss +150 -0
- package/components/ste-slider/ste-slider.vue +293 -0
- package/components/ste-slider/type.d.ts +4 -0
- package/components/ste-slider/useData.ts +79 -0
- package/components/ste-step/props.ts +10 -0
- package/components/ste-step/ste-step.scss +104 -0
- package/components/ste-step/ste-step.vue +122 -0
- package/components/ste-stepper/ATTRIBUTES.md +33 -0
- package/components/ste-stepper/README.md +172 -0
- package/components/ste-stepper/config.json +5 -0
- package/components/ste-stepper/props.ts +41 -0
- package/components/ste-stepper/ste-stepper.easycom.json +220 -0
- package/components/ste-stepper/ste-stepper.vue +249 -0
- package/components/ste-steps/ATTRIBUTES.md +12 -0
- package/components/ste-steps/README.md +139 -0
- package/components/ste-steps/config.json +5 -0
- package/components/ste-steps/props.ts +18 -0
- package/components/ste-steps/ste-steps.easycom.json +46 -0
- package/components/ste-steps/ste-steps.vue +44 -0
- package/components/ste-sticky/ATTRIBUTES.md +15 -0
- package/components/ste-sticky/README.md +56 -0
- package/components/ste-sticky/config.json +5 -0
- package/components/ste-sticky/props.ts +7 -0
- package/components/ste-sticky/ste-sticky.easycom.json +48 -0
- package/components/ste-sticky/ste-sticky.vue +88 -0
- package/components/ste-swipe-action/ATTRIBUTES.md +16 -0
- package/components/ste-swipe-action/README.md +195 -0
- package/components/ste-swipe-action/config.json +5 -0
- package/components/ste-swipe-action/props.ts +23 -0
- package/components/ste-swipe-action/ste-swipe-action.easycom.json +74 -0
- package/components/ste-swipe-action/ste-swipe-action.vue +138 -0
- package/components/ste-swipe-action/useData.ts +204 -0
- package/components/ste-swipe-action-group/ATTRIBUTES.md +17 -0
- package/components/ste-swipe-action-group/props.ts +22 -0
- package/components/ste-swipe-action-group/ste-swipe-action-group.easycom.json +90 -0
- package/components/ste-swipe-action-group/ste-swipe-action-group.vue +57 -0
- package/components/ste-swiper/ATTRIBUTES.md +24 -0
- package/components/ste-swiper/README.md +156 -0
- package/components/ste-swiper/config.json +5 -0
- package/components/ste-swiper/props.ts +41 -0
- package/components/ste-swiper/ste-swiper.easycom.json +123 -0
- package/components/ste-swiper/ste-swiper.vue +98 -0
- package/components/ste-swiper/useData.ts +365 -0
- package/components/ste-swiper-item/ste-swiper-item.vue +41 -0
- package/components/ste-switch/ATTRIBUTES.md +17 -0
- package/components/ste-switch/README.md +105 -0
- package/components/ste-switch/config.json +5 -0
- package/components/ste-switch/props.ts +9 -0
- package/components/ste-switch/ste-switch.easycom.json +60 -0
- package/components/ste-switch/ste-switch.vue +96 -0
- package/components/ste-tab/ATTRIBUTES.md +14 -0
- package/components/ste-tab/props.ts +25 -0
- package/components/ste-tab/ste-tab.easycom.json +56 -0
- package/components/ste-tab/ste-tab.vue +26 -0
- package/components/ste-table/ATTRIBUTES.md +41 -0
- package/components/ste-table/README.md +638 -0
- package/components/ste-table/config.json +5 -0
- package/components/ste-table/props.ts +72 -0
- package/components/ste-table/ste-table.easycom.json +188 -0
- package/components/ste-table/ste-table.vue +427 -0
- package/components/ste-table/types.d.ts +3 -0
- package/components/ste-table/useData.ts +233 -0
- package/components/ste-table/utils.ts +11 -0
- package/components/ste-table-column/checkbox-icon.vue +35 -0
- package/components/ste-table-column/common.scss +52 -0
- package/components/ste-table-column/props.ts +18 -0
- package/components/ste-table-column/radio-icon.vue +99 -0
- package/components/ste-table-column/ste-table-column.vue +169 -0
- package/components/ste-table-column/var.scss +1 -0
- package/components/ste-tabs/ATTRIBUTES.md +52 -0
- package/components/ste-tabs/README.md +165 -0
- package/components/ste-tabs/config.json +5 -0
- package/components/ste-tabs/props.ts +133 -0
- package/components/ste-tabs/ste-tabs.easycom.json +278 -0
- package/components/ste-tabs/ste-tabs.vue +447 -0
- package/components/ste-tabs/useData.ts +364 -0
- package/components/ste-text/ATTRIBUTES.md +9 -0
- package/components/ste-text/README.md +58 -0
- package/components/ste-text/config.json +6 -0
- package/components/ste-text/props.ts +10 -0
- package/components/ste-text/ste-text.easycom.json +30 -0
- package/components/ste-text/ste-text.vue +46 -0
- package/components/ste-toast/ATTRIBUTES.md +15 -0
- package/components/ste-toast/README.md +222 -0
- package/components/ste-toast/config.json +5 -0
- package/components/ste-toast/props.ts +7 -0
- package/components/ste-toast/ste-toast.easycom.json +73 -0
- package/components/ste-toast/ste-toast.vue +209 -0
- package/components/ste-toast/use-toast.ts +26 -0
- package/components/ste-touch-swipe/ATTRIBUTES.md +18 -0
- package/components/ste-touch-swipe/README.md +89 -0
- package/components/ste-touch-swipe/TouchEvent.ts +79 -0
- package/components/ste-touch-swipe/config.json +5 -0
- package/components/ste-touch-swipe/props.ts +23 -0
- package/components/ste-touch-swipe/ste-touch-swipe.easycom.json +83 -0
- package/components/ste-touch-swipe/ste-touch-swipe.vue +283 -0
- package/components/ste-touch-swipe/useData.ts +51 -0
- package/components/ste-touch-swipe-item/ste-touch-swipe-item.vue +32 -0
- package/components/ste-tour/ATTRIBUTES.md +26 -0
- package/components/ste-tour/README.md +134 -0
- package/components/ste-tour/config.json +5 -0
- package/components/ste-tour/props.ts +45 -0
- package/components/ste-tour/ste-tour.easycom.json +120 -0
- package/components/ste-tour/ste-tour.vue +152 -0
- package/components/ste-tour/useData.ts +220 -0
- package/components/ste-tree/ATTRIBUTES.md +19 -0
- package/components/ste-tree/README.md +217 -0
- package/components/ste-tree/config.json +5 -0
- package/components/ste-tree/props.ts +24 -0
- package/components/ste-tree/ste-tree.easycom.json +106 -0
- package/components/ste-tree/ste-tree.vue +140 -0
- package/components/ste-tree/useData.ts +219 -0
- package/components/ste-upload/ATTRIBUTES.md +35 -0
- package/components/ste-upload/README.md +208 -0
- package/components/ste-upload/ReadFile.ts +305 -0
- package/components/ste-upload/config.json +5 -0
- package/components/ste-upload/props.ts +25 -0
- package/components/ste-upload/ste-upload.easycom.json +267 -0
- package/components/ste-upload/ste-upload.vue +386 -0
- package/components/ste-upload/useData.ts +46 -0
- package/components/ste-video/ATTRIBUTES.md +34 -0
- package/components/ste-video/README.md +48 -0
- package/components/ste-video/config.json +5 -0
- package/components/ste-video/props.ts +86 -0
- package/components/ste-video/ste-video.easycom.json +226 -0
- package/components/ste-video/ste-video.scss +201 -0
- package/components/ste-video/ste-video.vue +390 -0
- package/components/ste-video/types.d.ts +4 -0
- package/components/ste-video/useData.ts +140 -0
- package/composables.ts +2 -0
- package/config/color.ts +16 -0
- package/config/index.ts +48 -0
- package/index.ts +118 -0
- package/package.json +22 -0
- package/store/color.ts +24 -0
- package/store/index.ts +12 -0
- package/store/message-box.ts +54 -0
- package/store/toast.ts +50 -0
- package/types/components.d.ts +124 -0
- package/types/event.d.ts +51 -0
- package/types/index.d.ts +112 -0
- package/types/refComponents.d.ts +118 -0
- package/utils/Color.ts +66 -0
- package/utils/System.ts +114 -0
- package/utils/mixin.ts +122 -0
- package/utils/utils.ts +520 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# NumberKeyboard 数字键盘
|
|
2
|
+
|
|
3
|
+
用于页面上显示价格的组件
|
|
4
|
+
|
|
5
|
+
---$
|
|
6
|
+
|
|
7
|
+
### 代码演示
|
|
8
|
+
|
|
9
|
+
- 以下是公用scss代码
|
|
10
|
+
|
|
11
|
+
```scss
|
|
12
|
+
.test-input {
|
|
13
|
+
height: 66rpx;
|
|
14
|
+
line-height: 66rpx;
|
|
15
|
+
background-color: #f5f5f5;
|
|
16
|
+
padding: 0 18rpx;
|
|
17
|
+
font-size: 24rpx;
|
|
18
|
+
.placeholder {
|
|
19
|
+
color: #999;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
#### 基础用法
|
|
25
|
+
|
|
26
|
+
- 属性`value`: 输入的值,支持`v-model`双向绑定
|
|
27
|
+
- 属性`show`: 是否显示键盘,支持`sync`双向绑定
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<view class="test-input" @click="show1 = true">
|
|
31
|
+
<text v-if="value1">{{ value1 }}</text>
|
|
32
|
+
<text v-else class="placeholder">请输入</text>
|
|
33
|
+
</view>
|
|
34
|
+
<ste-number-keyboard v-model="value1" v-model:show="show1" />
|
|
35
|
+
<script setup lang="ts">
|
|
36
|
+
import { ref } from 'vue';
|
|
37
|
+
const value1 = ref('');
|
|
38
|
+
const show1 = ref(false);
|
|
39
|
+
</script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
#### 隐藏右侧功能键
|
|
43
|
+
|
|
44
|
+
- 属性`rightKeys`: 是否显示右侧功能键,默认显示
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<view class="test-input" @click="show2 = true">
|
|
48
|
+
<text v-if="value2">{{ value2 }}</text>
|
|
49
|
+
<text v-else class="placeholder">请输入</text>
|
|
50
|
+
</view>
|
|
51
|
+
<ste-number-keyboard :rightKeys="false" v-model="value2" v-model:show="show2" />
|
|
52
|
+
<script setup lang="ts">
|
|
53
|
+
import { ref } from 'vue';
|
|
54
|
+
const value2 = ref('');
|
|
55
|
+
const show2 = ref(false);
|
|
56
|
+
</script>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
#### 隐藏清除按钮,value最大长度
|
|
60
|
+
|
|
61
|
+
- 属性`showClear`: 是否显示清除按钮,默认显示
|
|
62
|
+
- 属性`maxlength`: 最大`value`长度,默认不限制
|
|
63
|
+
|
|
64
|
+
```html
|
|
65
|
+
<view class="test-input" @click="show3 = true">
|
|
66
|
+
<text v-if="value3">{{ value3 }}</text>
|
|
67
|
+
<text v-else class="placeholder">请输入</text>
|
|
68
|
+
</view>
|
|
69
|
+
<ste-number-keyboard :showClear="false" v-model="value3" v-model:show="show3" maxlength="6" />
|
|
70
|
+
|
|
71
|
+
<script setup lang="ts">
|
|
72
|
+
import { ref } from 'vue';
|
|
73
|
+
const value3 = ref('');
|
|
74
|
+
const show3 = ref(false);
|
|
75
|
+
</script>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### 自定义按键
|
|
79
|
+
|
|
80
|
+
- 属性`customKeys`: 自定义按键列表,建议不超过两个
|
|
81
|
+
|
|
82
|
+
```html
|
|
83
|
+
<view class="test-input" @click="show4 = true">
|
|
84
|
+
<text v-if="value4">{{ value4 }}</text>
|
|
85
|
+
<text v-else class="placeholder">请输入</text>
|
|
86
|
+
</view>
|
|
87
|
+
<ste-number-keyboard :customKeys="['00', '.']" v-model="value4" v-model:show="show4" />
|
|
88
|
+
|
|
89
|
+
<script setup lang="ts">
|
|
90
|
+
import { ref } from 'vue';
|
|
91
|
+
const value4 = ref('');
|
|
92
|
+
const show4 = ref(false);
|
|
93
|
+
</script>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### 自定义颜色/字体大小/确定文本
|
|
97
|
+
|
|
98
|
+
- 属性`textColor`: 按键文字颜色,默认#333333
|
|
99
|
+
- 属性`textSize`: 按键文字大小,默认48,单位rpx
|
|
100
|
+
- 属性`confirmBg`: 确定按钮背景颜色,默认#0090FF
|
|
101
|
+
- 属性`confirmColor`: 确定按钮文字颜色,默认#FFFFFF
|
|
102
|
+
- 属性`confirmText`: 确定按钮文字,默认"确定"
|
|
103
|
+
|
|
104
|
+
```html
|
|
105
|
+
<view class="test-input" @click="show5 = true">
|
|
106
|
+
<text v-if="value5">{{ value5 }}</text>
|
|
107
|
+
<text v-else class="placeholder">请输入</text>
|
|
108
|
+
</view>
|
|
109
|
+
<ste-number-keyboard v-model="value5" v-model:show="show5" textColor="#f00" textSize="40" confirmBg="#f00" confirmColor="#0f0" confirmText="完成" />
|
|
110
|
+
|
|
111
|
+
<script setup lang="ts">
|
|
112
|
+
import { ref } from 'vue';
|
|
113
|
+
const value5 = ref('');
|
|
114
|
+
const show5 = ref(false);
|
|
115
|
+
</script>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### 输入前事件(自定义功能)
|
|
119
|
+
|
|
120
|
+
- 属性`customKeys`中自定义一些按钮,如"返回"
|
|
121
|
+
- 需要自定义该按钮功能,可使用`beforeinput`阻止该按钮的默认功能
|
|
122
|
+
- 事件`beforeinput`: 输入前事件
|
|
123
|
+
- 参数1:即将输入的按钮文本
|
|
124
|
+
- 参数2:等待执行回调函数
|
|
125
|
+
- 参数3:继续后续操作函数
|
|
126
|
+
- 参数4:阻止后续操作函数
|
|
127
|
+
|
|
128
|
+
```html
|
|
129
|
+
<view class="test-input" @click="show6 = true">
|
|
130
|
+
<text v-if="value6">{{ value6 }}</text>
|
|
131
|
+
<text v-else class="placeholder">请输入</text>
|
|
132
|
+
</view>
|
|
133
|
+
<ste-number-keyboard :customKeys="['返回']" v-model="value6" v-model:show="show6" @beforeinput="beforeinput" />
|
|
134
|
+
<script setup lang="ts">
|
|
135
|
+
import { ref } from 'vue';
|
|
136
|
+
const value6 = ref('');
|
|
137
|
+
const show6 = ref(false);
|
|
138
|
+
|
|
139
|
+
function beforeinput(v, suspend, next, stop) {
|
|
140
|
+
// 等待后续操作
|
|
141
|
+
suspend();
|
|
142
|
+
// 执行自定义操作
|
|
143
|
+
if (v === '返回') {
|
|
144
|
+
// 阻止默认后续操作
|
|
145
|
+
stop();
|
|
146
|
+
this.showToast({
|
|
147
|
+
title: '点击了返回',
|
|
148
|
+
icon: 'none',
|
|
149
|
+
});
|
|
150
|
+
} else {
|
|
151
|
+
// 继续默认后续操作
|
|
152
|
+
next();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
</script>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### 在文档流中展示
|
|
159
|
+
|
|
160
|
+
- 属性`mode`: 键盘模式,
|
|
161
|
+
- 可选值:`popup`在弹窗中展示(默认)
|
|
162
|
+
- 可选值:`page`在文档流中展示
|
|
163
|
+
|
|
164
|
+
```html
|
|
165
|
+
<view class="test-input">
|
|
166
|
+
<text v-if="value7">{{ value7 }}</text>
|
|
167
|
+
<text v-else class="placeholder">请输入</text>
|
|
168
|
+
</view>
|
|
169
|
+
<view style="padding: 30rpx; background-color: #f5f5f5; margin-top: 12rpx">
|
|
170
|
+
<ste-number-keyboard mode="page" v-model="value7" />
|
|
171
|
+
</view>
|
|
172
|
+
|
|
173
|
+
<script setup lang="ts">
|
|
174
|
+
import { ref } from 'vue';
|
|
175
|
+
const value7 = ref('');
|
|
176
|
+
</script>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---$
|
|
180
|
+
|
|
181
|
+
### API
|
|
182
|
+
|
|
183
|
+
<!-- props -->
|
|
184
|
+
|
|
185
|
+
#### 组件插槽(Slot)
|
|
186
|
+
|
|
187
|
+
| 插槽名 | 说明 | 插槽参数 | 支持版本 |
|
|
188
|
+
| ------- | ------------ | -------- | -------- |
|
|
189
|
+
| default | 弹窗标题插槽 | - | - |
|
|
190
|
+
|
|
191
|
+
---$
|
|
192
|
+
{{xuyajun}}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { PropType } from 'vue'
|
|
2
|
+
|
|
3
|
+
export interface NumberKeyboardProps {
|
|
4
|
+
mode: string
|
|
5
|
+
modelValue: string
|
|
6
|
+
maxlength: number | string
|
|
7
|
+
show: boolean
|
|
8
|
+
rightKeys: boolean
|
|
9
|
+
randomKeys: boolean
|
|
10
|
+
confirmText: string
|
|
11
|
+
confirmDisabled: boolean
|
|
12
|
+
customKeys: string[]
|
|
13
|
+
showClear: boolean
|
|
14
|
+
textColor: string
|
|
15
|
+
textSize: string | number
|
|
16
|
+
confirmBg: string
|
|
17
|
+
confirmColor: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
mode: { type: String, default: () => 'popup' },
|
|
22
|
+
modelValue: { type: String, default: () => '' },
|
|
23
|
+
maxlength: { type: [Number, String], default: () => null },
|
|
24
|
+
show: { type: Boolean, default: () => false },
|
|
25
|
+
rightKeys: { type: Boolean, default: () => true },
|
|
26
|
+
randomKeys: { type: Boolean, default: () => false },
|
|
27
|
+
confirmText: { type: String, default: () => '确定' },
|
|
28
|
+
confirmDisabled: { type: Boolean, default: () => false },
|
|
29
|
+
customKeys: { type: Array as PropType<string[]>, default: () => [] },
|
|
30
|
+
showClear: { type: Boolean, default: () => true },
|
|
31
|
+
textColor: { type: String, default: () => '#000' },
|
|
32
|
+
textSize: { type: [Number, String], default: () => 48 },
|
|
33
|
+
confirmBg: { type: String, default: () => '' },
|
|
34
|
+
confirmColor: { type: String, default: () => '#fff' },
|
|
35
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ste-media-preview",
|
|
3
|
+
"description": "媒体预览",
|
|
4
|
+
"example": "<ste-media-preview />",
|
|
5
|
+
"tutorial": "https://stellar-ui.intecloud.com.cn/plus/#/?active=media-preview",
|
|
6
|
+
"attributes": [
|
|
7
|
+
{
|
|
8
|
+
"name": "mode",
|
|
9
|
+
"description": "键盘模式",
|
|
10
|
+
"type": "string",
|
|
11
|
+
"default": "popup",
|
|
12
|
+
"values": [
|
|
13
|
+
{
|
|
14
|
+
"name": "popup",
|
|
15
|
+
"description": "弹出式"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "page",
|
|
19
|
+
"description": "页面式"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "modelValue",
|
|
25
|
+
"description": "输入值,支持v-model双向绑定",
|
|
26
|
+
"type": "string"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "maxlength",
|
|
30
|
+
"description": "value最大长度",
|
|
31
|
+
"type": "number"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "show",
|
|
35
|
+
"description": "是否显示键盘,支持v-model:show绑定,mode='popup'时生效",
|
|
36
|
+
"type": "boolean",
|
|
37
|
+
"default": false
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "rightKeys",
|
|
41
|
+
"description": "是否显示右侧功能键",
|
|
42
|
+
"type": "boolean",
|
|
43
|
+
"default": true
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "randomKeys",
|
|
47
|
+
"description": "按键是否随机排列",
|
|
48
|
+
"type": "boolean",
|
|
49
|
+
"default": false
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "confirmText",
|
|
53
|
+
"description": "右侧确定按钮文本",
|
|
54
|
+
"type": "string",
|
|
55
|
+
"default": "确定"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "confirmDisabled",
|
|
59
|
+
"description": "右侧确认是否禁用",
|
|
60
|
+
"type": "boolean",
|
|
61
|
+
"default": false
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "customKeys",
|
|
65
|
+
"description": "自定义按键,建议数量不大于2",
|
|
66
|
+
"type": "string[]",
|
|
67
|
+
"default": []
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "showClear",
|
|
71
|
+
"description": "是否显示清空按钮",
|
|
72
|
+
"type": "boolean",
|
|
73
|
+
"default": true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "textColor",
|
|
77
|
+
"description": "按键文字颜色",
|
|
78
|
+
"type": "string",
|
|
79
|
+
"default": "#000000"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "textSize",
|
|
83
|
+
"description": "按键文字大小",
|
|
84
|
+
"type": "number | string",
|
|
85
|
+
"default": 48
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "confirmBg",
|
|
89
|
+
"description": "确定按钮背景颜色",
|
|
90
|
+
"type": "string",
|
|
91
|
+
"default": "#0090FF"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"name": "confirmColor",
|
|
95
|
+
"description": "确定按钮文字颜色",
|
|
96
|
+
"type": "string",
|
|
97
|
+
"default": "#ffffff"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "[event]change",
|
|
101
|
+
"description": "输入值value改变时触发",
|
|
102
|
+
"type": "(value: string) => void",
|
|
103
|
+
"params": [
|
|
104
|
+
{
|
|
105
|
+
"name": "value",
|
|
106
|
+
"description": "输入值"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "[event]clear",
|
|
112
|
+
"description": "清空按钮点击事件",
|
|
113
|
+
"type": "() => void"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "[event]backspace",
|
|
117
|
+
"description": "删除按钮点击事件",
|
|
118
|
+
"type": "() => void"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"name": "[event]confirm",
|
|
122
|
+
"description": "确认按钮点击事件",
|
|
123
|
+
"type": "(value:string) => void",
|
|
124
|
+
"params": [
|
|
125
|
+
{
|
|
126
|
+
"name": "value",
|
|
127
|
+
"description": "输入值"
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "[event]click",
|
|
133
|
+
"description": "点击功能键(确认/删除/清除)之外的键盘触发",
|
|
134
|
+
"type": "(key:string) => void",
|
|
135
|
+
"params": [
|
|
136
|
+
{
|
|
137
|
+
"name": "key",
|
|
138
|
+
"description": "当前点击的按钮"
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "[event]beforeinput",
|
|
144
|
+
"description": "输入之前触发,功能键之外的键盘点击时为输入",
|
|
145
|
+
"type": "(key: string, suspend: () => void, next: () => void, stop: () => void) => void",
|
|
146
|
+
"params": [
|
|
147
|
+
{
|
|
148
|
+
"name": "key",
|
|
149
|
+
"description": "当前点击的按钮"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"name": "suspend",
|
|
153
|
+
"description": "开启等待的回调函数"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "next",
|
|
157
|
+
"description": "执行后续操作的回调函数"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"name": "stop",
|
|
161
|
+
"description": "阻止后续执行的回调函数"
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"name": "[event]open",
|
|
167
|
+
"description": "打开弹窗键盘触发",
|
|
168
|
+
"type": "() => void"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "[event]close",
|
|
172
|
+
"description": "关闭弹窗键盘触发",
|
|
173
|
+
"type": "() => void"
|
|
174
|
+
},
|
|
175
|
+
{}
|
|
176
|
+
]
|
|
177
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import useData from './useData';
|
|
3
|
+
import porpsData, { type NumberKeyboardProps } from './props';
|
|
4
|
+
|
|
5
|
+
import KeyboardVue from './KeyboardVue.vue';
|
|
6
|
+
|
|
7
|
+
const props: NumberKeyboardProps = defineProps(porpsData);
|
|
8
|
+
const emits = defineEmits<{
|
|
9
|
+
(e: 'change', value: string): void;
|
|
10
|
+
(e: 'input', value: string): void;
|
|
11
|
+
(e: 'update:modelValue', value: string): void;
|
|
12
|
+
(e: 'clear'): void;
|
|
13
|
+
(e: 'backspace'): void;
|
|
14
|
+
(e: 'confirm', value: string): void;
|
|
15
|
+
(e: 'click', key: string): void;
|
|
16
|
+
(e: 'beforeinput', key: string, suspend: () => void, next: () => void, stop: () => void): void;
|
|
17
|
+
(e: 'close'): void;
|
|
18
|
+
(e: 'update:show', show: boolean): void;
|
|
19
|
+
(e: 'open'): void;
|
|
20
|
+
}>();
|
|
21
|
+
|
|
22
|
+
const { cmpNumbers, cmpRootStyle, dataShow, onClose, onChange, onOpen } = useData({ props, emits });
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<view class="ste-number-keyboard-root" :style="[cmpRootStyle]">
|
|
27
|
+
<block v-if="mode === 'popup'">
|
|
28
|
+
<ste-popup v-model:show="dataShow" @close="onClose" position="bottom" :show-close="false" @open="onOpen">
|
|
29
|
+
<view style="padding: 30rpx 30rpx 60rpx 30rpx; background-color: #f5f5f5">
|
|
30
|
+
<view class="keyboard-popup-head">
|
|
31
|
+
<view></view>
|
|
32
|
+
<view class="keyboard-title">
|
|
33
|
+
<slot>数字键盘</slot>
|
|
34
|
+
</view>
|
|
35
|
+
<view class="keyboard-close" @click="onClose">
|
|
36
|
+
<ste-icon code="" size="36" />
|
|
37
|
+
</view>
|
|
38
|
+
</view>
|
|
39
|
+
<KeyboardVue
|
|
40
|
+
:list="cmpNumbers"
|
|
41
|
+
:confirmText="confirmText"
|
|
42
|
+
:disabled="confirmDisabled"
|
|
43
|
+
:showClear="showClear"
|
|
44
|
+
:textColor="textColor"
|
|
45
|
+
:textSize="textSize"
|
|
46
|
+
:rightKeys="rightKeys"
|
|
47
|
+
@change="onChange"
|
|
48
|
+
/>
|
|
49
|
+
</view>
|
|
50
|
+
</ste-popup>
|
|
51
|
+
</block>
|
|
52
|
+
<block v-else>
|
|
53
|
+
<KeyboardVue
|
|
54
|
+
:list="cmpNumbers"
|
|
55
|
+
:confirmText="confirmText"
|
|
56
|
+
:disabled="confirmDisabled"
|
|
57
|
+
:showClear="showClear"
|
|
58
|
+
:textColor="textColor"
|
|
59
|
+
:textSize="textSize"
|
|
60
|
+
:rightKeys="rightKeys"
|
|
61
|
+
@change="onChange"
|
|
62
|
+
/>
|
|
63
|
+
</block>
|
|
64
|
+
</view>
|
|
65
|
+
</template>
|
|
66
|
+
<style lang="scss" scoped>
|
|
67
|
+
.ste-number-keyboard-root {
|
|
68
|
+
.keyboard-popup-head {
|
|
69
|
+
width: 100%;
|
|
70
|
+
display: flex;
|
|
71
|
+
justify-content: space-between;
|
|
72
|
+
padding-bottom: 30rpx;
|
|
73
|
+
color: #888;
|
|
74
|
+
.keyboard-close {
|
|
75
|
+
&:active {
|
|
76
|
+
background: rgba(200, 200, 200, 0.5);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
</style>
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { computed, ref, watch } from 'vue'
|
|
2
|
+
import utils from '../../utils/utils'
|
|
3
|
+
import useColor from '../../config/color'
|
|
4
|
+
import type { NumberKeyboardProps } from './props'
|
|
5
|
+
|
|
6
|
+
const color = useColor()
|
|
7
|
+
export default function useData({
|
|
8
|
+
props,
|
|
9
|
+
emits,
|
|
10
|
+
}: {
|
|
11
|
+
props: NumberKeyboardProps
|
|
12
|
+
emits: {
|
|
13
|
+
(e: 'change', value: string): void
|
|
14
|
+
(e: 'input', value: string): void
|
|
15
|
+
(e: 'update:modelValue', value: string): void
|
|
16
|
+
(e: 'clear'): void
|
|
17
|
+
(e: 'backspace'): void
|
|
18
|
+
(e: 'confirm', value: string): void
|
|
19
|
+
(e: 'click', key: string): void
|
|
20
|
+
(e: 'beforeinput', key: string, suspend: () => void, next: () => void, stop: () => void): void
|
|
21
|
+
(e: 'close'): void
|
|
22
|
+
(e: 'update:show', show: boolean): void
|
|
23
|
+
(e: 'open'): void
|
|
24
|
+
}
|
|
25
|
+
}) {
|
|
26
|
+
const dataValue = ref('')
|
|
27
|
+
const setDataValue = (value: string) => {
|
|
28
|
+
if (value === dataValue.value)
|
|
29
|
+
return
|
|
30
|
+
if (value === null || value === undefined)
|
|
31
|
+
dataValue.value = ''
|
|
32
|
+
else if (typeof value === 'string')
|
|
33
|
+
dataValue.value = value
|
|
34
|
+
else dataValue.value = String(value)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const dataShow = ref(false)
|
|
38
|
+
const setDataShow = (value: boolean) => {
|
|
39
|
+
if (value === dataShow.value)
|
|
40
|
+
return
|
|
41
|
+
dataShow.value = value
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const cmpNumbers = computed(() => {
|
|
45
|
+
let keys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']
|
|
46
|
+
if (props.randomKeys)
|
|
47
|
+
keys = utils.randomArray(keys)
|
|
48
|
+
|
|
49
|
+
if (Array.isArray(props.customKeys))
|
|
50
|
+
keys.push(...props.customKeys)
|
|
51
|
+
|
|
52
|
+
if (!props.rightKeys) {
|
|
53
|
+
if (!props.showClear) {
|
|
54
|
+
keys.push('backspace')
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
const d = keys.length % 3
|
|
58
|
+
if (d === 1) {
|
|
59
|
+
const end = keys.pop()
|
|
60
|
+
keys.push('clear', end || '', 'backspace')
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
keys.push('clear', 'backspace')
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return keys
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
const cmpRootStyle = computed(() => {
|
|
70
|
+
return {
|
|
71
|
+
'--ste-number-keyboard-text-color': props.textColor,
|
|
72
|
+
'--ste-number-keyboard-text-size': `var(--font-size-${props.textSize},${utils.formatPx(props.textSize)})`,
|
|
73
|
+
'--ste-number-keyboard-clear-text-size': `var(--font-size-${props.textSize},${utils.formatPx(Number(props.textSize) - 8)})`,
|
|
74
|
+
'--ste-number-keyboard-confirm-text-size': `var(--font-size-${props.textSize},${utils.formatPx(Number(props.textSize) - 3)})`,
|
|
75
|
+
'--ste-number-keyboard-confirm-bg': props.confirmBg ? props.confirmBg : color.getColor().steThemeColor,
|
|
76
|
+
'--ste-number-keyboard-confirm-bg-active': utils.Color.formatColor(props.confirmBg, 0.8),
|
|
77
|
+
'--ste-number-keyboard-confirm-color': props.confirmColor,
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
watch(() => props.modelValue, setDataValue, { immediate: true })
|
|
82
|
+
watch(() => props.show, setDataShow, { immediate: true })
|
|
83
|
+
|
|
84
|
+
const onClose = () => {
|
|
85
|
+
setDataShow(false)
|
|
86
|
+
emits('update:show', false)
|
|
87
|
+
emits('close')
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const beforInput = async (value: string) => {
|
|
91
|
+
let next = true
|
|
92
|
+
const stop = new Promise((resolve, reject) => {
|
|
93
|
+
emits(
|
|
94
|
+
'beforeinput',
|
|
95
|
+
value,
|
|
96
|
+
() => (next = false),
|
|
97
|
+
() => resolve('next'),
|
|
98
|
+
() => reject(new Error('beforInput stop')),
|
|
99
|
+
)
|
|
100
|
+
})
|
|
101
|
+
if (!next)
|
|
102
|
+
await stop
|
|
103
|
+
|
|
104
|
+
/* eslint prefer-promise-reject-errors: "error" */
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const onChange = async (value: string) => {
|
|
108
|
+
try {
|
|
109
|
+
if (value === 'confirm') {
|
|
110
|
+
emits('confirm', dataValue.value)
|
|
111
|
+
onClose()
|
|
112
|
+
return
|
|
113
|
+
}
|
|
114
|
+
switch (value) {
|
|
115
|
+
case 'backspace':
|
|
116
|
+
setDataValue(dataValue.value.slice(0, dataValue.value.length - 1))
|
|
117
|
+
emits('backspace')
|
|
118
|
+
break
|
|
119
|
+
case 'clear':
|
|
120
|
+
setDataValue('')
|
|
121
|
+
emits('clear')
|
|
122
|
+
break
|
|
123
|
+
default:
|
|
124
|
+
await beforInput(value)
|
|
125
|
+
emits('click', value)
|
|
126
|
+
if (props.maxlength && dataValue.value.length >= Number(props.maxlength))
|
|
127
|
+
return
|
|
128
|
+
dataValue.value += value
|
|
129
|
+
break
|
|
130
|
+
}
|
|
131
|
+
emits('input', dataValue.value)
|
|
132
|
+
emits('change', dataValue.value)
|
|
133
|
+
emits('update:modelValue', dataValue.value)
|
|
134
|
+
}
|
|
135
|
+
catch (e) {
|
|
136
|
+
if (e)
|
|
137
|
+
console.error(e)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const onOpen = () => emits('open')
|
|
142
|
+
|
|
143
|
+
return { cmpNumbers, cmpRootStyle, dataShow, onClose, onChange, onOpen }
|
|
144
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// pickerProps.ts
|
|
2
|
+
import type { PropType } from 'vue'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
columns: { type: Array as PropType<string[][]>, default: () => [] },
|
|
6
|
+
itemHeight: { type: [String, Number] as PropType<string | number>, default: 44 },
|
|
7
|
+
visibleItemCount: { type: [String, Number], default: 5 },
|
|
8
|
+
showToolbar: { type: Boolean, default: true },
|
|
9
|
+
title: { type: String, default: '' },
|
|
10
|
+
cancelText: { type: String, default: '取消' },
|
|
11
|
+
cancelColor: { type: String, default: '#969799' },
|
|
12
|
+
confirmText: { type: String, default: '确认' },
|
|
13
|
+
confirmColor: { type: String, default: '#0090FF' },
|
|
14
|
+
defaultIndex: { type: Array as PropType<number[]>, default: () => [] },
|
|
15
|
+
rootClass: { type: String, default: '' },
|
|
16
|
+
}
|