@wot-ui/ui 1.0.0 → 2.0.0-alpha.3
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/LICENSE +21 -0
- package/README.md +134 -0
- package/attributes.json +1 -0
- package/changelog.md +53 -0
- package/common/AbortablePromise.ts +28 -0
- package/common/canvasHelper.ts +49 -0
- package/common/clickoutside.ts +25 -0
- package/common/event.ts +8 -0
- package/common/formatDate.ts +68 -0
- package/common/interceptor.ts +43 -0
- package/common/props.ts +53 -0
- package/common/util.ts +836 -0
- package/components/wd-action-sheet/index.scss +232 -0
- package/components/wd-action-sheet/types.ts +155 -0
- package/components/wd-action-sheet/wd-action-sheet.vue +176 -0
- package/components/wd-avatar/index.scss +150 -0
- package/components/wd-avatar/types.ts +98 -0
- package/components/wd-avatar/wd-avatar.vue +184 -0
- package/components/wd-avatar-group/index.scss +11 -0
- package/components/wd-avatar-group/types.ts +61 -0
- package/components/wd-avatar-group/wd-avatar-group.vue +115 -0
- package/components/wd-backtop/index.scss +67 -0
- package/components/wd-backtop/types.ts +66 -0
- package/components/wd-backtop/wd-backtop.vue +57 -0
- package/components/wd-badge/index.scss +116 -0
- package/components/wd-badge/types.ts +94 -0
- package/components/wd-badge/wd-badge.vue +78 -0
- package/components/wd-button/index.scss +436 -0
- package/components/wd-button/types.ts +204 -0
- package/components/wd-button/wd-button.vue +210 -0
- package/components/wd-calendar/index.scss +97 -0
- package/components/wd-calendar/types.ts +221 -0
- package/components/wd-calendar/wd-calendar.vue +339 -0
- package/components/wd-calendar-view/index.scss +41 -0
- package/components/wd-calendar-view/month/index.scss +144 -0
- package/components/wd-calendar-view/month/month.vue +389 -0
- package/components/wd-calendar-view/month/types.ts +70 -0
- package/components/wd-calendar-view/monthPanel/index.scss +84 -0
- package/components/wd-calendar-view/monthPanel/month-panel.vue +541 -0
- package/components/wd-calendar-view/monthPanel/types.ts +151 -0
- package/components/wd-calendar-view/types.ts +166 -0
- package/components/wd-calendar-view/utils.ts +318 -0
- package/components/wd-calendar-view/wd-calendar-view.vue +117 -0
- package/components/wd-calendar-view/year/index.scss +148 -0
- package/components/wd-calendar-view/year/types.ts +74 -0
- package/components/wd-calendar-view/year/year.vue +206 -0
- package/components/wd-calendar-view/yearPanel/index.scss +42 -0
- package/components/wd-calendar-view/yearPanel/types.ts +96 -0
- package/components/wd-calendar-view/yearPanel/year-panel.vue +249 -0
- package/components/wd-card/index.scss +104 -0
- package/components/wd-card/types.ts +47 -0
- package/components/wd-card/wd-card.vue +38 -0
- package/components/wd-cascader/index.scss +154 -0
- package/components/wd-cascader/types.ts +191 -0
- package/components/wd-cascader/wd-cascader.vue +589 -0
- package/components/wd-cell/index.scss +244 -0
- package/components/wd-cell/types.ts +205 -0
- package/components/wd-cell/wd-cell.vue +172 -0
- package/components/wd-cell-group/index.scss +53 -0
- package/components/wd-cell-group/types.ts +97 -0
- package/components/wd-cell-group/wd-cell-group.vue +48 -0
- package/components/wd-checkbox/index.scss +166 -0
- package/components/wd-checkbox/types.ts +118 -0
- package/components/wd-checkbox/wd-checkbox.vue +216 -0
- package/components/wd-checkbox-group/index.scss +5 -0
- package/components/wd-checkbox-group/types.ts +93 -0
- package/components/wd-checkbox-group/wd-checkbox-group.vue +148 -0
- package/components/wd-circle/index.scss +28 -0
- package/components/wd-circle/types.ts +54 -0
- package/components/wd-circle/wd-circle.vue +306 -0
- package/components/wd-col/index.scss +5 -0
- package/components/wd-col/types.ts +16 -0
- package/components/wd-col/wd-col.vue +83 -0
- package/components/wd-collapse/index.scss +71 -0
- package/components/wd-collapse/types.ts +68 -0
- package/components/wd-collapse/wd-collapse.vue +165 -0
- package/components/wd-collapse-item/index.scss +86 -0
- package/components/wd-collapse-item/types.ts +62 -0
- package/components/wd-collapse-item/wd-collapse-item.vue +184 -0
- package/components/wd-config-provider/index.scss +10 -0
- package/components/wd-config-provider/types.ts +2063 -0
- package/components/wd-config-provider/wd-config-provider.vue +61 -0
- package/components/wd-count-down/index.scss +16 -0
- package/components/wd-count-down/types.ts +58 -0
- package/components/wd-count-down/utils.ts +52 -0
- package/components/wd-count-down/wd-count-down.vue +62 -0
- package/components/wd-count-to/index.scss +25 -0
- package/components/wd-count-to/types.ts +121 -0
- package/components/wd-count-to/wd-count-to.vue +126 -0
- package/components/wd-curtain/index.scss +96 -0
- package/components/wd-curtain/types.ts +82 -0
- package/components/wd-curtain/wd-curtain.vue +172 -0
- package/components/wd-datetime-picker/index.scss +133 -0
- package/components/wd-datetime-picker/types.ts +198 -0
- package/components/wd-datetime-picker/wd-datetime-picker.vue +526 -0
- package/components/wd-datetime-picker-view/types.ts +171 -0
- package/components/wd-datetime-picker-view/util.ts +30 -0
- package/components/wd-datetime-picker-view/wd-datetime-picker-view.vue +402 -0
- package/components/wd-dialog/index.scss +281 -0
- package/components/wd-dialog/index.ts +168 -0
- package/components/wd-dialog/types.ts +452 -0
- package/components/wd-dialog/wd-dialog.vue +586 -0
- package/components/wd-divider/index.scss +122 -0
- package/components/wd-divider/types.ts +50 -0
- package/components/wd-divider/wd-divider.vue +54 -0
- package/components/wd-drop-menu/index.scss +90 -0
- package/components/wd-drop-menu/types.ts +38 -0
- package/components/wd-drop-menu/wd-drop-menu.vue +168 -0
- package/components/wd-drop-menu-item/index.scss +96 -0
- package/components/wd-drop-menu-item/types.ts +93 -0
- package/components/wd-drop-menu-item/wd-drop-menu-item.vue +205 -0
- package/components/wd-empty/index.scss +46 -0
- package/components/wd-empty/types.ts +37 -0
- package/components/wd-empty/wd-empty.vue +47 -0
- package/components/wd-fab/index.scss +124 -0
- package/components/wd-fab/types.ts +119 -0
- package/components/wd-fab/wd-fab.vue +322 -0
- package/components/wd-floating-panel/index.scss +73 -0
- package/components/wd-floating-panel/type.ts +32 -0
- package/components/wd-floating-panel/wd-floating-panel.vue +142 -0
- package/components/wd-form/adapters/zod.ts +56 -0
- package/components/wd-form/types.ts +147 -0
- package/components/wd-form/wd-form.vue +121 -0
- package/components/wd-form-item/index.scss +26 -0
- package/components/wd-form-item/types.ts +134 -0
- package/components/wd-form-item/wd-form-item.vue +182 -0
- package/components/wd-gap/index.scss +9 -0
- package/components/wd-gap/types.ts +26 -0
- package/components/wd-gap/wd-gap.vue +38 -0
- package/components/wd-grid/index.scss +11 -0
- package/components/wd-grid/types.ts +97 -0
- package/components/wd-grid/wd-grid.vue +48 -0
- package/components/wd-grid-item/index.scss +187 -0
- package/components/wd-grid-item/types.ts +98 -0
- package/components/wd-grid-item/wd-grid-item.vue +295 -0
- package/components/wd-icon/index.scss +46 -0
- package/components/wd-icon/types.ts +44 -0
- package/components/wd-icon/wd-icon.vue +66 -0
- package/components/wd-image-preview/index.scss +94 -0
- package/components/wd-image-preview/index.ts +95 -0
- package/components/wd-image-preview/types.ts +165 -0
- package/components/wd-image-preview/wd-image-preview.vue +233 -0
- package/components/wd-img/index.scss +82 -0
- package/components/wd-img/types.ts +96 -0
- package/components/wd-img/wd-img.vue +91 -0
- package/components/wd-img-cropper/index.scss +259 -0
- package/components/wd-img-cropper/types.ts +101 -0
- package/components/wd-img-cropper/wd-img-cropper.vue +653 -0
- package/components/wd-index-anchor/index.scss +34 -0
- package/components/wd-index-anchor/type.ts +9 -0
- package/components/wd-index-anchor/wd-index-anchor.vue +55 -0
- package/components/wd-index-bar/index.scss +68 -0
- package/components/wd-index-bar/type.ts +23 -0
- package/components/wd-index-bar/wd-index-bar.vue +157 -0
- package/components/wd-input/index.scss +129 -0
- package/components/wd-input/types.ts +165 -0
- package/components/wd-input/wd-input.vue +237 -0
- package/components/wd-input-number/index.scss +233 -0
- package/components/wd-input-number/types.ts +131 -0
- package/components/wd-input-number/wd-input-number.vue +473 -0
- package/components/wd-keyboard/constants.ts +81 -0
- package/components/wd-keyboard/index.scss +104 -0
- package/components/wd-keyboard/key/index.scss +103 -0
- package/components/wd-keyboard/key/index.vue +84 -0
- package/components/wd-keyboard/key/types.ts +44 -0
- package/components/wd-keyboard/types.ts +138 -0
- package/components/wd-keyboard/wd-keyboard.vue +236 -0
- package/components/wd-loading/index.scss +205 -0
- package/components/wd-loading/types.ts +61 -0
- package/components/wd-loading/wd-loading.vue +70 -0
- package/components/wd-loadmore/index.scss +62 -0
- package/components/wd-loadmore/types.ts +42 -0
- package/components/wd-loadmore/wd-loadmore.vue +68 -0
- package/components/wd-navbar/index.scss +96 -0
- package/components/wd-navbar/types.ts +74 -0
- package/components/wd-navbar/wd-navbar.vue +136 -0
- package/components/wd-navbar-capsule/index.scss +70 -0
- package/components/wd-navbar-capsule/types.ts +11 -0
- package/components/wd-navbar-capsule/wd-navbar-capsule.vue +48 -0
- package/components/wd-notice-bar/index.scss +94 -0
- package/components/wd-notice-bar/types.ts +97 -0
- package/components/wd-notice-bar/wd-notice-bar.vue +270 -0
- package/components/wd-notify/index.scss +114 -0
- package/components/wd-notify/index.ts +63 -0
- package/components/wd-notify/types.ts +130 -0
- package/components/wd-notify/wd-notify.vue +162 -0
- package/components/wd-overlay/index.scss +14 -0
- package/components/wd-overlay/types.ts +42 -0
- package/components/wd-overlay/wd-overlay.vue +55 -0
- package/components/wd-pagination/index.scss +71 -0
- package/components/wd-pagination/types.ts +69 -0
- package/components/wd-pagination/wd-pagination.vue +118 -0
- package/components/wd-password-input/index.scss +134 -0
- package/components/wd-password-input/types.ts +42 -0
- package/components/wd-password-input/wd-password-input.vue +51 -0
- package/components/wd-picker/index.scss +72 -0
- package/components/wd-picker/types.ts +141 -0
- package/components/wd-picker/wd-picker.vue +220 -0
- package/components/wd-picker-view/index.scss +93 -0
- package/components/wd-picker-view/types.ts +145 -0
- package/components/wd-picker-view/useSelection.ts +385 -0
- package/components/wd-picker-view/wd-picker-view.vue +227 -0
- package/components/wd-popover/index.scss +117 -0
- package/components/wd-popover/types.ts +106 -0
- package/components/wd-popover/wd-popover.vue +212 -0
- package/components/wd-popup/index.scss +89 -0
- package/components/wd-popup/types.ts +110 -0
- package/components/wd-popup/wd-popup.vue +174 -0
- package/components/wd-progress/index.scss +155 -0
- package/components/wd-progress/types.ts +94 -0
- package/components/wd-progress/wd-progress.vue +249 -0
- package/components/wd-radio/index.scss +189 -0
- package/components/wd-radio/types.ts +64 -0
- package/components/wd-radio/wd-radio.vue +164 -0
- package/components/wd-radio-group/index.scss +5 -0
- package/components/wd-radio-group/types.ts +70 -0
- package/components/wd-radio-group/wd-radio-group.vue +53 -0
- package/components/wd-rate/index.scss +57 -0
- package/components/wd-rate/types.ts +86 -0
- package/components/wd-rate/wd-rate.vue +168 -0
- package/components/wd-resize/index.scss +31 -0
- package/components/wd-resize/types.ts +14 -0
- package/components/wd-resize/wd-resize.vue +157 -0
- package/components/wd-root-portal/wd-root-portal.vue +77 -0
- package/components/wd-row/index.scss +6 -0
- package/components/wd-row/types.ts +36 -0
- package/components/wd-row/wd-row.vue +88 -0
- package/components/wd-search/index.scss +171 -0
- package/components/wd-search/types.ts +107 -0
- package/components/wd-search/wd-search.vue +198 -0
- package/components/wd-segmented/index.scss +155 -0
- package/components/wd-segmented/types.ts +81 -0
- package/components/wd-segmented/wd-segmented.vue +169 -0
- package/components/wd-select-picker/index.scss +72 -0
- package/components/wd-select-picker/types.ts +72 -0
- package/components/wd-select-picker/wd-select-picker.vue +371 -0
- package/components/wd-sidebar/index.scss +25 -0
- package/components/wd-sidebar/types.ts +34 -0
- package/components/wd-sidebar/wd-sidebar.vue +57 -0
- package/components/wd-sidebar-item/index.scss +91 -0
- package/components/wd-sidebar-item/types.ts +28 -0
- package/components/wd-sidebar-item/wd-sidebar-item.vue +118 -0
- package/components/wd-signature/index.scss +42 -0
- package/components/wd-signature/types.ts +295 -0
- package/components/wd-signature/wd-signature.vue +664 -0
- package/components/wd-skeleton/index.scss +112 -0
- package/components/wd-skeleton/types.ts +124 -0
- package/components/wd-skeleton/wd-skeleton.vue +110 -0
- package/components/wd-slide-verify/index.scss +112 -0
- package/components/wd-slide-verify/types.ts +98 -0
- package/components/wd-slide-verify/wd-slide-verify.vue +222 -0
- package/components/wd-slider/index.scss +485 -0
- package/components/wd-slider/types.ts +166 -0
- package/components/wd-slider/wd-slider.vue +529 -0
- package/components/wd-sort-button/index.scss +126 -0
- package/components/wd-sort-button/types.ts +68 -0
- package/components/wd-sort-button/wd-sort-button.vue +67 -0
- package/components/wd-step/index.scss +366 -0
- package/components/wd-step/types.ts +43 -0
- package/components/wd-step/wd-step.vue +181 -0
- package/components/wd-steps/index.scss +7 -0
- package/components/wd-steps/types.ts +50 -0
- package/components/wd-steps/wd-steps.vue +39 -0
- package/components/wd-sticky/index.scss +9 -0
- package/components/wd-sticky/types.ts +13 -0
- package/components/wd-sticky/wd-sticky.vue +192 -0
- package/components/wd-sticky-box/index.scss +6 -0
- package/components/wd-sticky-box/types.ts +20 -0
- package/components/wd-sticky-box/wd-sticky-box.vue +157 -0
- package/components/wd-swipe-action/index.scss +22 -0
- package/components/wd-swipe-action/types.ts +87 -0
- package/components/wd-swipe-action/wd-swipe-action.vue +320 -0
- package/components/wd-swiper/index.scss +69 -0
- package/components/wd-swiper/types.ts +275 -0
- package/components/wd-swiper/wd-swiper.vue +332 -0
- package/components/wd-swiper-nav/index.scss +179 -0
- package/components/wd-swiper-nav/types.ts +42 -0
- package/components/wd-swiper-nav/wd-swiper-nav.vue +42 -0
- package/components/wd-switch/index.scss +177 -0
- package/components/wd-switch/types.ts +93 -0
- package/components/wd-switch/wd-switch.vue +107 -0
- package/components/wd-tab/index.scss +16 -0
- package/components/wd-tab/types.ts +45 -0
- package/components/wd-tab/wd-tab.vue +99 -0
- package/components/wd-tabbar/index.scss +71 -0
- package/components/wd-tabbar/types.ts +79 -0
- package/components/wd-tabbar/wd-tabbar.vue +109 -0
- package/components/wd-tabbar-item/index.scss +50 -0
- package/components/wd-tabbar-item/types.ts +45 -0
- package/components/wd-tabbar-item/wd-tabbar-item.vue +101 -0
- package/components/wd-table/index.scss +128 -0
- package/components/wd-table/types.ts +160 -0
- package/components/wd-table/wd-table.vue +331 -0
- package/components/wd-table-column/index.scss +15 -0
- package/components/wd-table-column/types.ts +81 -0
- package/components/wd-table-column/wd-table-column.vue +198 -0
- package/components/wd-tabs/index.scss +332 -0
- package/components/wd-tabs/types.ts +155 -0
- package/components/wd-tabs/wd-tabs.vue +508 -0
- package/components/wd-tag/index.scss +325 -0
- package/components/wd-tag/types.ts +90 -0
- package/components/wd-tag/wd-tag.vue +158 -0
- package/components/wd-text/index.scss +52 -0
- package/components/wd-text/types.ts +107 -0
- package/components/wd-text/wd-text.vue +141 -0
- package/components/wd-textarea/index.scss +112 -0
- package/components/wd-textarea/types.ts +151 -0
- package/components/wd-textarea/wd-textarea.vue +212 -0
- package/components/wd-toast/index.scss +92 -0
- package/components/wd-toast/index.ts +97 -0
- package/components/wd-toast/types.ts +190 -0
- package/components/wd-toast/wd-toast.vue +158 -0
- package/components/wd-tooltip/index.scss +77 -0
- package/components/wd-tooltip/types.ts +105 -0
- package/components/wd-tooltip/wd-tooltip.vue +169 -0
- package/components/wd-tour/index.scss +106 -0
- package/components/wd-tour/types.ts +268 -0
- package/components/wd-tour/wd-tour.vue +518 -0
- package/components/wd-transition/index.scss +67 -0
- package/components/wd-transition/types.ts +106 -0
- package/components/wd-transition/wd-transition.vue +238 -0
- package/components/wd-upload/index.scss +204 -0
- package/components/wd-upload/types.ts +390 -0
- package/components/wd-upload/wd-upload.vue +565 -0
- package/components/wd-video-preview/index.scss +54 -0
- package/components/wd-video-preview/index.ts +64 -0
- package/components/wd-video-preview/types.ts +66 -0
- package/components/wd-video-preview/wd-video-preview.vue +141 -0
- package/components/wd-watermark/index.scss +21 -0
- package/components/wd-watermark/types.ts +130 -0
- package/components/wd-watermark/wd-watermark.vue +718 -0
- package/components/wot-ui/wot-ui.vue +5 -0
- package/composables/index.ts +12 -0
- package/composables/useCell.ts +34 -0
- package/composables/useChildren.ts +120 -0
- package/composables/useConfigProvider.ts +45 -0
- package/composables/useCountDown.ts +138 -0
- package/composables/useDeviceInfo.ts +136 -0
- package/composables/useLockScroll.ts +37 -0
- package/composables/useParent.ts +51 -0
- package/composables/usePopover.ts +212 -0
- package/composables/useQueue.ts +52 -0
- package/composables/useRaf.ts +37 -0
- package/composables/useTouch.ts +43 -0
- package/composables/useTranslate.ts +12 -0
- package/composables/useUpload.ts +366 -0
- package/global.d.ts +106 -0
- package/index.ts +11 -0
- package/locale/index.ts +32 -0
- package/locale/lang/ar-SA.ts +150 -0
- package/locale/lang/de-DE.ts +150 -0
- package/locale/lang/en-US.ts +150 -0
- package/locale/lang/es-ES.ts +150 -0
- package/locale/lang/fr-FR.ts +150 -0
- package/locale/lang/ja-JP.ts +150 -0
- package/locale/lang/ko-KR.ts +150 -0
- package/locale/lang/pt-PT.ts +150 -0
- package/locale/lang/ru-RU.ts +150 -0
- package/locale/lang/th-TH.ts +150 -0
- package/locale/lang/tr-TR.ts +155 -0
- package/locale/lang/ug-CN.ts +154 -0
- package/locale/lang/vi-VN.ts +89 -0
- package/locale/lang/zh-CN.ts +154 -0
- package/locale/lang/zh-HK.ts +78 -0
- package/locale/lang/zh-TW.ts +78 -0
- package/package.json +1 -11
- package/styles/iconfont/iconfont.scss +1243 -0
- package/styles/mixin/_config.scss +7 -0
- package/styles/mixin/_function.scss +44 -0
- package/styles/mixin/_mixin.scss +473 -0
- package/styles/theme/base/color.scss +210 -0
- package/styles/theme/base/font.scss +13 -0
- package/styles/theme/base/index.scss +8 -0
- package/styles/theme/base/insets.scss +32 -0
- package/styles/theme/base/number.scss +36 -0
- package/styles/theme/base/opacity.scss +9 -0
- package/styles/theme/base/radius.scss +13 -0
- package/styles/theme/base/stroke.scss +9 -0
- package/styles/theme/base/typography.scss +44 -0
- package/styles/theme/dark.scss +101 -0
- package/styles/theme/index.scss +16 -0
- package/styles/theme/light.scss +101 -0
- package/styles/variable.scss +472 -0
- package/tags.json +1 -0
- package/web-types.json +1 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="rootClass" :style="customStyle">
|
|
3
|
+
<view class="wd-textarea__body">
|
|
4
|
+
<textarea
|
|
5
|
+
:class="`wd-textarea__inner ${customTextareaClass}`"
|
|
6
|
+
v-model="inputValue"
|
|
7
|
+
:show-count="false"
|
|
8
|
+
:placeholder="placeholderValue"
|
|
9
|
+
:disabled="disabled || readonly"
|
|
10
|
+
:enable-native="enableNative"
|
|
11
|
+
:maxlength="maxlength"
|
|
12
|
+
:focus="focused"
|
|
13
|
+
:auto-focus="autoFocus"
|
|
14
|
+
:placeholder-style="placeholderStyle"
|
|
15
|
+
:placeholder-class="inputPlaceholderClass"
|
|
16
|
+
:auto-height="autoHeight"
|
|
17
|
+
:cursor-spacing="cursorSpacing"
|
|
18
|
+
:fixed="fixed"
|
|
19
|
+
:cursor="cursor"
|
|
20
|
+
:show-confirm-bar="showConfirmBar"
|
|
21
|
+
:selection-start="selectionStart"
|
|
22
|
+
:selection-end="selectionEnd"
|
|
23
|
+
:adjust-position="adjustPosition"
|
|
24
|
+
:hold-keyboard="holdKeyboard"
|
|
25
|
+
:confirm-type="confirmType"
|
|
26
|
+
:confirm-hold="confirmHold"
|
|
27
|
+
:disable-default-padding="disableDefaultPadding"
|
|
28
|
+
:ignoreCompositionEvent="ignoreCompositionEvent"
|
|
29
|
+
:inputmode="inputmode"
|
|
30
|
+
@input="handleInput"
|
|
31
|
+
@focus="handleFocus"
|
|
32
|
+
@blur="handleBlur"
|
|
33
|
+
@confirm="handleConfirm"
|
|
34
|
+
@linechange="handleLineChange"
|
|
35
|
+
@keyboardheightchange="handleKeyboardheightchange"
|
|
36
|
+
/>
|
|
37
|
+
<view v-if="props.readonly" class="wd-textarea__readonly-mask" />
|
|
38
|
+
<wd-icon v-if="showClear" custom-class="wd-textarea__clear" name="close-circle" @click="handleClear" />
|
|
39
|
+
</view>
|
|
40
|
+
<view v-if="showWordCount" class="wd-textarea__count">{{ currentLength }}/{{ maxlength }}</view>
|
|
41
|
+
</view>
|
|
42
|
+
</template>
|
|
43
|
+
|
|
44
|
+
<script lang="ts">
|
|
45
|
+
export default {
|
|
46
|
+
name: 'wd-textarea',
|
|
47
|
+
options: {
|
|
48
|
+
// #ifndef MP-TOUTIAO
|
|
49
|
+
virtualHost: true,
|
|
50
|
+
// #endif
|
|
51
|
+
addGlobalClass: true,
|
|
52
|
+
styleIsolation: 'shared'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<script lang="ts" setup>
|
|
58
|
+
import { computed, onBeforeMount, ref, watch } from 'vue'
|
|
59
|
+
import wdIcon from '../wd-icon/wd-icon.vue'
|
|
60
|
+
import { isDef, pause } from '../../common/util'
|
|
61
|
+
import { useParent } from '../../composables/useParent'
|
|
62
|
+
import { useTranslate } from '../../composables/useTranslate'
|
|
63
|
+
import { textareaProps } from './types'
|
|
64
|
+
import { FORM_ITEM_VALIDATE_KEY } from '../wd-form-item/types'
|
|
65
|
+
|
|
66
|
+
const { translate } = useTranslate('textarea')
|
|
67
|
+
|
|
68
|
+
const props = defineProps(textareaProps)
|
|
69
|
+
const emit = defineEmits(['update:modelValue', 'clear', 'blur', 'focus', 'input', 'keyboardheightchange', 'confirm', 'linechange', 'click'])
|
|
70
|
+
const { parent: formItemValidate } = useParent(FORM_ITEM_VALIDATE_KEY)
|
|
71
|
+
|
|
72
|
+
const placeholderValue = computed(() => {
|
|
73
|
+
return isDef(props.placeholder) ? props.placeholder : translate('placeholder')
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const clearing = ref<boolean>(false)
|
|
77
|
+
const focused = ref<boolean>(false) // 控制聚焦
|
|
78
|
+
const focusing = ref<boolean>(false) // 当前是否激活状态
|
|
79
|
+
const inputValue = ref<string>('') // 输入框的值
|
|
80
|
+
|
|
81
|
+
watch(
|
|
82
|
+
() => props.focus,
|
|
83
|
+
(newValue) => {
|
|
84
|
+
focused.value = newValue
|
|
85
|
+
},
|
|
86
|
+
{ immediate: true, deep: true }
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
watch(
|
|
90
|
+
() => props.modelValue,
|
|
91
|
+
(newValue) => {
|
|
92
|
+
inputValue.value = isDef(newValue) ? String(newValue) : ''
|
|
93
|
+
},
|
|
94
|
+
{ immediate: true, deep: true }
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* 展示清空按钮
|
|
99
|
+
*/
|
|
100
|
+
const showClear = computed(() => {
|
|
101
|
+
const { disabled, readonly, clearable, clearTrigger } = props
|
|
102
|
+
if (clearable && !readonly && !disabled && inputValue.value && (clearTrigger === 'always' || (props.clearTrigger === 'focus' && focusing.value))) {
|
|
103
|
+
return true
|
|
104
|
+
} else {
|
|
105
|
+
return false
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 展示字数统计
|
|
111
|
+
*/
|
|
112
|
+
const showWordCount = computed(() => {
|
|
113
|
+
const { disabled, readonly, maxlength, showWordLimit } = props
|
|
114
|
+
return Boolean(!disabled && !readonly && isDef(maxlength) && maxlength > -1 && showWordLimit)
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
// 当前文本域文字长度
|
|
118
|
+
const currentLength = computed(() => {
|
|
119
|
+
/**
|
|
120
|
+
* 使用Array.from处理多码元字符以获取正确的长度
|
|
121
|
+
* @link https://github.com/Moonofweisheng/wot-design-uni/issues/933
|
|
122
|
+
*/
|
|
123
|
+
return Array.from(String(formatValue(props.modelValue))).length
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const rootClass = computed(() => {
|
|
127
|
+
return `wd-textarea ${props.error ? 'is-error' : ''} ${props.disabled ? 'is-disabled' : ''} ${props.autoHeight ? 'is-auto-height' : ''} ${
|
|
128
|
+
isCompact.value ? 'is-compact' : ''
|
|
129
|
+
} ${props.customClass}`
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
const isCompact = computed(() => {
|
|
133
|
+
return isDef(props.compact) ? props.compact : isDef(formItemValidate.value)
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
const inputPlaceholderClass = computed(() => {
|
|
137
|
+
return `wd-textarea__placeholder ${props.placeholderClass}`
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
onBeforeMount(() => {
|
|
141
|
+
initState()
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
// 状态初始化
|
|
145
|
+
function initState() {
|
|
146
|
+
inputValue.value = formatValue(inputValue.value)
|
|
147
|
+
emit('update:modelValue', inputValue.value)
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function formatValue(value: string | number) {
|
|
151
|
+
if (value === null || value === undefined) return ''
|
|
152
|
+
const { maxlength, showWordLimit } = props
|
|
153
|
+
if (showWordLimit && maxlength !== -1 && String(value).length > maxlength) {
|
|
154
|
+
return value.toString().substring(0, maxlength)
|
|
155
|
+
}
|
|
156
|
+
return `${value}`
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async function handleClear() {
|
|
160
|
+
focusing.value = false
|
|
161
|
+
inputValue.value = ''
|
|
162
|
+
if (props.focusWhenClear) {
|
|
163
|
+
clearing.value = true
|
|
164
|
+
focused.value = false
|
|
165
|
+
}
|
|
166
|
+
await pause()
|
|
167
|
+
if (props.focusWhenClear) {
|
|
168
|
+
focused.value = true
|
|
169
|
+
focusing.value = true
|
|
170
|
+
}
|
|
171
|
+
emit('update:modelValue', inputValue.value)
|
|
172
|
+
emit('clear')
|
|
173
|
+
}
|
|
174
|
+
async function handleBlur({ detail }: any) {
|
|
175
|
+
// 等待150毫秒,clear执行完毕
|
|
176
|
+
await pause(150)
|
|
177
|
+
|
|
178
|
+
if (clearing.value) {
|
|
179
|
+
clearing.value = false
|
|
180
|
+
return
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
focusing.value = false
|
|
184
|
+
emit('blur', {
|
|
185
|
+
value: inputValue.value,
|
|
186
|
+
cursor: detail.cursor ? detail.cursor : null
|
|
187
|
+
})
|
|
188
|
+
await formItemValidate.value?.validateByTrigger('blur')
|
|
189
|
+
}
|
|
190
|
+
function handleFocus({ detail }: any) {
|
|
191
|
+
focusing.value = true
|
|
192
|
+
emit('focus', detail)
|
|
193
|
+
}
|
|
194
|
+
function handleInput({ detail }: any) {
|
|
195
|
+
inputValue.value = formatValue(inputValue.value as string)
|
|
196
|
+
emit('update:modelValue', inputValue.value)
|
|
197
|
+
emit('input', detail)
|
|
198
|
+
}
|
|
199
|
+
function handleKeyboardheightchange({ detail }: any) {
|
|
200
|
+
emit('keyboardheightchange', detail)
|
|
201
|
+
}
|
|
202
|
+
function handleConfirm({ detail }: any) {
|
|
203
|
+
emit('confirm', detail)
|
|
204
|
+
}
|
|
205
|
+
function handleLineChange({ detail }: any) {
|
|
206
|
+
emit('linechange', detail)
|
|
207
|
+
}
|
|
208
|
+
</script>
|
|
209
|
+
|
|
210
|
+
<style lang="scss">
|
|
211
|
+
@use './index.scss';
|
|
212
|
+
</style>
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
@use '../../styles/mixin/mixin.scss' as *;
|
|
2
|
+
@use '../../styles/variable.scss' as *;
|
|
3
|
+
|
|
4
|
+
// ==================== Toast 组件变量 ====================
|
|
5
|
+
|
|
6
|
+
// 文字颜色
|
|
7
|
+
$toast-color: var(--wot-toast-color, $text-white) !default;
|
|
8
|
+
// 内边距
|
|
9
|
+
$toast-padding: var(--wot-toast-padding, $padding-extra-loose) !default;
|
|
10
|
+
// 最大宽度
|
|
11
|
+
$toast-max-width: var(--wot-toast-max-width, 300px) !default;
|
|
12
|
+
// 圆角大小
|
|
13
|
+
$toast-border-radius: var(--wot-toast-border-radius, $radius-large) !default;
|
|
14
|
+
// 背景色
|
|
15
|
+
$toast-bg: var(--wot-toast-bg, $opacfilled-tooltip-toast-cover) !default;
|
|
16
|
+
// 字号
|
|
17
|
+
$toast-font-size: var(--wot-toast-font-size, $typography-body-size-extra-large) !default;
|
|
18
|
+
// 行高
|
|
19
|
+
$toast-line-height: var(--wot-toast-line-height, $typography-body-line--height-size-extra-large) !default;
|
|
20
|
+
// 图标大小
|
|
21
|
+
$toast-icon-size: var(--wot-toast-icon-size, $n-24) !default;
|
|
22
|
+
// 消息内容左边距
|
|
23
|
+
$toast-msg-margin-left: var(--wot-toast-msg-margin-left, $spacing-tight) !default;
|
|
24
|
+
// 图标下边距
|
|
25
|
+
$toast-icon-margin-bottom: var(--wot-toast-icon-margin-bottom, $spacing-extra-tight) !default;
|
|
26
|
+
// loading 状态下的 padding
|
|
27
|
+
$toast-loading-padding: var(--wot-toast-loading-padding, $padding-main) !default;
|
|
28
|
+
// loading 动画的 margin-bottom
|
|
29
|
+
$toast-loading-margin-bottom: var(--wot-toast-loading-margin-bottom, $spacing-extra-loose) !default;
|
|
30
|
+
|
|
31
|
+
// ==================== Toast 组件样式 ====================
|
|
32
|
+
|
|
33
|
+
@include b(toast) {
|
|
34
|
+
display: inline-block;
|
|
35
|
+
max-width: $toast-max-width;
|
|
36
|
+
padding: $toast-padding;
|
|
37
|
+
background: $toast-bg;
|
|
38
|
+
border-radius: $toast-border-radius;
|
|
39
|
+
color: $toast-color;
|
|
40
|
+
transition: all 0.2s;
|
|
41
|
+
font-size: $toast-font-size;
|
|
42
|
+
box-sizing: border-box;
|
|
43
|
+
|
|
44
|
+
@include when(vertical) {
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@include e(msg) {
|
|
49
|
+
font-size: $toast-font-size;
|
|
50
|
+
word-break: break-all;
|
|
51
|
+
line-height: $toast-line-height;
|
|
52
|
+
text-align: left;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@include edeep(icon) {
|
|
56
|
+
font-size: $toast-icon-size;
|
|
57
|
+
line-height: $toast-icon-size;
|
|
58
|
+
@include when(vertical) {
|
|
59
|
+
margin-bottom: $toast-icon-margin-bottom;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
@include e(loading) {
|
|
63
|
+
margin-bottom: $toast-loading-margin-bottom;
|
|
64
|
+
display: inline-block;
|
|
65
|
+
}
|
|
66
|
+
@include m(top) {
|
|
67
|
+
transform: translate3d(0, -40vh, 0);
|
|
68
|
+
}
|
|
69
|
+
@include m(middle-top) {
|
|
70
|
+
transform: translate3d(0%, -18.8vh, 0);
|
|
71
|
+
}
|
|
72
|
+
@include m(middle) {
|
|
73
|
+
transform: translate3d(0, -50%, 0);
|
|
74
|
+
}
|
|
75
|
+
@include m(bottom) {
|
|
76
|
+
transform: translate3d(0, 40vh, 0);
|
|
77
|
+
}
|
|
78
|
+
@include m(with-icon) {
|
|
79
|
+
display: inline-flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
@include me(msg) {
|
|
82
|
+
margin-left: $toast-msg-margin-left;
|
|
83
|
+
@include when(vertical) {
|
|
84
|
+
margin-left: 0;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
@include m(loading) {
|
|
89
|
+
min-width: auto;
|
|
90
|
+
padding: $toast-loading-padding;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { inject, provide, ref } from 'vue'
|
|
2
|
+
import type { Toast, ToastOptions } from './types'
|
|
3
|
+
import { deepMerge } from '../../common/util'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* useToast 用到的key
|
|
7
|
+
*/
|
|
8
|
+
const toastDefaultOptionKey = '__TOAST_OPTION__'
|
|
9
|
+
|
|
10
|
+
// 默认模板
|
|
11
|
+
export const defaultOptions: ToastOptions = {
|
|
12
|
+
duration: 2000,
|
|
13
|
+
show: false
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const None = Symbol('None')
|
|
17
|
+
|
|
18
|
+
// 使用map存储定时器,避免先前的定时器覆盖后续的定时器
|
|
19
|
+
// 如果同一个 selector 多次调用 toast,则会清除之前的定时器,重新计时
|
|
20
|
+
const toastTimerMap = new Map<string, ReturnType<typeof setTimeout>>()
|
|
21
|
+
|
|
22
|
+
export function useToast(selector: string = ''): Toast {
|
|
23
|
+
const toastOptionKey = getToastOptionKey(selector)
|
|
24
|
+
const toastOption = inject(toastOptionKey, ref<ToastOptions | typeof None>(None)) // toast选项
|
|
25
|
+
if (toastOption.value === None) {
|
|
26
|
+
toastOption.value = defaultOptions
|
|
27
|
+
provide(toastOptionKey, toastOption)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const createMethod = (toastOptions: ToastOptions) => {
|
|
31
|
+
return (options: ToastOptions | string) => {
|
|
32
|
+
return show(deepMerge(toastOptions, typeof options === 'string' ? { msg: options } : options) as ToastOptions)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const show = (option: ToastOptions | string) => {
|
|
37
|
+
const options = deepMerge(defaultOptions, typeof option === 'string' ? { msg: option } : option) as ToastOptions
|
|
38
|
+
toastOption.value = deepMerge(options, {
|
|
39
|
+
show: true
|
|
40
|
+
}) as ToastOptions
|
|
41
|
+
// 开始渲染,并在 duration ms之后执行清除
|
|
42
|
+
const prevTimer = toastTimerMap.get(toastOptionKey)
|
|
43
|
+
if (prevTimer) {
|
|
44
|
+
clearTimeout(prevTimer)
|
|
45
|
+
toastTimerMap.delete(toastOptionKey)
|
|
46
|
+
}
|
|
47
|
+
if (options.duration && options.duration > 0) {
|
|
48
|
+
const nextTimer = setTimeout(() => {
|
|
49
|
+
toastTimerMap.delete(toastOptionKey)
|
|
50
|
+
close()
|
|
51
|
+
}, options.duration)
|
|
52
|
+
toastTimerMap.set(toastOptionKey, nextTimer)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const loading = createMethod({
|
|
57
|
+
iconName: 'loading',
|
|
58
|
+
duration: 0,
|
|
59
|
+
cover: true
|
|
60
|
+
})
|
|
61
|
+
const success = createMethod({
|
|
62
|
+
iconName: 'success',
|
|
63
|
+
duration: 1500
|
|
64
|
+
})
|
|
65
|
+
const error = createMethod({ iconName: 'error' })
|
|
66
|
+
const warning = createMethod({ iconName: 'warning' })
|
|
67
|
+
const info = createMethod({ iconName: 'info' })
|
|
68
|
+
|
|
69
|
+
const close = () => {
|
|
70
|
+
const timer = toastTimerMap.get(toastOptionKey)
|
|
71
|
+
if (timer) {
|
|
72
|
+
clearTimeout(timer)
|
|
73
|
+
toastTimerMap.delete(toastOptionKey)
|
|
74
|
+
}
|
|
75
|
+
toastOption.value = { show: false }
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
show,
|
|
79
|
+
loading,
|
|
80
|
+
success,
|
|
81
|
+
error,
|
|
82
|
+
warning,
|
|
83
|
+
info,
|
|
84
|
+
close
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const getToastOptionKey = (selector: string) => {
|
|
89
|
+
return selector ? `${toastDefaultOptionKey}${selector}` : toastDefaultOptionKey
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const toastIcon = {
|
|
93
|
+
success: 'check-circle',
|
|
94
|
+
warning: 'exclamation-circle',
|
|
95
|
+
info: 'info-circle',
|
|
96
|
+
error: 'close-circle'
|
|
97
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: weisheng
|
|
3
|
+
* @Date: 2023-06-19 12:47:57
|
|
4
|
+
* @LastEditTime: 2026-01-22 23:52:18
|
|
5
|
+
* @LastEditors: weisheng
|
|
6
|
+
* @Description:
|
|
7
|
+
* @FilePath: /wot-ui/src/uni_modules/wot-ui/components/wd-toast/types.ts
|
|
8
|
+
* 记得注释
|
|
9
|
+
*/
|
|
10
|
+
import type { ExtractPropTypes, PropType } from 'vue'
|
|
11
|
+
import { baseProps, makeStringProp } from '../../common/props'
|
|
12
|
+
import type { LoadingType } from '../wd-loading/types'
|
|
13
|
+
|
|
14
|
+
export type ToastIconType = 'success' | 'error' | 'warning' | 'loading' | 'info' // 图标类型
|
|
15
|
+
|
|
16
|
+
export type ToastPositionType = 'top' | 'middle-top' | 'middle' | 'bottom' // 提示信息框的位置类型
|
|
17
|
+
|
|
18
|
+
export type ToastDirection = 'vertical' | 'horizontal' // 提示信息框的排列方向
|
|
19
|
+
|
|
20
|
+
export type ToastLoadingType = LoadingType // 提示信息加载状态类型
|
|
21
|
+
|
|
22
|
+
export type ToastOptions = {
|
|
23
|
+
msg?: string
|
|
24
|
+
duration?: number
|
|
25
|
+
direction?: ToastDirection
|
|
26
|
+
iconName?: ToastIconType
|
|
27
|
+
iconSize?: number
|
|
28
|
+
loadingType?: ToastLoadingType
|
|
29
|
+
loadingColor?: string
|
|
30
|
+
loadingSize?: number
|
|
31
|
+
iconColor?: string
|
|
32
|
+
position?: ToastPositionType
|
|
33
|
+
show?: boolean
|
|
34
|
+
zIndex?: number
|
|
35
|
+
/**
|
|
36
|
+
* 是否存在遮罩层
|
|
37
|
+
*/
|
|
38
|
+
cover?: boolean
|
|
39
|
+
/**
|
|
40
|
+
* 图标类名
|
|
41
|
+
*/
|
|
42
|
+
iconClass?: string
|
|
43
|
+
/**
|
|
44
|
+
* 类名前缀,用于使用自定义图标
|
|
45
|
+
*/
|
|
46
|
+
classPrefix?: string
|
|
47
|
+
/**
|
|
48
|
+
* 完全展示后的回调函数
|
|
49
|
+
*/
|
|
50
|
+
opened?: () => void
|
|
51
|
+
/**
|
|
52
|
+
* 完全关闭时的回调函数
|
|
53
|
+
*/
|
|
54
|
+
closed?: () => void
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface Toast {
|
|
58
|
+
// 打开Toast
|
|
59
|
+
show(toastOptions: ToastOptions | string): void
|
|
60
|
+
// 成功提示
|
|
61
|
+
success(toastOptions: ToastOptions | string): void
|
|
62
|
+
// 关闭提示
|
|
63
|
+
error(toastOptions: ToastOptions | string): void
|
|
64
|
+
// 常规提示
|
|
65
|
+
info(toastOptions: ToastOptions | string): void
|
|
66
|
+
// 警告提示
|
|
67
|
+
warning(toastOptions: ToastOptions | string): void
|
|
68
|
+
// 加载提示
|
|
69
|
+
loading(toastOptions: ToastOptions | string): void
|
|
70
|
+
// 关闭Toast
|
|
71
|
+
close(): void
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const toastProps = {
|
|
75
|
+
...baseProps,
|
|
76
|
+
/**
|
|
77
|
+
* 选择器
|
|
78
|
+
* @type {string}
|
|
79
|
+
* @default ''
|
|
80
|
+
*/
|
|
81
|
+
selector: makeStringProp(''),
|
|
82
|
+
/**
|
|
83
|
+
* 提示信息
|
|
84
|
+
* @type {string}
|
|
85
|
+
* @default ''
|
|
86
|
+
*/
|
|
87
|
+
msg: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: ''
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* 排列方向
|
|
93
|
+
* @type {'vertical' | 'horizontal'}
|
|
94
|
+
* @default 'horizontal'
|
|
95
|
+
*/
|
|
96
|
+
direction: makeStringProp<ToastDirection>('horizontal'),
|
|
97
|
+
/**
|
|
98
|
+
* 图标名称
|
|
99
|
+
* @type {'success' | 'error' | 'warning' | 'loading' | 'info'}
|
|
100
|
+
* @default ''
|
|
101
|
+
*/
|
|
102
|
+
iconName: {
|
|
103
|
+
type: String as PropType<ToastIconType>,
|
|
104
|
+
default: ''
|
|
105
|
+
},
|
|
106
|
+
/**
|
|
107
|
+
* 图标大小
|
|
108
|
+
* @type {number}
|
|
109
|
+
*/
|
|
110
|
+
iconSize: Number,
|
|
111
|
+
/**
|
|
112
|
+
* 加载类型
|
|
113
|
+
* @type {'circular' | 'spinner' | 'dots'}
|
|
114
|
+
* @default 'circular'
|
|
115
|
+
*/
|
|
116
|
+
loadingType: makeStringProp<ToastLoadingType>('circular'),
|
|
117
|
+
/**
|
|
118
|
+
* 加载颜色
|
|
119
|
+
* @type {string}
|
|
120
|
+
* @default '#ffffff'
|
|
121
|
+
*/
|
|
122
|
+
loadingColor: {
|
|
123
|
+
type: String,
|
|
124
|
+
default: '#ffffff'
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* 加载大小
|
|
128
|
+
* @type {number}
|
|
129
|
+
*/
|
|
130
|
+
loadingSize: Number,
|
|
131
|
+
/**
|
|
132
|
+
* 图标颜色
|
|
133
|
+
* @type {string}
|
|
134
|
+
*/
|
|
135
|
+
iconColor: String,
|
|
136
|
+
/**
|
|
137
|
+
* 位置
|
|
138
|
+
* @type {'top' | 'middle-top' | 'middle' | 'bottom'}
|
|
139
|
+
* @default 'middle'
|
|
140
|
+
*/
|
|
141
|
+
position: makeStringProp<ToastPositionType>('middle'),
|
|
142
|
+
/**
|
|
143
|
+
* 层级
|
|
144
|
+
* @type {number}
|
|
145
|
+
* @default 100
|
|
146
|
+
*/
|
|
147
|
+
zIndex: {
|
|
148
|
+
type: Number,
|
|
149
|
+
default: 100
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* 是否存在遮罩层
|
|
153
|
+
* @type {boolean}
|
|
154
|
+
* @default false
|
|
155
|
+
*/
|
|
156
|
+
cover: {
|
|
157
|
+
type: Boolean,
|
|
158
|
+
default: false
|
|
159
|
+
},
|
|
160
|
+
/**
|
|
161
|
+
* 图标类名
|
|
162
|
+
* @type {string}
|
|
163
|
+
* @default ''
|
|
164
|
+
*/
|
|
165
|
+
iconClass: {
|
|
166
|
+
type: String,
|
|
167
|
+
default: ''
|
|
168
|
+
},
|
|
169
|
+
/**
|
|
170
|
+
* 类名前缀
|
|
171
|
+
* @type {string}
|
|
172
|
+
* @default 'wd-icon'
|
|
173
|
+
*/
|
|
174
|
+
classPrefix: {
|
|
175
|
+
type: String,
|
|
176
|
+
default: 'wd-icon'
|
|
177
|
+
},
|
|
178
|
+
/**
|
|
179
|
+
* 完全展示后的回调函数
|
|
180
|
+
* @type {Function}
|
|
181
|
+
*/
|
|
182
|
+
opened: Function as PropType<() => void>,
|
|
183
|
+
/**
|
|
184
|
+
* 完全关闭时的回调函数
|
|
185
|
+
* @type {Function}
|
|
186
|
+
*/
|
|
187
|
+
closed: Function as PropType<() => void>
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export type ToastProps = ExtractPropTypes<typeof toastProps>
|