@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,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- #ifdef MP-DINGTALK -->
|
|
3
|
+
<view :class="`wd-index-anchor-ding ${isSticky ? 'is-sticky' : ''}`">
|
|
4
|
+
<!-- #endif -->
|
|
5
|
+
<view :class="`wd-index-anchor ${isSticky ? 'is-sticky' : ''} ${customClass}`" :style="customStyle" :id="indexAnchorId">
|
|
6
|
+
<slot>
|
|
7
|
+
{{ index }}
|
|
8
|
+
</slot>
|
|
9
|
+
</view>
|
|
10
|
+
<!-- #ifdef MP-DINGTALK -->
|
|
11
|
+
</view>
|
|
12
|
+
<!-- #endif -->
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { indexAnchorProps } from './type'
|
|
17
|
+
import { onMounted, getCurrentInstance, ref, computed } from 'vue'
|
|
18
|
+
import { indexBarInjectionKey } from '../wd-index-bar/type'
|
|
19
|
+
import { getRect, isDef, uuid } from '../../common/util'
|
|
20
|
+
import { useParent } from '../../composables/useParent'
|
|
21
|
+
|
|
22
|
+
const props = defineProps(indexAnchorProps)
|
|
23
|
+
|
|
24
|
+
const { parent: indexBar } = useParent(indexBarInjectionKey)
|
|
25
|
+
|
|
26
|
+
const indexAnchorId = ref<string>(`indexBar${uuid()}`)
|
|
27
|
+
|
|
28
|
+
const { proxy } = getCurrentInstance()!
|
|
29
|
+
|
|
30
|
+
const top = ref<number>(0)
|
|
31
|
+
|
|
32
|
+
const isSticky = computed(() => {
|
|
33
|
+
return indexBar.value && indexBar.value.props.sticky && indexBar.value.anchorState.activeIndex === props.index
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
function getInfo() {
|
|
37
|
+
getRect(`#${indexAnchorId.value}`, false, proxy).then((res) => {
|
|
38
|
+
if (isDef(indexBar.value)) {
|
|
39
|
+
top.value = Math.floor(res.top!)
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
onMounted(() => {
|
|
45
|
+
getInfo()
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
defineExpose({
|
|
49
|
+
top
|
|
50
|
+
})
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<style lang="scss">
|
|
54
|
+
@use './index.scss';
|
|
55
|
+
</style>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
@use '../../styles/mixin/mixin.scss' as *;
|
|
2
|
+
@use '../../styles/variable.scss' as *;
|
|
3
|
+
|
|
4
|
+
$index-bar-sidebar-right: var(--wot-index-bar-sidebar-right, $spacing-super-tight) !default;
|
|
5
|
+
$index-bar-index-font-size: var(--wot-index-bar-index-font-size, $typography-label-size-main) !default;
|
|
6
|
+
$index-bar-index-width: var(--wot-index-bar-index-width, $typography-label-line--height-size-main) !default;
|
|
7
|
+
$index-bar-index-height: var(--wot-index-bar-index-height, $typography-label-line--height-size-main) !default;
|
|
8
|
+
$index-bar-index-font-weight: var(--wot-index-bar-index-font-weight, $font-weight-medium) !default;
|
|
9
|
+
$index-bar-index-color: var(--wot-index-bar-index-color, $text-auxiliary) !default;
|
|
10
|
+
$index-bar-index-border-radius: var(--wot-index-bar-index-border-radius, $radius-radius-full) !default;
|
|
11
|
+
$index-bar-index-color-active: var(--wot-index-bar-index-color-active, $text-white) !default;
|
|
12
|
+
$index-bar-index-bg-active: var(--wot-index-bar-index-bg-active, $primary-6) !default;
|
|
13
|
+
$index-bar-current-index-size: var(--wot-index-bar-current-index-size, $n-56) !default;
|
|
14
|
+
$index-bar-current-index-bg: var(--wot-index-bar-current-index-bg, $primary-6) !default;
|
|
15
|
+
$index-bar-current-index-color: var(--wot-index-bar-current-index-color, $text-white) !default;
|
|
16
|
+
$index-bar-current-index-font-size: var(--wot-index-bar-current-index-font-size, $typography-title-size-extra-large) !default;
|
|
17
|
+
$index-bar-current-index-z-index: var(--wot-index-bar-current-index-z-index, 10) !default;
|
|
18
|
+
|
|
19
|
+
@include b(index-bar) {
|
|
20
|
+
position: relative;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
|
|
24
|
+
@include e(content) {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@include e(current-index) {
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: 50%;
|
|
32
|
+
left: 50%;
|
|
33
|
+
z-index: $index-bar-current-index-z-index;
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
width: $index-bar-current-index-size;
|
|
38
|
+
height: $index-bar-current-index-size;
|
|
39
|
+
font-size: $index-bar-current-index-font-size;
|
|
40
|
+
color: $index-bar-current-index-color;
|
|
41
|
+
background-color: $index-bar-current-index-bg;
|
|
42
|
+
border-radius: 50%;
|
|
43
|
+
transform: translate(-50%, -50%);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@include e(sidebar) {
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 50%;
|
|
49
|
+
right: $index-bar-sidebar-right;
|
|
50
|
+
transform: translateY(-50%);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@include e(index) {
|
|
54
|
+
color: $index-bar-index-color;
|
|
55
|
+
font-size: $index-bar-index-font-size;
|
|
56
|
+
font-weight: $index-bar-index-font-weight;
|
|
57
|
+
height: $index-bar-index-height;
|
|
58
|
+
width: $index-bar-index-width;
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
border-radius: $index-bar-index-border-radius;
|
|
63
|
+
@include when(active) {
|
|
64
|
+
color: $index-bar-index-color-active;
|
|
65
|
+
background: $index-bar-index-bg-active;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { InjectionKey } from 'vue'
|
|
2
|
+
import type { ExtractPropTypes } from 'vue'
|
|
3
|
+
import { makeBooleanProp } from '../../common/props'
|
|
4
|
+
|
|
5
|
+
export type AnchorIndex = number | string
|
|
6
|
+
|
|
7
|
+
export const indexBarProps = {
|
|
8
|
+
/**
|
|
9
|
+
* @description 索引是否吸顶
|
|
10
|
+
*/
|
|
11
|
+
sticky: makeBooleanProp(false)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type IndexBarProps = ExtractPropTypes<typeof indexBarProps>
|
|
15
|
+
|
|
16
|
+
export type InderBarProvide = {
|
|
17
|
+
props: { sticky?: boolean }
|
|
18
|
+
anchorState: {
|
|
19
|
+
activeIndex: AnchorIndex | null // 当前激活的索引
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const indexBarInjectionKey: InjectionKey<InderBarProvide> = Symbol('wd-index-bar')
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="wd-index-bar" :id="indexBarId">
|
|
3
|
+
<!-- #ifdef MP-DINGTALK -->
|
|
4
|
+
<view class="wd-index-bar" :id="indexBarId">
|
|
5
|
+
<!-- #endif -->
|
|
6
|
+
<scroll-view :scrollTop="scrollState.scrollTop" :scroll-y="true" class="wd-index-bar__content" @scroll="hanleScroll">
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</scroll-view>
|
|
9
|
+
<view v-if="scrollState.touching" class="wd-index-bar__current-index">{{ state.activeIndex }}</view>
|
|
10
|
+
<view
|
|
11
|
+
class="wd-index-bar__sidebar"
|
|
12
|
+
@touchstart.stop.prevent="handleTouchStart"
|
|
13
|
+
@touchmove.stop.prevent="handleTouchMove"
|
|
14
|
+
@touchend.stop.prevent="handleTouchEnd"
|
|
15
|
+
@touchcancel.stop.prevent="handleTouchEnd"
|
|
16
|
+
>
|
|
17
|
+
<view class="wd-index-bar__index" :class="{ 'is-active': item.index === state.activeIndex }" v-for="item in children" :key="item.index">
|
|
18
|
+
{{ item.index }}
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
<!-- #ifdef MP-DINGTALK -->
|
|
22
|
+
</view>
|
|
23
|
+
<!-- #endif -->
|
|
24
|
+
</view>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
import type { AnchorIndex } from './type'
|
|
29
|
+
import { indexBarInjectionKey, indexBarProps } from './type'
|
|
30
|
+
import { ref, getCurrentInstance, onMounted, reactive, nextTick, watch } from 'vue'
|
|
31
|
+
import { getRect, isDef, uuid, pause } from '../../common/util'
|
|
32
|
+
import { useChildren } from '../../composables/useChildren'
|
|
33
|
+
|
|
34
|
+
const props = defineProps(indexBarProps)
|
|
35
|
+
|
|
36
|
+
const indexBarId = ref<string>(`indexBar${uuid()}`)
|
|
37
|
+
|
|
38
|
+
const { proxy } = getCurrentInstance()!
|
|
39
|
+
|
|
40
|
+
const state = reactive({
|
|
41
|
+
activeIndex: null as AnchorIndex | null
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const { linkChildren, children } = useChildren(indexBarInjectionKey)
|
|
45
|
+
|
|
46
|
+
linkChildren({ props, anchorState: state })
|
|
47
|
+
|
|
48
|
+
watch(
|
|
49
|
+
() => children,
|
|
50
|
+
(newValue) => {
|
|
51
|
+
if (!newValue.length) {
|
|
52
|
+
state.activeIndex = null // 或者设置为一个默认值,如第一个子项的索引
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!isDef(state.activeIndex) || !newValue.find((item) => item.index === state.activeIndex)) {
|
|
57
|
+
state.activeIndex = newValue[0].index
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{ deep: true, immediate: true }
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
const scrollState = reactive({
|
|
64
|
+
scrollTop: 0, // 即将滚动到的位置
|
|
65
|
+
prevScrollTop: 0, // 上次记录的位置
|
|
66
|
+
// 滚动距离
|
|
67
|
+
touching: false
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
// 组件距离页面顶部的高度
|
|
71
|
+
let offsetTop = 0
|
|
72
|
+
let sidebarInfo = {
|
|
73
|
+
// 侧边栏距离顶部的高度
|
|
74
|
+
offsetTop: 0,
|
|
75
|
+
// 高度固定24px
|
|
76
|
+
indexHeight: 24
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function init() {
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
Promise.all([
|
|
82
|
+
getRect(`#${indexBarId.value}`, false, proxy),
|
|
83
|
+
getRect('.wd-index-bar__sidebar', false, proxy),
|
|
84
|
+
getRect('.wd-index-bar__index', false, proxy)
|
|
85
|
+
]).then(([bar, sidebar, index]) => {
|
|
86
|
+
offsetTop = bar.top!
|
|
87
|
+
sidebarInfo.offsetTop = sidebar.top!
|
|
88
|
+
sidebarInfo.indexHeight = index.height!
|
|
89
|
+
})
|
|
90
|
+
}, 100)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
onMounted(() => {
|
|
94
|
+
init()
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
function hanleScroll(scrollEvent: any) {
|
|
98
|
+
if (scrollState.touching) {
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
const { detail } = scrollEvent
|
|
102
|
+
const scrolltop = Math.floor(detail.scrollTop)
|
|
103
|
+
const anchor = children.find((item, index) => {
|
|
104
|
+
if (!isDef(children[index + 1])) return true
|
|
105
|
+
if (item.$.exposed!.top.value - offsetTop <= scrolltop && children[index + 1].$.exposed!.top.value - offsetTop > scrolltop) return true
|
|
106
|
+
return false
|
|
107
|
+
})
|
|
108
|
+
if (isDef(anchor) && state.activeIndex !== anchor.index) {
|
|
109
|
+
state.activeIndex = anchor.index
|
|
110
|
+
}
|
|
111
|
+
scrollState.prevScrollTop = scrolltop
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function getAnchorByPageY(pageY: number) {
|
|
115
|
+
const y = pageY - sidebarInfo.offsetTop
|
|
116
|
+
let idx = Math.floor(y / sidebarInfo.indexHeight)
|
|
117
|
+
if (idx < 0) idx = 0
|
|
118
|
+
else if (idx > children.length - 1) idx = children.length - 1
|
|
119
|
+
return children[idx]
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function handleTouchStart() {
|
|
123
|
+
scrollState.touching = true
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function handleTouchMove(e: TouchEvent) {
|
|
127
|
+
const clientY = e.touches[0].pageY
|
|
128
|
+
if (state.activeIndex === getAnchorByPageY(clientY).index) {
|
|
129
|
+
return
|
|
130
|
+
}
|
|
131
|
+
state.activeIndex = getAnchorByPageY(clientY).index
|
|
132
|
+
setScrollTop(getAnchorByPageY(clientY).$.exposed!.top.value - offsetTop)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async function handleTouchEnd(e: TouchEvent) {
|
|
136
|
+
const clientY = e.changedTouches[0].pageY
|
|
137
|
+
state.activeIndex = getAnchorByPageY(clientY).index
|
|
138
|
+
setScrollTop(getAnchorByPageY(clientY).$.exposed!.top.value - offsetTop)
|
|
139
|
+
await pause()
|
|
140
|
+
scrollState.touching = false
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function setScrollTop(top: number) {
|
|
144
|
+
if (scrollState.scrollTop === top) {
|
|
145
|
+
scrollState.scrollTop = scrollState.prevScrollTop
|
|
146
|
+
nextTick(() => {
|
|
147
|
+
scrollState.scrollTop = top
|
|
148
|
+
})
|
|
149
|
+
} else {
|
|
150
|
+
scrollState.scrollTop = top
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
</script>
|
|
154
|
+
|
|
155
|
+
<style lang="scss">
|
|
156
|
+
@use './index.scss';
|
|
157
|
+
</style>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
@use '../../styles/mixin/mixin.scss'as *;
|
|
2
|
+
@use '../../styles/variable.scss'as *;
|
|
3
|
+
// 输入框内边距
|
|
4
|
+
$input-padding: var(--wot-input-padding, $padding-loose $padding-loose);
|
|
5
|
+
// 输入框背景色
|
|
6
|
+
$input-bg: var(--wot-input-bg, $filled-oppo);
|
|
7
|
+
// 输入框内高度
|
|
8
|
+
$input-inner-height: var(--wot-input-inner-height, $n-20);
|
|
9
|
+
// 输入框内字号
|
|
10
|
+
$input-inner-font-size: var(--wot-input-inner-font-size, $typography-body-size-main);
|
|
11
|
+
// 输入框文字颜色
|
|
12
|
+
$input-inner-color: var(--wot-input-inner-color, $text-main);
|
|
13
|
+
// 输入框占位符颜色
|
|
14
|
+
$input-inner-placeholder-color: var(--wot-input-inner-placeholder-color, $text-placeholder);
|
|
15
|
+
// 输入框禁用颜色
|
|
16
|
+
$input-disabled-color: var(--wot-input-disabled-color, $text-disabled);
|
|
17
|
+
// 输入框图标颜色
|
|
18
|
+
$input-icon-color: var(--wot-input-icon-color, $icon-secondary);
|
|
19
|
+
// 输入框图标字号
|
|
20
|
+
$input-icon-font-size: var(--wot-input-icon-font-size, $n-18);
|
|
21
|
+
// 输入框图标间距
|
|
22
|
+
$input-icon-margin: var(--wot-input-icon-margin, $spacing-tight);
|
|
23
|
+
// 输入框字数统计间距
|
|
24
|
+
$input-count-margin: var(--wot-input-count-margin, $spacing-extra-loose);
|
|
25
|
+
// 输入框字数统计颜色
|
|
26
|
+
$input-count-color: var(--wot-input-count-color, $text-auxiliary);
|
|
27
|
+
// 输入框字数统计字号
|
|
28
|
+
$input-count-font-size: var(--wot-input-count-font-size, $typography-body-size-main);
|
|
29
|
+
// 输入框字数统计行高
|
|
30
|
+
$input-count-line-height: var(--wot-input-count-line-height, $typography-body-line--height-size-main);
|
|
31
|
+
// 输入框错误颜色
|
|
32
|
+
$input-error-color: var(--wot-input-error-color, $danger-main);
|
|
33
|
+
|
|
34
|
+
@include b(input) {
|
|
35
|
+
position: relative;
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
align-items: center;
|
|
39
|
+
padding: $input-padding;
|
|
40
|
+
-webkit-tap-highlight-color: transparent;
|
|
41
|
+
text-align: left;
|
|
42
|
+
background: $input-bg;
|
|
43
|
+
|
|
44
|
+
@include e(prefix) {
|
|
45
|
+
margin-right: $input-icon-margin;
|
|
46
|
+
font-size: $input-icon-font-size;
|
|
47
|
+
line-height: initial;
|
|
48
|
+
flex-shrink: 0;
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@include edeep(icon, clear) {
|
|
54
|
+
font-size: $input-icon-font-size;
|
|
55
|
+
line-height: $input-icon-font-size;
|
|
56
|
+
color: $input-icon-color;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@include e(suffix) {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
flex-shrink: 0;
|
|
63
|
+
line-height: initial;
|
|
64
|
+
|
|
65
|
+
:deep(.wd-input__icon),
|
|
66
|
+
:deep(.wd-input__clear) {
|
|
67
|
+
margin-left: $input-icon-margin;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@include when(disabled) {
|
|
72
|
+
.wd-input__inner,
|
|
73
|
+
.wd-input__placeholder {
|
|
74
|
+
color: $input-disabled-color;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@include when(error) {
|
|
79
|
+
.wd-input__inner {
|
|
80
|
+
color: $input-error-color;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@include e(inner) {
|
|
85
|
+
flex: 1;
|
|
86
|
+
height: $input-inner-height;
|
|
87
|
+
font-size: $input-inner-font-size;
|
|
88
|
+
color: $input-inner-color;
|
|
89
|
+
outline: none;
|
|
90
|
+
border: none;
|
|
91
|
+
background: none;
|
|
92
|
+
padding: 0;
|
|
93
|
+
box-sizing: border-box;
|
|
94
|
+
min-height: $input-inner-height;
|
|
95
|
+
|
|
96
|
+
&::-webkit-input-placeholder {
|
|
97
|
+
color: $input-inner-placeholder-color;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@include when(align-right) {
|
|
101
|
+
text-align: right;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@include e(placeholder) {
|
|
106
|
+
color: $input-inner-placeholder-color;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@include e(readonly-mask) {
|
|
110
|
+
position: absolute;
|
|
111
|
+
top: 0;
|
|
112
|
+
left: 0;
|
|
113
|
+
z-index: 2;
|
|
114
|
+
width: 100%;
|
|
115
|
+
height: 100%;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@include e(count) {
|
|
119
|
+
margin-left: $input-count-margin;
|
|
120
|
+
font-size: $input-count-font-size;
|
|
121
|
+
line-height: $input-count-line-height;
|
|
122
|
+
color: $input-count-color;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
@include when(compact) {
|
|
126
|
+
padding: 0;
|
|
127
|
+
background: transparent;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import type { ExtractPropTypes } from 'vue'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeNumberProp, makeNumericProp, makeStringProp } from '../../common/props'
|
|
3
|
+
|
|
4
|
+
export type InputClearTrigger = 'focus' | 'always'
|
|
5
|
+
|
|
6
|
+
export type InputType = 'text' | 'number' | 'digit' | 'idcard' | 'safe-password' | 'nickname' | 'tel'
|
|
7
|
+
|
|
8
|
+
export type InputConfirmType = 'send' | 'search' | 'next' | 'go' | 'done'
|
|
9
|
+
|
|
10
|
+
export type InputMode = 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'
|
|
11
|
+
|
|
12
|
+
export const inputProps = {
|
|
13
|
+
...baseProps,
|
|
14
|
+
/**
|
|
15
|
+
* 自定义输入框类名
|
|
16
|
+
*/
|
|
17
|
+
customInputClass: makeStringProp(''),
|
|
18
|
+
// 原生属性
|
|
19
|
+
/**
|
|
20
|
+
* 占位文本
|
|
21
|
+
*/
|
|
22
|
+
placeholder: String,
|
|
23
|
+
/**
|
|
24
|
+
* 原生属性,指定 placeholder 的样式,目前仅支持color,font-size和font-weight
|
|
25
|
+
*/
|
|
26
|
+
placeholderStyle: String,
|
|
27
|
+
/**
|
|
28
|
+
* 原生属性,指定 placeholder 的样式类
|
|
29
|
+
*/
|
|
30
|
+
placeholderClass: makeStringProp(''),
|
|
31
|
+
/**
|
|
32
|
+
* 原生属性,指定光标与键盘的距离。取 input 距离底部的距离和cursor-spacing指定的距离的最小值作为光标与键盘的距离
|
|
33
|
+
*/
|
|
34
|
+
cursorSpacing: makeNumberProp(0),
|
|
35
|
+
/**
|
|
36
|
+
* 原生属性,指定focus时的光标位置
|
|
37
|
+
*/
|
|
38
|
+
cursor: makeNumberProp(-1),
|
|
39
|
+
/**
|
|
40
|
+
* 原生属性,光标起始位置,自动聚集时有效,需与selection-end搭配使用
|
|
41
|
+
*/
|
|
42
|
+
selectionStart: makeNumberProp(-1),
|
|
43
|
+
/**
|
|
44
|
+
* 原生属性,光标结束位置,自动聚集时有效,需与selection-start搭配使用
|
|
45
|
+
*/
|
|
46
|
+
selectionEnd: makeNumberProp(-1),
|
|
47
|
+
/**
|
|
48
|
+
* 原生属性,键盘弹起时,是否自动上推页面
|
|
49
|
+
*/
|
|
50
|
+
adjustPosition: makeBooleanProp(true),
|
|
51
|
+
/**
|
|
52
|
+
* focus时,点击页面的时候不收起键盘
|
|
53
|
+
*/
|
|
54
|
+
holdKeyboard: makeBooleanProp(false),
|
|
55
|
+
/**
|
|
56
|
+
* 设置键盘右下角按钮的文字,仅在type='text'时生效,可选值:done / go / next / search / send
|
|
57
|
+
*/
|
|
58
|
+
confirmType: makeStringProp<InputConfirmType>('done'),
|
|
59
|
+
/**
|
|
60
|
+
* 点击键盘右下角按钮时是否保持键盘不收起
|
|
61
|
+
*/
|
|
62
|
+
confirmHold: makeBooleanProp(false),
|
|
63
|
+
/**
|
|
64
|
+
* 原生属性,获取焦点
|
|
65
|
+
*/
|
|
66
|
+
focus: makeBooleanProp(false),
|
|
67
|
+
/**
|
|
68
|
+
* 类型,可选值:text / number / digit / idcard / safe-password / nickname / tel
|
|
69
|
+
*/
|
|
70
|
+
type: makeStringProp<InputType>('text'),
|
|
71
|
+
/**
|
|
72
|
+
* 原生属性,最大长度
|
|
73
|
+
*/
|
|
74
|
+
maxlength: {
|
|
75
|
+
type: Number,
|
|
76
|
+
// #ifndef MP-ALIPAY
|
|
77
|
+
default: -1
|
|
78
|
+
// #endif
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* 原生属性,禁用
|
|
82
|
+
*/
|
|
83
|
+
disabled: makeBooleanProp(false),
|
|
84
|
+
/**
|
|
85
|
+
* 微信小程序原生属性,强制 input 处于同层状态,默认 focus 时 input 会切到非同层状态 (仅在 iOS 下生效)
|
|
86
|
+
*/
|
|
87
|
+
alwaysEmbed: makeBooleanProp(false),
|
|
88
|
+
// 原生属性结束
|
|
89
|
+
/**
|
|
90
|
+
* 输入框的值靠右展示
|
|
91
|
+
*/
|
|
92
|
+
alignRight: makeBooleanProp(false),
|
|
93
|
+
/**
|
|
94
|
+
* 绑定值
|
|
95
|
+
*/
|
|
96
|
+
modelValue: makeNumericProp(''),
|
|
97
|
+
/**
|
|
98
|
+
* 显示为密码框
|
|
99
|
+
*/
|
|
100
|
+
showPassword: makeBooleanProp(false),
|
|
101
|
+
/**
|
|
102
|
+
* 显示清空按钮
|
|
103
|
+
*/
|
|
104
|
+
clearable: makeBooleanProp(false),
|
|
105
|
+
/**
|
|
106
|
+
* 只读
|
|
107
|
+
*/
|
|
108
|
+
readonly: makeBooleanProp(false),
|
|
109
|
+
/**
|
|
110
|
+
* 前置图标,icon组件中的图标类名
|
|
111
|
+
*/
|
|
112
|
+
prefixIcon: String,
|
|
113
|
+
/**
|
|
114
|
+
* 后置图标,icon组件中的图标类名
|
|
115
|
+
*/
|
|
116
|
+
suffixIcon: String,
|
|
117
|
+
/**
|
|
118
|
+
* 显示字数限制,需要同时设置 maxlength
|
|
119
|
+
*/
|
|
120
|
+
showWordLimit: makeBooleanProp(false),
|
|
121
|
+
/**
|
|
122
|
+
* 设置输入框错误状态,错误状态时为红色
|
|
123
|
+
*/
|
|
124
|
+
error: makeBooleanProp(false),
|
|
125
|
+
/**
|
|
126
|
+
* 显示清除图标的时机,always 表示输入框不为空时展示,focus 表示输入框聚焦且不为空时展示
|
|
127
|
+
* 类型: "focus" | "always"
|
|
128
|
+
* 默认值: "always"
|
|
129
|
+
*/
|
|
130
|
+
clearTrigger: makeStringProp<InputClearTrigger>('always'),
|
|
131
|
+
/**
|
|
132
|
+
* 是否在点击清除按钮时聚焦输入框
|
|
133
|
+
* 类型: boolean
|
|
134
|
+
* 默认值: true
|
|
135
|
+
*/
|
|
136
|
+
focusWhenClear: makeBooleanProp(true),
|
|
137
|
+
/**
|
|
138
|
+
* 是否忽略组件内对文本合成系统事件的处理。为 false 时将触发 compositionstart、compositionend、compositionupdate 事件,且在文本合成期间会触发 input 事件
|
|
139
|
+
* 类型: boolean
|
|
140
|
+
* 默认值: true
|
|
141
|
+
*/
|
|
142
|
+
ignoreCompositionEvent: makeBooleanProp(true),
|
|
143
|
+
/**
|
|
144
|
+
* 它提供了用户在编辑元素或其内容时可能输入的数据类型的提示。在符合条件的高版本webview里,uni-app的web和app-vue平台中可使用本属性。
|
|
145
|
+
* 类型: InputMode
|
|
146
|
+
* 可选值: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | "password"
|
|
147
|
+
* 默认值: "text"
|
|
148
|
+
*/
|
|
149
|
+
inputmode: makeStringProp<InputMode>('text'),
|
|
150
|
+
/**
|
|
151
|
+
* 支付宝小程序,可以在 input / textarea 组件中加上 enableNative="{{false}}",避免 textarea 弹出键盘后出现内容上移
|
|
152
|
+
* 仅支付宝小程序支持
|
|
153
|
+
* 类型: boolean
|
|
154
|
+
* 默认值: true
|
|
155
|
+
*/
|
|
156
|
+
enableNative: makeBooleanProp(true),
|
|
157
|
+
/**
|
|
158
|
+
* 紧凑模式,移除内边距和背景色,在结合 cell 或 form-item 使用时建议开启
|
|
159
|
+
* 类型: boolean
|
|
160
|
+
* 默认值: -
|
|
161
|
+
*/
|
|
162
|
+
compact: makeBooleanProp(void 0)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export type InputProps = ExtractPropTypes<typeof inputProps>
|