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,143 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import utils from '../../utils/utils.js';
|
|
3
|
+
import useColor from '../../config/color';
|
|
4
|
+
let color = useColor();
|
|
5
|
+
import propsData from './props';
|
|
6
|
+
import { computed, defineOptions, type CSSProperties } from 'vue';
|
|
7
|
+
|
|
8
|
+
defineOptions({
|
|
9
|
+
name: 'ste-rate',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const props = defineProps(propsData);
|
|
13
|
+
|
|
14
|
+
const cmpListStyle = computed(() => {
|
|
15
|
+
const style: CSSProperties = {};
|
|
16
|
+
// #ifdef H5
|
|
17
|
+
if (props.disabled || props.readonly) {
|
|
18
|
+
style['cursor'] = 'not-allowed';
|
|
19
|
+
} else {
|
|
20
|
+
style['cursor'] = 'pointer';
|
|
21
|
+
}
|
|
22
|
+
// #endif
|
|
23
|
+
return style;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const cmpItemStyle = computed(() => {
|
|
27
|
+
let style: CSSProperties = {};
|
|
28
|
+
style['marginRight'] = utils.formatPx(props.gutter);
|
|
29
|
+
return style;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const cmpCount = computed(() => {
|
|
33
|
+
// 兼容浏览器和微信 对数字循环的处理不同
|
|
34
|
+
return Array.from({ length: props.count }, (_, index) => index);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const cmpActiveCode = computed(() => {
|
|
38
|
+
let code = getIconCode();
|
|
39
|
+
if (code) return code;
|
|
40
|
+
return props.activeCode;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const cmpInactiveCode = computed(() => {
|
|
44
|
+
let code = getIconCode();
|
|
45
|
+
if (code) return code;
|
|
46
|
+
return props.inactiveCode;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
let cmpActiveColor = computed(() => {
|
|
50
|
+
return props.activeColor ? props.activeColor : color.getColor().steThemeColor;
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// 根据iconData来算出每个分值对应的iconCode
|
|
54
|
+
function getIconCode() {
|
|
55
|
+
if (!props.iconData || props.iconData.length === 0) return;
|
|
56
|
+
|
|
57
|
+
let curScroeIndex = Math.ceil(props.modelValue / props.score) - 1;
|
|
58
|
+
// 如果索引在数组范围内且对应的值不为空,直接返回该值
|
|
59
|
+
if (curScroeIndex < props.iconData.length && props.iconData[curScroeIndex] !== '') {
|
|
60
|
+
return props.iconData[curScroeIndex];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 否则,从索引位置向左搜索最近的非空值
|
|
64
|
+
for (let i = curScroeIndex; i >= 0; i--) {
|
|
65
|
+
if (props.iconData[i] !== '') {
|
|
66
|
+
return props.iconData[i];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return '';
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function onSelect(index: number) {
|
|
73
|
+
if (!props.disabled && !props.readonly) {
|
|
74
|
+
let value = (index + 1) * props.score;
|
|
75
|
+
if (props.modelValue != value) {
|
|
76
|
+
// 更新 model
|
|
77
|
+
emits('update:modelValue', value);
|
|
78
|
+
// change回调
|
|
79
|
+
emits('change', value);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const emits = defineEmits<{
|
|
85
|
+
(e: 'change', value: number | string): void;
|
|
86
|
+
(e: 'update:modelValue', value: number | string): void;
|
|
87
|
+
}>();
|
|
88
|
+
|
|
89
|
+
// 计算已评分占未评分的宽度
|
|
90
|
+
function getWidth(index: number) {
|
|
91
|
+
let value = (index + 1) * props.score;
|
|
92
|
+
let diff = props.modelValue - value;
|
|
93
|
+
// 全部占据
|
|
94
|
+
if (diff >= 0) {
|
|
95
|
+
return '100%';
|
|
96
|
+
}
|
|
97
|
+
// 部分占据
|
|
98
|
+
else if (Math.abs(diff) > 0 && Math.abs(diff) < props.score) {
|
|
99
|
+
return Number((1 - Math.abs(diff) / props.score).toFixed(2)) * 100 + '%';
|
|
100
|
+
}
|
|
101
|
+
// 未占据
|
|
102
|
+
else {
|
|
103
|
+
return 0;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
<template>
|
|
109
|
+
<view class="ste-rate-root">
|
|
110
|
+
<view class="list" :style="[cmpListStyle]">
|
|
111
|
+
<view v-for="index in cmpCount" class="item" :key="index" :style="[cmpItemStyle]">
|
|
112
|
+
<view class="icon-box inactive" @click="onSelect(index)">
|
|
113
|
+
<ste-icon :code="cmpInactiveCode" :color="inactiveColor" :size="size"></ste-icon>
|
|
114
|
+
</view>
|
|
115
|
+
<view class="icon-box active" @click="onSelect(index)" :style="{ width: getWidth(index) }">
|
|
116
|
+
<ste-icon :code="cmpActiveCode" :color="disabled ? '#C8C9CC' : cmpActiveColor" :size="size"></ste-icon>
|
|
117
|
+
</view>
|
|
118
|
+
</view>
|
|
119
|
+
</view>
|
|
120
|
+
</view>
|
|
121
|
+
</template>
|
|
122
|
+
|
|
123
|
+
<style lang="scss" scoped>
|
|
124
|
+
.ste-rate-root {
|
|
125
|
+
.list {
|
|
126
|
+
display: flex;
|
|
127
|
+
|
|
128
|
+
.item {
|
|
129
|
+
position: relative;
|
|
130
|
+
|
|
131
|
+
.active {
|
|
132
|
+
position: absolute;
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
top: 0;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.item:last-child {
|
|
140
|
+
margin-right: 0 !important;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#### Props
|
|
2
|
+
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
3
|
+
| ----- | ----- | --- | ------- | ------ | -------- |
|
|
4
|
+
| `showHeight` | 需要折叠的高度 | `string / number` | `400` | - | - |
|
|
5
|
+
| `toggle` | 展开后是否显示收起按钮 | `boolean` | `false` | - | - |
|
|
6
|
+
| `closeText` | '展开阅读'的文本 | `string` | `展开阅读全文` | - | - |
|
|
7
|
+
| `openText` | '收起'的文本 | `string` | `收起` | - | - |
|
|
8
|
+
| `fontSize` | 字体大小 | `string / number` | `28` | - | - |
|
|
9
|
+
| `color` | 文本颜色 | `string` | `#666666` | - | - |
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
#### Events
|
|
13
|
+
| 事件名 | 说明 | 事件参数 | 支持版本 |
|
|
14
|
+
| ----- | ----- | ------- | -------- |
|
|
15
|
+
| `open` | 展开时触发 | - | - |
|
|
16
|
+
| `click` | 收起时触发 | - | - |
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# ReadMore 展开更多
|
|
2
|
+
|
|
3
|
+
---$
|
|
4
|
+
|
|
5
|
+
### 代码演示
|
|
6
|
+
|
|
7
|
+
#### 基础使用
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<view>
|
|
11
|
+
<ste-read-more>{{ moreStr }}</ste-read-more>
|
|
12
|
+
</view>
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
const moreStr = ref(
|
|
15
|
+
'浔阳江头夜送客,枫叶荻花秋瑟瑟。主人下马客在船,举酒欲饮无管弦。醉不成欢惨将别,别时茫茫江浸月。 忽闻水上琵琶声,主人忘归客不发。寻声暗问弹者谁,琵琶声停欲语迟。移船相近邀相见,添酒回灯重开宴。千呼万唤始出来,犹抱琵琶半遮面。凝绝不通声暂歇。悄无言,唯见江心秋月白。 沉吟放拨插弦中,整顿衣裳起敛容。自言本是京城女,家在虾蟆陵下住。十三学得琵琶成,名属教坊第一部。曲罢曾教善才服,妆成每被秋娘妒。五陵年少争缠头,一曲红绡不知数。钿头银篦击节碎,血色罗裙翻酒污。今年欢笑复明年,秋月春风等闲度。弟走从军阿姨死,暮去朝来颜色故'
|
|
16
|
+
);
|
|
17
|
+
</script>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
#### 收起后展示按钮
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<view>
|
|
24
|
+
<ste-read-more toggle>{{ moreStr }}</ste-read-more>
|
|
25
|
+
</view>
|
|
26
|
+
<script lang="ts" setup>
|
|
27
|
+
const moreStr = ref(
|
|
28
|
+
'浔阳江头夜送客,枫叶荻花秋瑟瑟。主人下马客在船,举酒欲饮无管弦。醉不成欢惨将别,别时茫茫江浸月。 忽闻水上琵琶声,主人忘归客不发。寻声暗问弹者谁,琵琶声停欲语迟。移船相近邀相见,添酒回灯重开宴。千呼万唤始出来,犹抱琵琶半遮面。凝绝不通声暂歇。悄无言,唯见江心秋月白。 沉吟放拨插弦中,整顿衣裳起敛容。自言本是京城女,家在虾蟆陵下住。十三学得琵琶成,名属教坊第一部。曲罢曾教善才服,妆成每被秋娘妒。五陵年少争缠头,一曲红绡不知数。钿头银篦击节碎,血色罗裙翻酒污。今年欢笑复明年,秋月春风等闲度。弟走从军阿姨死,暮去朝来颜色故'
|
|
29
|
+
);
|
|
30
|
+
</script>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### 提示文字
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<view>
|
|
37
|
+
<ste-read-more toggle openText="收起吧" closeText="展开吧" color="#f1f" fontSize="32">{{ moreStr }}</ste-read-more>
|
|
38
|
+
</view>
|
|
39
|
+
<script lang="ts" setup>
|
|
40
|
+
const moreStr = ref(
|
|
41
|
+
'浔阳江头夜送客,枫叶荻花秋瑟瑟。主人下马客在船,举酒欲饮无管弦。醉不成欢惨将别,别时茫茫江浸月。 忽闻水上琵琶声,主人忘归客不发。寻声暗问弹者谁,琵琶声停欲语迟。移船相近邀相见,添酒回灯重开宴。千呼万唤始出来,犹抱琵琶半遮面。凝绝不通声暂歇。悄无言,唯见江心秋月白。 沉吟放拨插弦中,整顿衣裳起敛容。自言本是京城女,家在虾蟆陵下住。十三学得琵琶成,名属教坊第一部。曲罢曾教善才服,妆成每被秋娘妒。五陵年少争缠头,一曲红绡不知数。钿头银篦击节碎,血色罗裙翻酒污。今年欢笑复明年,秋月春风等闲度。弟走从军阿姨死,暮去朝来颜色故'
|
|
42
|
+
);
|
|
43
|
+
</script>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### 异步初始化
|
|
47
|
+
|
|
48
|
+
有时候需要展示的内容是从后端获取的,组件内部的`mounted`生命周期初始化时,请求尚未回来,会导致 内容的高度在初始化有误差。可以在请求完毕渲染后(指的是this.$nextTick),通过`ref`调用组件的`init`方法,重新初始化
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<view>
|
|
52
|
+
<ste-read-more ref="steReadMore">{{ moreStr }}</ste-read-more>
|
|
53
|
+
</view>
|
|
54
|
+
<script lang="ts" setup>
|
|
55
|
+
import { ref, nextTick } from 'vue';
|
|
56
|
+
import type { RefReadMore } from '@/uni_modules/stellar-ui-plus/types/refComponents';
|
|
57
|
+
|
|
58
|
+
const moreStr = ref(
|
|
59
|
+
'浔阳江头夜送客,枫叶荻花秋瑟瑟。主人下马客在船,举酒欲饮无管弦。醉不成欢惨将别,别时茫茫江浸月。 忽闻水上琵琶声,主人忘归客不发。寻声暗问弹者谁,琵琶声停欲语迟。移船相近邀相见,添酒回灯重开宴。千呼万唤始出来,犹抱琵琶半遮面。凝绝不通声暂歇。悄无言,唯见江心秋月白。 沉吟放拨插弦中,整顿衣裳起敛容。自言本是京城女,家在虾蟆陵下住。十三学得琵琶成,名属教坊第一部。曲罢曾教善才服,妆成每被秋娘妒。五陵年少争缠头,一曲红绡不知数。钿头银篦击节碎,血色罗裙翻酒污。今年欢笑复明年,秋月春风等闲度。弟走从军阿姨死,暮去朝来颜色故'
|
|
60
|
+
);
|
|
61
|
+
const moreStr3 = ref('');
|
|
62
|
+
|
|
63
|
+
const readMoreRef = ref<RefReadMore>();
|
|
64
|
+
|
|
65
|
+
setTimeout(() => {
|
|
66
|
+
moreStr3.value = moreStr.value;
|
|
67
|
+
nextTick(() => {
|
|
68
|
+
readMoreRef.value?.init();
|
|
69
|
+
});
|
|
70
|
+
}, 1500);
|
|
71
|
+
</script>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---$
|
|
75
|
+
|
|
76
|
+
### API
|
|
77
|
+
|
|
78
|
+
<!-- props -->
|
|
79
|
+
|
|
80
|
+
#### Slots
|
|
81
|
+
|
|
82
|
+
| 插槽名 | 说明 | 插槽参数 | 支持版本 |
|
|
83
|
+
| --------- | -------------- | -------- | -------- |
|
|
84
|
+
| `default` | 单选框文本内容 | - | - |
|
|
85
|
+
|
|
86
|
+
#### Methods
|
|
87
|
+
|
|
88
|
+
| 方法名 | 说明 | 方法参数 | 支持版本 |
|
|
89
|
+
| ------ | ---------------------------------------------------------- | -------- | -------- |
|
|
90
|
+
| `init` | 重新初始化组件内部高度计算过程,如果是异步获取内容需要用到 | - | - |
|
|
91
|
+
|
|
92
|
+
---$
|
|
93
|
+
{{fuyuwei}}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
showHeight: { type: [String, Number], default: 400 },
|
|
3
|
+
// 展开后是否显示收起按钮
|
|
4
|
+
toggle: { type: Boolean, default: false },
|
|
5
|
+
closeText: { type: String, default: '展开阅读全文' },
|
|
6
|
+
openText: { type: String, default: '收起' },
|
|
7
|
+
fontSize: { type: [String, Number], default: 28 },
|
|
8
|
+
color: { type: String, default: '#666666' },
|
|
9
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ste-read-more",
|
|
3
|
+
"description": "阅读更多",
|
|
4
|
+
"example": "<ste-read-more>文本文本文本文本文本文本文本文本文本</ste-read-more>",
|
|
5
|
+
"tutorial": "https://stellar-ui.intecloud.com.cn/plus/#/?active=read-more",
|
|
6
|
+
"attributes": [
|
|
7
|
+
{
|
|
8
|
+
"name": "showHeight",
|
|
9
|
+
"description": "需要折叠的高度",
|
|
10
|
+
"type": "string | number",
|
|
11
|
+
"default": 400
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "toggle",
|
|
15
|
+
"description": "展开后是否显示收起按钮",
|
|
16
|
+
"type": "boolean",
|
|
17
|
+
"default": false
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "closeText",
|
|
21
|
+
"description": "'展开阅读'的文本",
|
|
22
|
+
"type": "string",
|
|
23
|
+
"default": "展开阅读全文"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "openText",
|
|
27
|
+
"description": "'收起'的文本",
|
|
28
|
+
"type": "string",
|
|
29
|
+
"default": "收起"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "fontSize",
|
|
33
|
+
"description": "字体大小",
|
|
34
|
+
"type": "string | number",
|
|
35
|
+
"default": "28"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "color",
|
|
39
|
+
"description": "文本颜色",
|
|
40
|
+
"type": "string",
|
|
41
|
+
"default": "#666666"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "[event]open",
|
|
45
|
+
"description": "展开时触发",
|
|
46
|
+
"type": "() => void"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "[event]click",
|
|
50
|
+
"description": "收起时触发",
|
|
51
|
+
"type": "() => void"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref, onMounted, getCurrentInstance, type CSSProperties, defineOptions } from 'vue';
|
|
3
|
+
import propsData from './props';
|
|
4
|
+
import utils from '../../utils/utils';
|
|
5
|
+
|
|
6
|
+
const componentName = `ste-read-more`;
|
|
7
|
+
defineOptions({
|
|
8
|
+
name: componentName,
|
|
9
|
+
options: {
|
|
10
|
+
virtualHost: true,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
const props = defineProps(propsData);
|
|
14
|
+
const instance = getCurrentInstance() as unknown as ComponentPublicInstance;
|
|
15
|
+
|
|
16
|
+
const emits = defineEmits<{
|
|
17
|
+
(e: 'open'): void;
|
|
18
|
+
(e: 'close'): void;
|
|
19
|
+
}>();
|
|
20
|
+
|
|
21
|
+
const open = ref(false);
|
|
22
|
+
const showToggle = ref(false);
|
|
23
|
+
|
|
24
|
+
const cmpContentStyle = computed(() => {
|
|
25
|
+
let style: CSSProperties = {};
|
|
26
|
+
if (showToggle.value) {
|
|
27
|
+
style.height = open.value ? 'auto' : utils.addUnit(props.showHeight);
|
|
28
|
+
}
|
|
29
|
+
return style;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const cmpActionStyle = computed(() => ({
|
|
33
|
+
color: props.color,
|
|
34
|
+
fontSize: `var(--font-size-${props.fontSize},${utils.formatPx(props.fontSize)})`,
|
|
35
|
+
background: open.value ? '' : 'linear-gradient(-180deg, rgba(255, 255, 255, 0) 0%, rgb(255, 255, 255) 80%)',
|
|
36
|
+
}));
|
|
37
|
+
|
|
38
|
+
const cmpShowAction = computed(() => {
|
|
39
|
+
let show = true;
|
|
40
|
+
if (!showToggle.value) {
|
|
41
|
+
show = false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (open.value && !props.toggle) {
|
|
45
|
+
show = false;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return show;
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
function init() {
|
|
52
|
+
utils.sleep(200).then(() => {
|
|
53
|
+
utils.querySelector<false>('.content', instance).then(rect => {
|
|
54
|
+
showToggle.value = parseInt(String(rect.height)) > parseInt(utils.formatPx(props.showHeight).toString());
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function handleToggleStatus() {
|
|
60
|
+
if (!open.value) {
|
|
61
|
+
emits('open');
|
|
62
|
+
} else {
|
|
63
|
+
emits('close');
|
|
64
|
+
}
|
|
65
|
+
open.value = !open.value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
onMounted(() => {
|
|
69
|
+
init();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
defineExpose({ init });
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<template>
|
|
76
|
+
<view class="ste-read-more-root">
|
|
77
|
+
<view class="content-box" :style="[cmpContentStyle]">
|
|
78
|
+
<view class="content">
|
|
79
|
+
<slot></slot>
|
|
80
|
+
</view>
|
|
81
|
+
</view>
|
|
82
|
+
<view class="action-box" :style="[cmpActionStyle]" v-if="cmpShowAction">
|
|
83
|
+
<view @click="handleToggleStatus">{{ open ? openText : closeText }}</view>
|
|
84
|
+
<ste-icon :code="open ? '' : ''" size="28" marginBottom="3"></ste-icon>
|
|
85
|
+
</view>
|
|
86
|
+
</view>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<style lang="scss" scoped>
|
|
90
|
+
.ste-read-more-root {
|
|
91
|
+
.content-box {
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.action-box {
|
|
96
|
+
display: flex;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
align-items: center;
|
|
99
|
+
|
|
100
|
+
position: relative;
|
|
101
|
+
padding-top: 200rpx;
|
|
102
|
+
margin-top: -200rpx;
|
|
103
|
+
// margin-bottom: 20rpx;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#### Props
|
|
2
|
+
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
3
|
+
| ----- | ----- | --- | ------- | ------ | -------- |
|
|
4
|
+
| `text` | 富文本值 | `string` | `` | - | - |
|
|
5
|
+
| `space` | 显示连续空格 | `string` | `nbsp` | `ensp`:中文字符空格一半大小<br/>`emsp`:中文字符空格大小<br/>`nbsp`:根据字体设置的空格大小 | - |
|
|
6
|
+
| `userSelect` | 文本是否可选 | `boolean` | `false` | - | - |
|
|
7
|
+
|
|
8
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# RichText 富文本
|
|
2
|
+
|
|
3
|
+
富文本,增加文本换行功能,解决两张图片中间有空隙的问题。
|
|
4
|
+
|
|
5
|
+
---$
|
|
6
|
+
|
|
7
|
+
#### 一张图片
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<ste-rich-text :text="node1"></ste-rich-text>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
#### 两张图片
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<ste-rich-text :text="node2"></ste-rich-text>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
---$
|
|
20
|
+
|
|
21
|
+
### API
|
|
22
|
+
|
|
23
|
+
<!-- props -->
|
|
24
|
+
|
|
25
|
+
---$
|
|
26
|
+
{{xuyajun}}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RichTextSpace } from '@uni-helper/uni-app-types'
|
|
2
|
+
import type { PropType } from 'vue'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
text: { type: String, default: '' },
|
|
6
|
+
space: { type: String as PropType<RichTextSpace>, default: 'nbsp' },
|
|
7
|
+
userSelect: { type: Boolean, default: false },
|
|
8
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ste-rich-text",
|
|
3
|
+
"description": "阅读更多",
|
|
4
|
+
"example": "<ste-rich-text>文本文本文本文本文本文本文本文本文本</ste-rich-text>",
|
|
5
|
+
"tutorial": "https://stellar-ui.intecloud.com.cn/plus/#/?active=rich-text",
|
|
6
|
+
"attributes": [
|
|
7
|
+
{
|
|
8
|
+
"name": "text",
|
|
9
|
+
"description": "富文本值",
|
|
10
|
+
"type": "string",
|
|
11
|
+
"default": ""
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "space",
|
|
15
|
+
"description": "显示连续空格",
|
|
16
|
+
"type": "string",
|
|
17
|
+
"default": "nbsp",
|
|
18
|
+
"values": [
|
|
19
|
+
{
|
|
20
|
+
"name": "ensp",
|
|
21
|
+
"description": "中文字符空格一半大小"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "emsp",
|
|
25
|
+
"description": "中文字符空格大小"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "nbsp",
|
|
29
|
+
"description": "根据字体设置的空格大小"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "userSelect",
|
|
35
|
+
"description": "文本是否可选",
|
|
36
|
+
"type": "boolean",
|
|
37
|
+
"default": false
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import utils from '../../utils/utils';
|
|
3
|
+
import propsData from './props';
|
|
4
|
+
|
|
5
|
+
defineProps(propsData);
|
|
6
|
+
|
|
7
|
+
const replaceVerticalAlign = (text: string) => {
|
|
8
|
+
let html = text;
|
|
9
|
+
html = utils.richTextTagAddStyle(html, 'p', ['margin', 'margin-top'], ';margin-top:0');
|
|
10
|
+
html = utils.richTextTagAddStyle(html, 'p', ['margin', 'margin-bottom'], ';margin-bottom:0');
|
|
11
|
+
html = utils.richTextTagAddStyle(html, 'img', 'vertical-align', ';vertical-align:top');
|
|
12
|
+
// 解决微信小程序会忽略空白换行的问题
|
|
13
|
+
html = html.replace(/↵/g, '\n');
|
|
14
|
+
html = html.replace(/ /g, '\n');
|
|
15
|
+
// 解决特殊转义符的问题
|
|
16
|
+
html = html.replace(/·/g, '·');
|
|
17
|
+
html = html.replace(/—/g, '—');
|
|
18
|
+
return html;
|
|
19
|
+
};
|
|
20
|
+
</script>
|
|
21
|
+
<template>
|
|
22
|
+
<view class="rich-text-root">
|
|
23
|
+
<rich-text :nodes="replaceVerticalAlign(text)" :user-select="userSelect" class="rich-text" :space="space"></rich-text>
|
|
24
|
+
</view>
|
|
25
|
+
</template>
|
|
26
|
+
<style scoped lang="scss">
|
|
27
|
+
.rich-text-root {
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
.rich-text {
|
|
30
|
+
word-break: break-all;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#### Props
|
|
2
|
+
| 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
|
|
3
|
+
| ----- | ----- | --- | ------- | ------ | -------- |
|
|
4
|
+
| `active` | 当前激活的节点 | `number` | `0` | - | - |
|
|
5
|
+
| `height` | 滚动区域高度 | `number / string` | `100%` | - | - |
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
#### Events
|
|
9
|
+
| 事件名 | 说明 | 事件参数 | 支持版本 |
|
|
10
|
+
| ----- | ----- | ------- | -------- |
|
|
11
|
+
| `change` | 激活节点改变时触发 | - | - |
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# ScrollTo 滚动锚点
|
|
2
|
+
|
|
3
|
+
滚动锚点,可以滚动到指定锚点。
|
|
4
|
+
|
|
5
|
+
---$
|
|
6
|
+
|
|
7
|
+
#### 基础用法
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
import { ref } from 'vue';
|
|
12
|
+
|
|
13
|
+
const active = ref(0);
|
|
14
|
+
const contents = [
|
|
15
|
+
'https://image.whzb.com/chain/StellarUI/image/banner1.png',
|
|
16
|
+
'https://image.whzb.com/chain/StellarUI/image/banner2.png',
|
|
17
|
+
'https://image.whzb.com/chain/StellarUI/image/img1.jpg',
|
|
18
|
+
'https://image.whzb.com/chain/StellarUI/image/img2.jfif',
|
|
19
|
+
'https://image.whzb.com/chain/StellarUI/image/img3.jpg',
|
|
20
|
+
'https://image.whzb.com/chain/StellarUI/image/img4.jpg',
|
|
21
|
+
];
|
|
22
|
+
</script>
|
|
23
|
+
<ste-tabs :active.sync="active" sticky>
|
|
24
|
+
<ste-tab v-for="(m, i) in imgs" :key="i" :title="`标签${i + 1}`" />
|
|
25
|
+
</ste-tabs>
|
|
26
|
+
<ste-scroll-to v-model:active="active" height="1200">
|
|
27
|
+
<ste-scroll-to-item v-for="(m, i) in contents" :key="i">
|
|
28
|
+
<view>内容{{ i + 1 }}</view>
|
|
29
|
+
<image :src="m" mode="widthFix" style="width:100%"></image>
|
|
30
|
+
</ste-scroll-to-item>
|
|
31
|
+
</ste-scroll-to>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
---$
|
|
35
|
+
|
|
36
|
+
### API
|
|
37
|
+
|
|
38
|
+
<!-- props -->
|
|
39
|
+
|
|
40
|
+
#### ScrollTo Method
|
|
41
|
+
|
|
42
|
+
| 方法名 | 说明 | 支持版本 |
|
|
43
|
+
| ------ | ---------------------------------- | -------- |
|
|
44
|
+
| `init` | 初始化元素信息,请在渲染完成后调用 | - |
|
|
45
|
+
|
|
46
|
+
---$
|
|
47
|
+
{{xuyajun}}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const SCROLL_TO_KEY = Symbol('scroll-to')
|
|
2
|
+
|
|
3
|
+
export interface ScrollToProps {
|
|
4
|
+
active: number
|
|
5
|
+
height: number | string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
active: {
|
|
10
|
+
type: Number,
|
|
11
|
+
default: 0,
|
|
12
|
+
},
|
|
13
|
+
height: {
|
|
14
|
+
type: [Number, String],
|
|
15
|
+
default: '100%',
|
|
16
|
+
},
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ste-scroll-to",
|
|
3
|
+
"description": "ScrollTo滚动锚点",
|
|
4
|
+
"example": "<ste-scroll-to><ste-scroll-to-item>节点1</ste-scroll-to-item></ste-scroll-to>",
|
|
5
|
+
"tutorial": "https://stellar-ui.intecloud.com.cn/plus/#/?active=scroll-to",
|
|
6
|
+
"attributes": [
|
|
7
|
+
{
|
|
8
|
+
"name": "active",
|
|
9
|
+
"description": "当前激活的节点",
|
|
10
|
+
"type": "number",
|
|
11
|
+
"default": 0
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "height",
|
|
15
|
+
"description": "滚动区域高度",
|
|
16
|
+
"type": "number | string",
|
|
17
|
+
"default": "100%"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "[event]change",
|
|
21
|
+
"description": "激活节点改变时触发",
|
|
22
|
+
"type": "(index:number)=>void"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|