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,364 @@
|
|
|
1
|
+
import { type CSSProperties, computed, nextTick, ref, watch } from 'vue'
|
|
2
|
+
import utils from '../../utils/utils'
|
|
3
|
+
import type { TabProps } from '../ste-tab/props'
|
|
4
|
+
import type { SelfComponentInternalInstance } from '../../utils/mixin'
|
|
5
|
+
import type { UniScrollViewOnScrollEvent } from '../../types/event'
|
|
6
|
+
import useColor from '../../config/color'
|
|
7
|
+
import type { SteTabsProps } from './props'
|
|
8
|
+
|
|
9
|
+
const color = useColor()
|
|
10
|
+
|
|
11
|
+
export default function useData({
|
|
12
|
+
thas,
|
|
13
|
+
props,
|
|
14
|
+
emits,
|
|
15
|
+
internalChildren,
|
|
16
|
+
}: {
|
|
17
|
+
thas: globalThis.Ref<globalThis.ComponentPublicInstance | null | undefined>
|
|
18
|
+
props: SteTabsProps
|
|
19
|
+
internalChildren: SelfComponentInternalInstance[]
|
|
20
|
+
emits: {
|
|
21
|
+
(e: 'click-tab', tab: TabProps): void
|
|
22
|
+
(e: 'update:active', active: number | string): void
|
|
23
|
+
(e: 'change', tab: TabProps): void
|
|
24
|
+
}
|
|
25
|
+
}) {
|
|
26
|
+
const dataActive = ref<string | number>(0)
|
|
27
|
+
const setDataActive = (index: string | number) => (dataActive.value = index)
|
|
28
|
+
|
|
29
|
+
const viewScrollLeft = ref(0)
|
|
30
|
+
const setViewScrollLeft = (left: number) => (viewScrollLeft.value = left)
|
|
31
|
+
|
|
32
|
+
const scrollLeft = ref(0)
|
|
33
|
+
const setScrollLeft = (left: number) => (scrollLeft.value = left)
|
|
34
|
+
|
|
35
|
+
const showComponent = ref(false)
|
|
36
|
+
const setShowComponent = (show: boolean) => (showComponent.value = show)
|
|
37
|
+
|
|
38
|
+
const listBoxEl = ref<UniApp.NodeInfo>()
|
|
39
|
+
const setListBoxEl = (el: UniApp.NodeInfo) => (listBoxEl.value = el)
|
|
40
|
+
|
|
41
|
+
const listEl = ref<UniApp.NodeInfo>()
|
|
42
|
+
const setListEl = (el: UniApp.NodeInfo) => (listEl.value = el)
|
|
43
|
+
|
|
44
|
+
const tabEls = ref<UniApp.NodeInfo[]>([])
|
|
45
|
+
const setTabEls = (el: UniApp.NodeInfo[]) => (tabEls.value = el)
|
|
46
|
+
|
|
47
|
+
const openPullDown = ref(false)
|
|
48
|
+
const setOpenPullDown = (open: boolean) => (openPullDown.value = open)
|
|
49
|
+
|
|
50
|
+
const pullTransform = ref(false)
|
|
51
|
+
const setPullTransform = (transform: boolean) => (pullTransform.value = transform)
|
|
52
|
+
|
|
53
|
+
const updateChildrenTimeout = ref(0)
|
|
54
|
+
const setUpdateChildrenTimeout = (callback: () => void, timeout: number) => {
|
|
55
|
+
clearTimeout(updateChildrenTimeout.value)
|
|
56
|
+
updateChildrenTimeout.value = setTimeout(callback, timeout)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const updateTabsTimeout = ref(0)
|
|
60
|
+
const setUpdateTabsTimeout = (callback: () => void, timeout: number) => {
|
|
61
|
+
clearTimeout(updateTabsTimeout.value)
|
|
62
|
+
updateTabsTimeout.value = setTimeout(callback, timeout)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const cmpShowLine = computed(() => props.type === 'line' && props.showLine && !props.showSubtitle)
|
|
66
|
+
|
|
67
|
+
const cmpTabList = computed(() =>
|
|
68
|
+
internalChildren.map((item, index) => {
|
|
69
|
+
const tab: TabProps & { active: boolean } = { ...item.props } as any
|
|
70
|
+
switch (typeof dataActive.value) {
|
|
71
|
+
case 'string':
|
|
72
|
+
tab.active = dataActive.value === tab.name
|
|
73
|
+
break
|
|
74
|
+
case 'number':
|
|
75
|
+
tab.active = dataActive.value === index
|
|
76
|
+
break
|
|
77
|
+
}
|
|
78
|
+
if (tab.subTitle?.length > 6)
|
|
79
|
+
tab.subTitle = tab.subTitle.slice(0, 6)
|
|
80
|
+
|
|
81
|
+
return tab
|
|
82
|
+
}),
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
const cmpDisabledIndexs = computed(() => {
|
|
86
|
+
const indexs: number[] = []
|
|
87
|
+
cmpTabList.value.forEach((item, i) => {
|
|
88
|
+
if (item.disabled)
|
|
89
|
+
indexs.push(i)
|
|
90
|
+
})
|
|
91
|
+
return indexs
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
const cmpRootStyle = computed(() => {
|
|
95
|
+
let tabCardBg = utils.Color.formatColor(props.titleColor, 0.05)
|
|
96
|
+
let tabCardBgActive = utils.Color.formatColor(props.color ? props.color : color.getColor().steThemeColor, 0.1)
|
|
97
|
+
let tabCardSubBg = props.color ? props.color : color.getColor().steThemeColor
|
|
98
|
+
let tabCardSubColor = '#fff'
|
|
99
|
+
let activeTitleColor = props.activeTitleColor
|
|
100
|
+
let borderWidthStart = '0'
|
|
101
|
+
let borderWidth = '0'
|
|
102
|
+
if (props.type === 'card') {
|
|
103
|
+
activeTitleColor = props.color ? props.color : color.getColor().steThemeColor
|
|
104
|
+
if (props.border) {
|
|
105
|
+
tabCardBg = 'none'
|
|
106
|
+
tabCardBgActive = props.color ? props.color : color.getColor().steThemeColor
|
|
107
|
+
tabCardSubBg = '#fff'
|
|
108
|
+
tabCardSubColor = props.color ? props.color : color.getColor().steThemeColor
|
|
109
|
+
activeTitleColor = '#fff'
|
|
110
|
+
borderWidthStart = '1px'
|
|
111
|
+
borderWidth = '1px 1px 1px 0'
|
|
112
|
+
if (Number(props.tabSpace) > 0)
|
|
113
|
+
borderWidth = '1px'
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const tabSpace = utils.formatPx<'str'>(props.tabSpace)
|
|
117
|
+
let tabSpaceLine = '0'
|
|
118
|
+
if (props.showGapLine)
|
|
119
|
+
tabSpaceLine = '1px'
|
|
120
|
+
|
|
121
|
+
let tabWidth = utils.formatPx<'str'>(props.tabWidth)
|
|
122
|
+
if (internalChildren.length > 0 && internalChildren.length <= props.divideNum) {
|
|
123
|
+
const listWidth = listEl.value?.width || 375
|
|
124
|
+
const tabsWidth = listWidth - Number(tabSpace.slice(0, -2)) * (internalChildren.length - 1)
|
|
125
|
+
tabWidth = `${tabsWidth / internalChildren.length}px`
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const style = {
|
|
129
|
+
'--tabs-color': props.color ? props.color : color.getColor().steThemeColor,
|
|
130
|
+
'--tabs-radius': utils.formatPx(props.radius),
|
|
131
|
+
'--tabs-card-background': tabCardBg,
|
|
132
|
+
'--tabs-card-background-active': tabCardBgActive,
|
|
133
|
+
'--tabs-card-sub-bg': tabCardSubBg,
|
|
134
|
+
'--tabs-card-sub-color': tabCardSubColor,
|
|
135
|
+
'--tabs-line-width': utils.formatPx(props.lineWidth),
|
|
136
|
+
'--tabs-line-height': utils.formatPx(props.lineHeight),
|
|
137
|
+
'--tabs-tab-width': tabWidth,
|
|
138
|
+
'--tabs-tab-padding': utils.formatPx(props.tabPadding),
|
|
139
|
+
'--tabs-tab-padding-bottom': cmpShowLine.value ? utils.formatPx(4) : utils.formatPx(props.tabPadding),
|
|
140
|
+
'--tabs-transition-duration': props.duration ? `${props.duration}s` : 'inherit',
|
|
141
|
+
'--tabs-tab-space': tabSpace,
|
|
142
|
+
'--tabs-tab-space-line': tabSpaceLine,
|
|
143
|
+
'--tabs-tab-border-width': borderWidth,
|
|
144
|
+
'--tabs-tab-border-width-start': borderWidthStart,
|
|
145
|
+
'--tabs-sticky': props.sticky ? 'sticky' : 'relative',
|
|
146
|
+
'--tabs-offset-top': utils.formatPx(props.offsetTop),
|
|
147
|
+
'--tabs-title-color': props.titleColor,
|
|
148
|
+
'--tabs-active-title-color': activeTitleColor,
|
|
149
|
+
'--tabs-title-height': utils.formatPx(props.titleHeight),
|
|
150
|
+
'--tabs-sub-title-height': utils.formatPx(props.subTitleHeight),
|
|
151
|
+
'--tabs-sub-title-radius': utils.formatPx(props.subTitleRadius),
|
|
152
|
+
'--tabs-list-height': openPullDown.value && listEl.value ? `${listEl.value?.height}px` : 'initial',
|
|
153
|
+
'--tabs-image-width': utils.formatPx(props.imageWidth),
|
|
154
|
+
'--tabs-image-height': utils.formatPx(props.imageHeight),
|
|
155
|
+
'--tabs-image-radius': utils.formatPx(props.imageRadius),
|
|
156
|
+
'--tabs-image-border-width': utils.formatPx(props.imageBorderWidth),
|
|
157
|
+
'--tabs-sub-color': props.subColor,
|
|
158
|
+
'--tabs-active-sub-color': props.activeSubColor,
|
|
159
|
+
'--tabs-mask-top': utils.formatPx(props.maskTop),
|
|
160
|
+
'--tabs-mask-right': utils.formatPx(props.maskRight),
|
|
161
|
+
'--tabs-mask-bottom': utils.formatPx(props.maskBottom),
|
|
162
|
+
'--tabs-mask-left': utils.formatPx(props.maskLeft),
|
|
163
|
+
'--tabs-mask-zindex': props.maskZindex,
|
|
164
|
+
'opacity': showComponent.value ? '1' : '0',
|
|
165
|
+
'zIndex': openPullDown.value ? '1001' : '1',
|
|
166
|
+
}
|
|
167
|
+
return style
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
const cmpListBackground = computed(() => utils.bg2style(props.background))
|
|
171
|
+
|
|
172
|
+
const cmpActiveIndex = computed(() => cmpTabList.value.findIndex(m => m.active))
|
|
173
|
+
|
|
174
|
+
const cmpActiveTabEl = computed(() => tabEls.value[cmpActiveIndex.value] || {})
|
|
175
|
+
|
|
176
|
+
const cmpLineStyle = computed(() => {
|
|
177
|
+
const width = utils.formatPx<'str'>(props.lineWidth)
|
|
178
|
+
const display = tabEls.value.length ? 'block' : 'none'
|
|
179
|
+
let marginLeft = '0'
|
|
180
|
+
if (cmpActiveIndex.value !== -1) {
|
|
181
|
+
const activeEl = tabEls.value[cmpActiveIndex.value]
|
|
182
|
+
if (activeEl)
|
|
183
|
+
marginLeft = `${(activeEl.left || 0) - (listEl.value?.left || 0) + ((activeEl.width || 0) - Number(width.slice(0, -2))) / 2}px`
|
|
184
|
+
}
|
|
185
|
+
return { marginLeft, display }
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
const cmpScrollX = computed(() => internalChildren.length > props.divideNum)
|
|
189
|
+
|
|
190
|
+
const cmpPullDown = computed(() => cmpScrollX.value && props.pullDown)
|
|
191
|
+
|
|
192
|
+
const cmpPullStyle = computed(() => {
|
|
193
|
+
if (!listBoxEl.value || !openPullDown.value)
|
|
194
|
+
return {}
|
|
195
|
+
return {
|
|
196
|
+
top: `${listBoxEl.value?.top}px`,
|
|
197
|
+
left: `${listBoxEl.value?.left}px`,
|
|
198
|
+
width: `${listBoxEl.value?.width}px`,
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
const cmpPullListTransform = computed(() => ({ transform: `translateY(${pullTransform.value ? '0' : '-100%'})` }))
|
|
203
|
+
|
|
204
|
+
const cmpPullIconTransform = computed(() => ({ transform: `rotate(${pullTransform.value ? '180deg' : '0'})` }))
|
|
205
|
+
|
|
206
|
+
const cmpEllipsis = computed(() => {
|
|
207
|
+
if (props.ellipsis)
|
|
208
|
+
return { whiteSpace: 'nowrap', textOverflow: 'ellipsis' } as CSSProperties
|
|
209
|
+
|
|
210
|
+
return {}
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
const cmpTitleStyle = computed(() => {
|
|
214
|
+
if (props.showSubtitle)
|
|
215
|
+
return { fontWeight: 'bold', fontSize: utils.formatPx<'str'>(32) }
|
|
216
|
+
|
|
217
|
+
return {}
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
const initChildren = () => {
|
|
221
|
+
setShowComponent(false)
|
|
222
|
+
setUpdateChildrenTimeout(() => {
|
|
223
|
+
if (!thas.value)
|
|
224
|
+
return
|
|
225
|
+
nextTick(async () => {
|
|
226
|
+
setListBoxEl(await utils.querySelector<false>('.tab-list-box', thas.value))
|
|
227
|
+
setListEl(await utils.querySelector<false>('.tab-list-box .tab-list.view-list', thas.value))
|
|
228
|
+
setTabEls(await utils.querySelector('.tab-list-box .tab-list.view-list .tab-item', thas.value, true))
|
|
229
|
+
setShowComponent(true)
|
|
230
|
+
})
|
|
231
|
+
}, 100)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const onCloseDown = () => {
|
|
235
|
+
setPullTransform(false)
|
|
236
|
+
setTimeout(() => {
|
|
237
|
+
setOpenPullDown(false)
|
|
238
|
+
}, 200)
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const onSelect = async (tab: TabProps, index: number) => {
|
|
242
|
+
if (tab.disabled || props.disabled || props.lock)
|
|
243
|
+
return false
|
|
244
|
+
if (openPullDown.value)
|
|
245
|
+
await onCloseDown()
|
|
246
|
+
let active = dataActive.value
|
|
247
|
+
if (typeof active === 'string')
|
|
248
|
+
active = tab.name
|
|
249
|
+
else if (typeof active === 'number')
|
|
250
|
+
active = index
|
|
251
|
+
|
|
252
|
+
setDataActive(active)
|
|
253
|
+
emits('update:active', active)
|
|
254
|
+
emits('change', { ...tab, index })
|
|
255
|
+
return true
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const onClickTab = (tab: TabProps, index: number) => {
|
|
259
|
+
emits('click-tab', { ...tab, index })
|
|
260
|
+
onSelect(tab, index)
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const scrollToActive = () => {
|
|
264
|
+
nextTick(async () => {
|
|
265
|
+
if (!thas.value)
|
|
266
|
+
return
|
|
267
|
+
const activeEl = await utils.querySelector('.tab-list-box .tab-list.view-list .tab-item.active', thas.value, false)
|
|
268
|
+
if (!activeEl)
|
|
269
|
+
return
|
|
270
|
+
if (!tabEls.value[cmpActiveIndex.value])
|
|
271
|
+
setTabEls(await utils.querySelector('.tab-list-box .tab-list.view-list .tab-item', thas.value, true))
|
|
272
|
+
|
|
273
|
+
if (!listEl.value)
|
|
274
|
+
setListEl(await utils.querySelector('.tab-list-box .tab-list.view-list', thas.value, false))
|
|
275
|
+
|
|
276
|
+
const scrollLeft = utils.scrollViewX({
|
|
277
|
+
viewLeft: activeEl.left || 0,
|
|
278
|
+
viewRight: activeEl.right || 0,
|
|
279
|
+
boxLeft: listEl.value?.left || 0,
|
|
280
|
+
boxRight: listEl.value?.right || 0,
|
|
281
|
+
prevWidth: tabEls.value[cmpActiveIndex.value - 1]?.width || 0,
|
|
282
|
+
nextWidth: tabEls.value[cmpActiveIndex.value + 1]?.width || 0,
|
|
283
|
+
scrollLeft: viewScrollLeft.value,
|
|
284
|
+
})
|
|
285
|
+
setViewScrollLeft(scrollLeft)
|
|
286
|
+
setScrollLeft(scrollLeft)
|
|
287
|
+
})
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const onScroll = (e: UniScrollViewOnScrollEvent) => {
|
|
291
|
+
setViewScrollLeft(e?.detail?.scrollLeft || 0)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const onOpenDown = () => {
|
|
295
|
+
return new Promise((resolve, reject) => {
|
|
296
|
+
nextTick(async () => {
|
|
297
|
+
try {
|
|
298
|
+
setListBoxEl(await utils.querySelector('.tab-list-box', thas.value, false))
|
|
299
|
+
setOpenPullDown(true)
|
|
300
|
+
setTimeout(() => {
|
|
301
|
+
setPullTransform(true)
|
|
302
|
+
resolve(true)
|
|
303
|
+
}, 20)
|
|
304
|
+
}
|
|
305
|
+
catch (error) {
|
|
306
|
+
reject(error)
|
|
307
|
+
}
|
|
308
|
+
})
|
|
309
|
+
})
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
const onSliding = (index: number) => {
|
|
313
|
+
if (props.disabled)
|
|
314
|
+
return
|
|
315
|
+
const tab = cmpTabList.value[index]
|
|
316
|
+
onSelect(tab, index)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
watch(
|
|
320
|
+
() => props.active,
|
|
321
|
+
v => setDataActive(v),
|
|
322
|
+
{ immediate: true },
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
watch(
|
|
326
|
+
[() => cmpActiveIndex.value, () => thas.value],
|
|
327
|
+
() => {
|
|
328
|
+
scrollToActive()
|
|
329
|
+
},
|
|
330
|
+
{ immediate: true },
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
watch([() => cmpRootStyle.value, () => thas.value], () => {
|
|
334
|
+
if (!thas.value)
|
|
335
|
+
return
|
|
336
|
+
setUpdateTabsTimeout(async () => setTabEls(await utils.querySelector('.tab-list-box .tab-list.view-list .tab-item', thas.value, true)), 10)
|
|
337
|
+
})
|
|
338
|
+
watch([() => internalChildren.length, () => thas.value], () => initChildren())
|
|
339
|
+
|
|
340
|
+
return {
|
|
341
|
+
cmpRootStyle,
|
|
342
|
+
cmpListBackground,
|
|
343
|
+
cmpPullDown,
|
|
344
|
+
openPullDown,
|
|
345
|
+
cmpScrollX,
|
|
346
|
+
scrollLeft,
|
|
347
|
+
onScroll,
|
|
348
|
+
cmpTabList,
|
|
349
|
+
cmpShowLine,
|
|
350
|
+
cmpActiveTabEl,
|
|
351
|
+
onClickTab,
|
|
352
|
+
cmpEllipsis,
|
|
353
|
+
cmpTitleStyle,
|
|
354
|
+
cmpLineStyle,
|
|
355
|
+
onOpenDown,
|
|
356
|
+
cmpPullStyle,
|
|
357
|
+
onCloseDown,
|
|
358
|
+
cmpPullIconTransform,
|
|
359
|
+
cmpPullListTransform,
|
|
360
|
+
cmpActiveIndex,
|
|
361
|
+
cmpDisabledIndexs,
|
|
362
|
+
onSliding,
|
|
363
|
+
}
|
|
364
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#### Props
|
|
2
|
+
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
3
|
+
| ----- | ----- | --- | ------- | ------ | -------- |
|
|
4
|
+
| `selectable` | 文本是否可选 默认 false | `boolean` | `false` | - | - |
|
|
5
|
+
| `space` | 以何种方式显示连续空格 | `string` | - | - | - |
|
|
6
|
+
| `decode` | 是否解码 默认 false | `boolean` | `false` | - | - |
|
|
7
|
+
| `lines` | 文本显示的行数,如果设置,超出此行数,将会显示省略号 | `number` | - | - | - |
|
|
8
|
+
|
|
9
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Text 文本
|
|
2
|
+
|
|
3
|
+
文本组件
|
|
4
|
+
|
|
5
|
+
---$
|
|
6
|
+
|
|
7
|
+
### 代码演示
|
|
8
|
+
|
|
9
|
+
#### 可选
|
|
10
|
+
|
|
11
|
+
- 当`selectable`为`true`时,可长按选中文字
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<ste-text selectable>Stellar UI,全面的组件和便捷的工具会让您信手拈来,如鱼得水</ste-text>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
#### 解码
|
|
18
|
+
|
|
19
|
+
- ` ` 解码为一个不间断空格 (Non-Breaking Space)
|
|
20
|
+
- `<` 解码为小于号 <
|
|
21
|
+
- `>` 解码为大于号 >
|
|
22
|
+
- `&` 解码为和号 &
|
|
23
|
+
- `'` 解码为单引号 '
|
|
24
|
+
- ` ` 解码为一个半角空格 ( )
|
|
25
|
+
- ` ` 解码为一个全角空格 ( )
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<ste-text decode>Stellar UI</ste-text>
|
|
29
|
+
<ste-text decode>Stellar<UI</ste-text>
|
|
30
|
+
<ste-text decode>Stellar>UI</ste-text>
|
|
31
|
+
<ste-text decode>Stellar&UI</ste-text>
|
|
32
|
+
<ste-text decode>Stellar'UI</ste-text>
|
|
33
|
+
<ste-text decode>Stellar UI</ste-text>
|
|
34
|
+
<ste-text decode>Stellar UI</ste-text>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### 换行省略
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<ste-text>Stellar UI,全面的组件和便捷的工具会让您信手拈来,如鱼得水。Stellar UI,全面的组件和便捷的工具会让您信手拈来,如鱼得水。</ste-text>
|
|
41
|
+
<ste-text :lines="2">Stellar UI,全面的组件和便捷的工具会让您信手拈来,如鱼得水。Stellar UI,全面的组件和便捷的工具会让您信手拈来,如鱼得水。</ste-text>
|
|
42
|
+
<ste-text :lines="3">Stellar UI,全面的组件和便捷的工具会让您信手拈来,如鱼得水。Stellar UI,全面的组件和便捷的工具会让您信手拈来,如鱼得水。</ste-text>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---$
|
|
46
|
+
|
|
47
|
+
### API
|
|
48
|
+
|
|
49
|
+
<!-- props -->
|
|
50
|
+
|
|
51
|
+
#### 组件插槽(Slots)
|
|
52
|
+
|
|
53
|
+
| 插槽名 | 说明 | 插槽参数 | 支持版本 |
|
|
54
|
+
| ------- | ---- | -------- | -------- |
|
|
55
|
+
| default | 内容 | - | - |
|
|
56
|
+
|
|
57
|
+
---$
|
|
58
|
+
{{fuyuwei}}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PropType } from 'vue'
|
|
2
|
+
|
|
3
|
+
type TextSpace = 'ensp' | 'emsp' | 'nbsp'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
selectable: { type: Boolean, default: false },
|
|
7
|
+
space: { type: String as PropType<TextSpace>, default: undefined },
|
|
8
|
+
decode: { type: Boolean, default: false },
|
|
9
|
+
lines: { type: Number, default: undefined },
|
|
10
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ste-text",
|
|
3
|
+
"description": "文本",
|
|
4
|
+
"example": "<ste-text>文本</ste-text>",
|
|
5
|
+
"tutorial": "https://stellar-ui.intecloud.com.cn/plus/#/?active=text",
|
|
6
|
+
"attributes": [
|
|
7
|
+
{
|
|
8
|
+
"name": "selectable",
|
|
9
|
+
"description": "文本是否可选 默认 false",
|
|
10
|
+
"type": "boolean",
|
|
11
|
+
"default": false
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "space",
|
|
15
|
+
"description": "以何种方式显示连续空格",
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "decode",
|
|
20
|
+
"description": "是否解码 默认 false",
|
|
21
|
+
"type": "boolean",
|
|
22
|
+
"default": false
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "lines",
|
|
26
|
+
"description": "文本显示的行数,如果设置,超出此行数,将会显示省略号",
|
|
27
|
+
"type": "number"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, defineOptions } from 'vue';
|
|
3
|
+
import propsData from './props';
|
|
4
|
+
|
|
5
|
+
const componentName = `ste-text`;
|
|
6
|
+
defineOptions({
|
|
7
|
+
name: componentName,
|
|
8
|
+
options: {
|
|
9
|
+
virtualHost: true,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
const props = defineProps(propsData);
|
|
13
|
+
|
|
14
|
+
const cmpRootCssVar = computed(() => {
|
|
15
|
+
return { '--overflow-lines': props.lines };
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
"
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<text
|
|
22
|
+
:style="[cmpRootCssVar]"
|
|
23
|
+
class="ste-text-root"
|
|
24
|
+
:class="{ 'ste-text-lines': Number(lines) > 0 }"
|
|
25
|
+
:selectable="selectable"
|
|
26
|
+
:user-select="selectable"
|
|
27
|
+
:space="space"
|
|
28
|
+
:decode="decode"
|
|
29
|
+
:number-of-lines="lines"
|
|
30
|
+
>
|
|
31
|
+
<slot></slot>
|
|
32
|
+
</text>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<style lang="scss" scoped>
|
|
36
|
+
.ste-text-root {
|
|
37
|
+
&.ste-text-lines {
|
|
38
|
+
/* #ifdef MP-WEIXIN || H5 */
|
|
39
|
+
display: -webkit-box;
|
|
40
|
+
-webkit-box-orient: vertical;
|
|
41
|
+
-webkit-line-clamp: var(--overflow-lines);
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
/* #endif */
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#### Props
|
|
2
|
+
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
3
|
+
| ----- | ----- | --- | ------- | ------ | -------- |
|
|
4
|
+
| `title` | 提示的内容 | `String` | `` | - | - |
|
|
5
|
+
| `icon` | 图标 | `String` | `success` | `success`:显示成功图标<br/>`error`:显示失败图标<br/>`loading`:显示加载图标<br/>`none`:无图标 | - |
|
|
6
|
+
| `image` | 自定义图标的路径,image的优先级高于icon | `String` | `` | - | - |
|
|
7
|
+
| `duration` | 提示的延迟时间,单位ms 默认值:1500,值为 0 时,toast 不会自动消失(loading 类型默认为 0) | `Number` | `1500` | - | - |
|
|
8
|
+
| `mask` | 是否显示透明蒙层,防止触摸穿透 | `Boolean` | `false` | - | - |
|
|
9
|
+
| `order` | 是否是队列提示 | `Boolean` | `false` | - | - |
|
|
10
|
+
| `success` | 提示打开成功的回调函数 | `() => void` | - | - | - |
|
|
11
|
+
| `fail` | 提示打开失败的回调函数 | `() => void` | - | - | - |
|
|
12
|
+
| `complete` | 提示结束的回调函数(提示打开、失败都会执行) | `() => void` | - | - | - |
|
|
13
|
+
| `close` | 提示关闭的的回调函数 | `() => void` | - | - | - |
|
|
14
|
+
|
|
15
|
+
|