@tplc/wot 0.0.1
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/components/common/AbortablePromise.ts +36 -0
- package/components/common/abstracts/_config.scss +7 -0
- package/components/common/abstracts/_function.scss +76 -0
- package/components/common/abstracts/_mixin.scss +339 -0
- package/components/common/abstracts/variable.scss +1346 -0
- package/components/common/base64.ts +30 -0
- package/components/common/canvasHelper.ts +49 -0
- package/components/common/clickoutside.ts +34 -0
- package/components/common/dayjs.ts +157 -0
- package/components/common/event.ts +8 -0
- package/components/common/props.ts +51 -0
- package/components/common/util.ts +751 -0
- package/components/composables/useCell.ts +13 -0
- package/components/composables/useChildren.ts +122 -0
- package/components/composables/useCountDown.ts +138 -0
- package/components/composables/useLockScroll.ts +39 -0
- package/components/composables/useParent.ts +41 -0
- package/components/composables/usePopover.ts +193 -0
- package/components/composables/useQueue.ts +52 -0
- package/components/composables/useRaf.ts +37 -0
- package/components/composables/useTouch.ts +44 -0
- package/components/composables/useTranslate.ts +22 -0
- package/components/wd-action-sheet/index.scss +204 -0
- package/components/wd-action-sheet/types.ts +128 -0
- package/components/wd-action-sheet/wd-action-sheet.vue +174 -0
- package/components/wd-backtop/index.scss +25 -0
- package/components/wd-backtop/types.ts +37 -0
- package/components/wd-backtop/wd-backtop.vue +48 -0
- package/components/wd-badge/index.scss +59 -0
- package/components/wd-badge/types.ts +53 -0
- package/components/wd-badge/wd-badge.vue +69 -0
- package/components/wd-button/index.scss +340 -0
- package/components/wd-button/types.ts +112 -0
- package/components/wd-button/wd-button.vue +176 -0
- package/components/wd-calendar/index.scss +244 -0
- package/components/wd-calendar/types.ts +235 -0
- package/components/wd-calendar/wd-calendar.vue +456 -0
- package/components/wd-calendar-view/index.scss +9 -0
- package/components/wd-calendar-view/month/index.scss +151 -0
- package/components/wd-calendar-view/month/month.vue +391 -0
- package/components/wd-calendar-view/month/types.ts +19 -0
- package/components/wd-calendar-view/monthPanel/index.scss +89 -0
- package/components/wd-calendar-view/monthPanel/month-panel.vue +388 -0
- package/components/wd-calendar-view/monthPanel/types.ts +48 -0
- package/components/wd-calendar-view/types.ts +134 -0
- package/components/wd-calendar-view/utils.ts +451 -0
- package/components/wd-calendar-view/wd-calendar-view.vue +111 -0
- package/components/wd-calendar-view/year/index.scss +148 -0
- package/components/wd-calendar-view/year/types.ts +19 -0
- package/components/wd-calendar-view/year/year.vue +220 -0
- package/components/wd-calendar-view/yearPanel/index.scss +24 -0
- package/components/wd-calendar-view/yearPanel/types.ts +38 -0
- package/components/wd-calendar-view/yearPanel/year-panel.vue +140 -0
- package/components/wd-card/index.scss +70 -0
- package/components/wd-card/types.ts +30 -0
- package/components/wd-card/wd-card.vue +40 -0
- package/components/wd-cell/index.scss +189 -0
- package/components/wd-cell/types.ts +96 -0
- package/components/wd-cell/wd-cell.vue +135 -0
- package/components/wd-cell-group/index.scss +55 -0
- package/components/wd-cell-group/types.ts +41 -0
- package/components/wd-cell-group/wd-cell-group.vue +45 -0
- package/components/wd-checkbox/index.scss +285 -0
- package/components/wd-checkbox/types.ts +68 -0
- package/components/wd-checkbox/wd-checkbox.vue +185 -0
- package/components/wd-checkbox-group/index.scss +20 -0
- package/components/wd-checkbox-group/types.ts +59 -0
- package/components/wd-checkbox-group/wd-checkbox-group.vue +103 -0
- package/components/wd-circle/index.scss +18 -0
- package/components/wd-circle/types.ts +54 -0
- package/components/wd-circle/wd-circle.vue +318 -0
- package/components/wd-col/index.scss +19 -0
- package/components/wd-col/types.ts +15 -0
- package/components/wd-col/wd-col.vue +91 -0
- package/components/wd-col-picker/index.scss +241 -0
- package/components/wd-col-picker/types.ts +170 -0
- package/components/wd-col-picker/wd-col-picker.vue +550 -0
- package/components/wd-collapse/index.scss +55 -0
- package/components/wd-collapse/types.ts +63 -0
- package/components/wd-collapse/wd-collapse.vue +160 -0
- package/components/wd-collapse-item/index.scss +79 -0
- package/components/wd-collapse-item/types.ts +36 -0
- package/components/wd-collapse-item/wd-collapse-item.vue +182 -0
- package/components/wd-config-provider/types.ts +1023 -0
- package/components/wd-config-provider/wd-config-provider.vue +82 -0
- package/components/wd-count-down/index.scss +14 -0
- package/components/wd-count-down/types.ts +41 -0
- package/components/wd-count-down/utils.ts +52 -0
- package/components/wd-count-down/wd-count-down.vue +60 -0
- package/components/wd-count-to/index.scss +6 -0
- package/components/wd-count-to/types.ts +110 -0
- package/components/wd-count-to/wd-count-to.vue +134 -0
- package/components/wd-curtain/index.scss +80 -0
- package/components/wd-curtain/types.ts +45 -0
- package/components/wd-curtain/wd-curtain.vue +174 -0
- package/components/wd-datetime-picker/index.scss +243 -0
- package/components/wd-datetime-picker/types.ts +225 -0
- package/components/wd-datetime-picker/wd-datetime-picker.vue +827 -0
- package/components/wd-datetime-picker-view/index.scss +0 -0
- package/components/wd-datetime-picker-view/types.ts +137 -0
- package/components/wd-datetime-picker-view/wd-datetime-picker-view.vue +514 -0
- package/components/wd-divider/index.scss +32 -0
- package/components/wd-divider/types.ts +12 -0
- package/components/wd-divider/wd-divider.vue +29 -0
- package/components/wd-drop-menu/index.scss +89 -0
- package/components/wd-drop-menu/types.ts +38 -0
- package/components/wd-drop-menu/wd-drop-menu.vue +128 -0
- package/components/wd-drop-menu-item/index.scss +66 -0
- package/components/wd-drop-menu-item/types.ts +78 -0
- package/components/wd-drop-menu-item/wd-drop-menu-item.vue +230 -0
- package/components/wd-fab/index.scss +115 -0
- package/components/wd-fab/types.ts +61 -0
- package/components/wd-fab/wd-fab.vue +257 -0
- package/components/wd-form/index.scss +10 -0
- package/components/wd-form/types.ts +93 -0
- package/components/wd-form/wd-form.vue +185 -0
- package/components/wd-form-item/index.scss +17 -0
- package/components/wd-form-item/types.ts +22 -0
- package/components/wd-form-item/wd-form-item.vue +65 -0
- package/components/wd-gap/index.scss +9 -0
- package/components/wd-gap/types.ts +23 -0
- package/components/wd-gap/wd-gap.vue +39 -0
- package/components/wd-grid/index.scss +9 -0
- package/components/wd-grid/types.ts +54 -0
- package/components/wd-grid/wd-grid.vue +107 -0
- package/components/wd-grid-item/index.scss +137 -0
- package/components/wd-grid-item/types.ts +74 -0
- package/components/wd-grid-item/wd-grid-item.vue +181 -0
- package/components/wd-icon/index.scss +1222 -0
- package/components/wd-icon/types.ts +21 -0
- package/components/wd-icon/wd-icon.vue +53 -0
- package/components/wd-icon/wd-icons.ttf +0 -0
- package/components/wd-img/index.scss +19 -0
- package/components/wd-img/types.ts +53 -0
- package/components/wd-img/wd-img.vue +76 -0
- package/components/wd-img-cropper/index.scss +227 -0
- package/components/wd-img-cropper/types.ts +87 -0
- package/components/wd-img-cropper/wd-img-cropper.vue +659 -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 +57 -0
- package/components/wd-index-bar/index.scss +39 -0
- package/components/wd-index-bar/type.ts +28 -0
- package/components/wd-index-bar/wd-index-bar.vue +158 -0
- package/components/wd-input/index.scss +326 -0
- package/components/wd-input/types.ts +182 -0
- package/components/wd-input/wd-input.vue +327 -0
- package/components/wd-input-number/index.scss +132 -0
- package/components/wd-input-number/types.ts +78 -0
- package/components/wd-input-number/wd-input-number.vue +221 -0
- package/components/wd-loading/index.scss +34 -0
- package/components/wd-loading/types.ts +31 -0
- package/components/wd-loading/wd-loading.vue +90 -0
- package/components/wd-loadmore/index.scss +39 -0
- package/components/wd-loadmore/types.ts +24 -0
- package/components/wd-loadmore/wd-loadmore.vue +53 -0
- package/components/wd-message-box/index.scss +121 -0
- package/components/wd-message-box/index.ts +95 -0
- package/components/wd-message-box/types.ts +116 -0
- package/components/wd-message-box/wd-message-box.vue +326 -0
- package/components/wd-navbar/index.scss +103 -0
- package/components/wd-navbar/types.ts +52 -0
- package/components/wd-navbar/wd-navbar.vue +142 -0
- package/components/wd-navbar-capsule/index.scss +65 -0
- package/components/wd-navbar-capsule/types.ts +0 -0
- package/components/wd-navbar-capsule/wd-navbar-capsule.vue +31 -0
- package/components/wd-notice-bar/index.scss +86 -0
- package/components/wd-notice-bar/types.ts +56 -0
- package/components/wd-notice-bar/wd-notice-bar.vue +223 -0
- package/components/wd-notify/index.scss +34 -0
- package/components/wd-notify/index.ts +59 -0
- package/components/wd-notify/types.ts +62 -0
- package/components/wd-notify/wd-notify.vue +83 -0
- package/components/wd-number-keyboard/index.scss +78 -0
- package/components/wd-number-keyboard/key/index.scss +79 -0
- package/components/wd-number-keyboard/key/index.vue +76 -0
- package/components/wd-number-keyboard/key/types.ts +11 -0
- package/components/wd-number-keyboard/types.ts +79 -0
- package/components/wd-number-keyboard/wd-number-keyboard.vue +173 -0
- package/components/wd-overlay/index.scss +17 -0
- package/components/wd-overlay/types.ts +25 -0
- package/components/wd-overlay/wd-overlay.vue +46 -0
- package/components/wd-pagination/index.scss +57 -0
- package/components/wd-pagination/types.ts +41 -0
- package/components/wd-pagination/wd-pagination.vue +121 -0
- package/components/wd-password-input/index.scss +123 -0
- package/components/wd-password-input/types.ts +48 -0
- package/components/wd-password-input/wd-password-input.vue +58 -0
- package/components/wd-picker/index.scss +216 -0
- package/components/wd-picker/types.ts +186 -0
- package/components/wd-picker/wd-picker.vue +409 -0
- package/components/wd-picker-view/index.scss +91 -0
- package/components/wd-picker-view/types.ts +162 -0
- package/components/wd-picker-view/wd-picker-view.vue +361 -0
- package/components/wd-popover/index.scss +123 -0
- package/components/wd-popover/types.ts +69 -0
- package/components/wd-popover/wd-popover.vue +216 -0
- package/components/wd-popup/index.scss +112 -0
- package/components/wd-popup/types.ts +68 -0
- package/components/wd-popup/wd-popup.vue +227 -0
- package/components/wd-progress/index.scss +62 -0
- package/components/wd-progress/types.ts +40 -0
- package/components/wd-progress/wd-progress.vue +201 -0
- package/components/wd-radio/index.scss +300 -0
- package/components/wd-radio/types.ts +42 -0
- package/components/wd-radio/wd-radio.vue +136 -0
- package/components/wd-radio-group/index.scss +23 -0
- package/components/wd-radio-group/types.ts +36 -0
- package/components/wd-radio-group/wd-radio-group.vue +54 -0
- package/components/wd-rate/index.scss +24 -0
- package/components/wd-rate/types.ts +91 -0
- package/components/wd-rate/wd-rate.vue +131 -0
- package/components/wd-resize/index.scss +26 -0
- package/components/wd-resize/types.ts +6 -0
- package/components/wd-resize/wd-resize.vue +155 -0
- package/components/wd-row/index.scss +10 -0
- package/components/wd-row/types.ts +16 -0
- package/components/wd-row/wd-row.vue +63 -0
- package/components/wd-search/index.scss +148 -0
- package/components/wd-search/types.ts +83 -0
- package/components/wd-search/wd-search.vue +237 -0
- package/components/wd-segmented/index.scss +97 -0
- package/components/wd-segmented/types.ts +68 -0
- package/components/wd-segmented/wd-segmented.vue +143 -0
- package/components/wd-select-picker/index.scss +177 -0
- package/components/wd-select-picker/types.ts +116 -0
- package/components/wd-select-picker/wd-select-picker.vue +486 -0
- package/components/wd-sidebar/index.scss +25 -0
- package/components/wd-sidebar/types.ts +28 -0
- package/components/wd-sidebar/wd-sidebar.vue +41 -0
- package/components/wd-sidebar-item/index.scss +93 -0
- package/components/wd-sidebar-item/types.ts +31 -0
- package/components/wd-sidebar-item/wd-sidebar-item.vue +114 -0
- package/components/wd-skeleton/index.scss +101 -0
- package/components/wd-skeleton/index.ts +1 -0
- package/components/wd-skeleton/types.ts +69 -0
- package/components/wd-skeleton/wd-skeleton.vue +135 -0
- package/components/wd-slider/index.scss +91 -0
- package/components/wd-slider/types.ts +104 -0
- package/components/wd-slider/wd-slider.vue +377 -0
- package/components/wd-sort-button/index.scss +86 -0
- package/components/wd-sort-button/types.ts +43 -0
- package/components/wd-sort-button/wd-sort-button.vue +76 -0
- package/components/wd-status-tip/index.scss +37 -0
- package/components/wd-status-tip/types.ts +59 -0
- package/components/wd-status-tip/wd-status-tip.vue +94 -0
- package/components/wd-step/index.scss +236 -0
- package/components/wd-step/types.ts +33 -0
- package/components/wd-step/wd-step.vue +151 -0
- package/components/wd-steps/index.scss +10 -0
- package/components/wd-steps/types.ts +59 -0
- package/components/wd-steps/wd-steps.vue +37 -0
- package/components/wd-sticky/index.scss +9 -0
- package/components/wd-sticky/types.ts +13 -0
- package/components/wd-sticky/wd-sticky.vue +190 -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 +154 -0
- package/components/wd-swipe-action/index.scss +22 -0
- package/components/wd-swipe-action/types.ts +43 -0
- package/components/wd-swipe-action/wd-swipe-action.vue +307 -0
- package/components/wd-swiper/index.scss +23 -0
- package/components/wd-swiper/types.ts +189 -0
- package/components/wd-swiper/wd-swiper.vue +202 -0
- package/components/wd-swiper-nav/index.scss +153 -0
- package/components/wd-swiper-nav/types.ts +42 -0
- package/components/wd-swiper-nav/wd-swiper-nav.vue +37 -0
- package/components/wd-switch/index.scss +58 -0
- package/components/wd-switch/types.ts +56 -0
- package/components/wd-switch/wd-switch.vue +83 -0
- package/components/wd-tab/index.scss +8 -0
- package/components/wd-tab/types.ts +20 -0
- package/components/wd-tab/wd-tab.vue +100 -0
- package/components/wd-tabbar/index.scss +57 -0
- package/components/wd-tabbar/types.ts +88 -0
- package/components/wd-tabbar/wd-tabbar.vue +104 -0
- package/components/wd-tabbar-item/index.scss +52 -0
- package/components/wd-tabbar-item/types.ts +51 -0
- package/components/wd-tabbar-item/wd-tabbar-item.vue +101 -0
- package/components/wd-table/index.scss +132 -0
- package/components/wd-table/types.ts +69 -0
- package/components/wd-table/wd-table.vue +255 -0
- package/components/wd-table-col/index.scss +44 -0
- package/components/wd-table-col/types.ts +54 -0
- package/components/wd-table-col/wd-table-col.vue +149 -0
- package/components/wd-tabs/index.scss +280 -0
- package/components/wd-tabs/types.ts +71 -0
- package/components/wd-tabs/wd-tabs.vue +528 -0
- package/components/wd-tag/index.scss +115 -0
- package/components/wd-tag/types.ts +81 -0
- package/components/wd-tag/wd-tag.vue +154 -0
- package/components/wd-text/index.scss +34 -0
- package/components/wd-text/types.ts +98 -0
- package/components/wd-text/wd-text.vue +138 -0
- package/components/wd-textarea/index.scss +343 -0
- package/components/wd-textarea/types.ts +298 -0
- package/components/wd-textarea/wd-textarea.vue +303 -0
- package/components/wd-toast/index.scss +66 -0
- package/components/wd-toast/index.ts +109 -0
- package/components/wd-toast/types.ts +76 -0
- package/components/wd-toast/wd-toast.vue +212 -0
- package/components/wd-tooltip/index.scss +61 -0
- package/components/wd-tooltip/types.ts +102 -0
- package/components/wd-tooltip/wd-tooltip.vue +167 -0
- package/components/wd-transition/index.scss +91 -0
- package/components/wd-transition/types.ts +89 -0
- package/components/wd-transition/wd-transition.vue +221 -0
- package/components/wd-upload/index.scss +173 -0
- package/components/wd-upload/types.ts +378 -0
- package/components/wd-upload/utils.ts +152 -0
- package/components/wd-upload/wd-upload.vue +737 -0
- package/components/wd-video-preview/index.scss +34 -0
- package/components/wd-video-preview/types.ts +32 -0
- package/components/wd-video-preview/wd-video-preview.vue +76 -0
- package/components/wd-watermark/index.scss +18 -0
- package/components/wd-watermark/types.ts +82 -0
- package/components/wd-watermark/wd-watermark.vue +592 -0
- package/components/wot-design-uni/wot-design-uni.vue +14 -0
- package/global.d.ts +108 -0
- package/index.ts +30 -0
- package/locale/index.ts +41 -0
- package/locale/lang/en-US.ts +128 -0
- package/locale/lang/th-TH.ts +127 -0
- package/locale/lang/vi-VN.ts +89 -0
- package/locale/lang/zh-CN.ts +127 -0
- package/locale/lang/zh-HK.ts +84 -0
- package/locale/lang/zh-TW.ts +84 -0
- package/package.json +20 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="rootClass" :style="customStyle" :id="sliderId">
|
|
3
|
+
<!-- #ifdef MP-DINGTALK -->
|
|
4
|
+
<view :id="sliderId" style="flex: 1" :class="rootClass">
|
|
5
|
+
<!-- #endif -->
|
|
6
|
+
<view :class="`wd-slider__label-min ${customMinClass}`" v-if="!hideMinMax">
|
|
7
|
+
{{ minValue }}
|
|
8
|
+
</view>
|
|
9
|
+
<view class="wd-slider__bar-wrapper" :style="barWrapperStyle">
|
|
10
|
+
<view class="wd-slider__bar" :style="barCustomStyle"></view>
|
|
11
|
+
<!-- 左边 -->
|
|
12
|
+
<view
|
|
13
|
+
class="wd-slider__button-wrapper"
|
|
14
|
+
:style="buttonLeftStyle"
|
|
15
|
+
@touchstart="onTouchStart"
|
|
16
|
+
@touchmove="onTouchMove"
|
|
17
|
+
@touchend="onTouchEnd"
|
|
18
|
+
@touchcancel="onTouchEnd"
|
|
19
|
+
>
|
|
20
|
+
<view class="wd-slider__label" v-if="!hideLabel">{{ leftNewValue }}</view>
|
|
21
|
+
<view class="wd-slider__button" />
|
|
22
|
+
</view>
|
|
23
|
+
<!-- 右边 -->
|
|
24
|
+
<view
|
|
25
|
+
v-if="showRight"
|
|
26
|
+
class="wd-slider__button-wrapper"
|
|
27
|
+
:style="buttonRightStyle"
|
|
28
|
+
@touchstart="onTouchStartRight"
|
|
29
|
+
@touchmove="onTouchMoveRight"
|
|
30
|
+
@touchend="onTouchEndRight"
|
|
31
|
+
@touchcancel="onTouchEndRight"
|
|
32
|
+
>
|
|
33
|
+
<view class="wd-slider__label" v-if="!hideLabel">{{ rightNewValue }}</view>
|
|
34
|
+
<view class="wd-slider__button" />
|
|
35
|
+
</view>
|
|
36
|
+
</view>
|
|
37
|
+
<view :class="`wd-slider__label-max ${customMaxClass}`" v-if="!hideMinMax">
|
|
38
|
+
{{ maxValue }}
|
|
39
|
+
</view>
|
|
40
|
+
<!-- #ifdef MP-DINGTALK -->
|
|
41
|
+
</view>
|
|
42
|
+
<!-- #endif -->
|
|
43
|
+
</view>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script lang="ts">
|
|
47
|
+
export default {
|
|
48
|
+
name: 'wd-slider',
|
|
49
|
+
options: {
|
|
50
|
+
addGlobalClass: true,
|
|
51
|
+
virtualHost: true,
|
|
52
|
+
styleIsolation: 'shared',
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<script lang="ts" setup>
|
|
58
|
+
import { computed, getCurrentInstance, onMounted, ref, watch } from 'vue'
|
|
59
|
+
import { getRect, isArray, isDef, isNumber, uuid } from '../common/util'
|
|
60
|
+
import { useTouch } from '../composables/useTouch'
|
|
61
|
+
import { sliderProps, type SliderExpose } from './types'
|
|
62
|
+
|
|
63
|
+
const props = defineProps(sliderProps)
|
|
64
|
+
const emit = defineEmits(['dragstart', 'dragmove', 'dragend', 'update:modelValue'])
|
|
65
|
+
|
|
66
|
+
// 存放右滑轮中的所有属性
|
|
67
|
+
const rightSlider = {
|
|
68
|
+
startValue: 0,
|
|
69
|
+
deltaX: 0,
|
|
70
|
+
newValue: 0,
|
|
71
|
+
}
|
|
72
|
+
const sliderId = ref<string>(`sliderId${uuid()}`)
|
|
73
|
+
|
|
74
|
+
const touchLeft = useTouch()
|
|
75
|
+
const touchRight = useTouch()
|
|
76
|
+
|
|
77
|
+
const showRight = ref<boolean>(false)
|
|
78
|
+
const barStyle = ref<string>('')
|
|
79
|
+
const leftNewValue = ref<number>(0)
|
|
80
|
+
const rightNewValue = ref<number>(0)
|
|
81
|
+
const rightBarPercent = ref<number>(0)
|
|
82
|
+
const leftBarPercent = ref<number>(0)
|
|
83
|
+
const trackWidth = ref<number>(0)
|
|
84
|
+
const trackLeft = ref<number>(0)
|
|
85
|
+
const startValue = ref<number>(0)
|
|
86
|
+
const currentValue = ref<number | number[]>(0)
|
|
87
|
+
const newValue = ref<number>(0)
|
|
88
|
+
|
|
89
|
+
const maxValue = ref<number>(100) // 最大值
|
|
90
|
+
const minValue = ref<number>(0) // 最小值
|
|
91
|
+
const stepValue = ref<number>(1) // 步长
|
|
92
|
+
|
|
93
|
+
watch(
|
|
94
|
+
() => props.max,
|
|
95
|
+
(newValue) => {
|
|
96
|
+
if (newValue <= props.min) {
|
|
97
|
+
maxValue.value = props.min // 交换最大值和最小值
|
|
98
|
+
minValue.value = newValue
|
|
99
|
+
console.warn('[wot design] warning(wd-slider): max value must be greater than min value')
|
|
100
|
+
} else {
|
|
101
|
+
maxValue.value = newValue // 更新最大值
|
|
102
|
+
}
|
|
103
|
+
calcBarPercent()
|
|
104
|
+
},
|
|
105
|
+
{ immediate: true },
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
watch(
|
|
109
|
+
() => props.min,
|
|
110
|
+
(newValue) => {
|
|
111
|
+
if (newValue >= props.max) {
|
|
112
|
+
minValue.value = props.max // 交换最小值和最大值
|
|
113
|
+
maxValue.value = newValue
|
|
114
|
+
console.warn('[wot design] warning(wd-slider): min value must be less than max value')
|
|
115
|
+
} else {
|
|
116
|
+
minValue.value = newValue // 更新最小值
|
|
117
|
+
}
|
|
118
|
+
calcBarPercent()
|
|
119
|
+
},
|
|
120
|
+
{ immediate: true },
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
watch(
|
|
124
|
+
() => props.step,
|
|
125
|
+
(newValue) => {
|
|
126
|
+
if (newValue < 1) {
|
|
127
|
+
stepValue.value = 1
|
|
128
|
+
console.warn('[wot design] warning(wd-slider): step must be greater than 0')
|
|
129
|
+
} else {
|
|
130
|
+
stepValue.value = Math.floor(newValue)
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{ immediate: true },
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
watch(
|
|
137
|
+
() => props.modelValue,
|
|
138
|
+
(newValue) => {
|
|
139
|
+
// 类型校验,支持所有值(除null、undefined。undefined建议统一写成void (0)防止全局undefined被覆盖)
|
|
140
|
+
if (newValue === null || newValue === undefined) {
|
|
141
|
+
emit('update:modelValue', currentValue.value)
|
|
142
|
+
console.warn('[wot design] warning(wd-slider): value can nott be null or undefined')
|
|
143
|
+
} else if (isArray(newValue) && newValue.length !== 2) {
|
|
144
|
+
console.warn('[wot design] warning(wd-slider): value must be dyadic array')
|
|
145
|
+
} else if (!isNumber(newValue) && !isArray(newValue)) {
|
|
146
|
+
emit('update:modelValue', currentValue.value)
|
|
147
|
+
console.warn('[wot design] warning(wd-slider): value must be dyadic array Or Number')
|
|
148
|
+
}
|
|
149
|
+
// 动态传值后修改
|
|
150
|
+
if (isArray(newValue)) {
|
|
151
|
+
if (currentValue.value && isArray(currentValue.value) && equal(newValue, currentValue.value))
|
|
152
|
+
return
|
|
153
|
+
currentValue.value = newValue
|
|
154
|
+
showRight.value = true
|
|
155
|
+
if (leftBarPercent.value <= rightBarPercent.value) {
|
|
156
|
+
leftBarSlider(newValue[0])
|
|
157
|
+
rightBarSlider(newValue[1])
|
|
158
|
+
} else {
|
|
159
|
+
leftBarSlider(newValue[1])
|
|
160
|
+
rightBarSlider(newValue[0])
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
if (newValue === currentValue.value) return
|
|
164
|
+
currentValue.value = newValue
|
|
165
|
+
leftBarSlider(newValue)
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{ deep: true, immediate: true },
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
const { proxy } = getCurrentInstance() as any
|
|
172
|
+
|
|
173
|
+
const rootClass = computed(() => {
|
|
174
|
+
const rootClass = `wd-slider ${!props.hideLabel ? 'wd-slider__has-label' : ''} ${props.disabled ? 'wd-slider--disabled' : ''} ${props.customClass}`
|
|
175
|
+
return rootClass
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
const barWrapperStyle = computed(() => {
|
|
179
|
+
const barWrapperStyle = `${props.inactiveColor ? 'background:' + props.inactiveColor : ''}`
|
|
180
|
+
return barWrapperStyle
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
const barCustomStyle = computed(() => {
|
|
184
|
+
const barWrapperStyle = `${barStyle.value};${props.activeColor ? 'background:' + props.activeColor : ''}`
|
|
185
|
+
return barWrapperStyle
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
const buttonLeftStyle = computed(() => {
|
|
189
|
+
const buttonLeftStyle = `left: ${leftBarPercent.value}%; visibility: ${!props.disabled ? 'show' : 'hidden'};`
|
|
190
|
+
return buttonLeftStyle
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
const buttonRightStyle = computed(() => {
|
|
194
|
+
const buttonRightStyle = `left: ${rightBarPercent.value}%; visibility: ${!props.disabled ? 'show' : 'hidden'}`
|
|
195
|
+
return buttonRightStyle
|
|
196
|
+
})
|
|
197
|
+
|
|
198
|
+
onMounted(() => {
|
|
199
|
+
initSlider()
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 初始化slider宽度
|
|
204
|
+
*/
|
|
205
|
+
function initSlider() {
|
|
206
|
+
getRect(`#${sliderId.value}`, false, proxy).then((data) => {
|
|
207
|
+
// trackWidth: 轨道全长
|
|
208
|
+
trackWidth.value = Number(data.width)
|
|
209
|
+
// trackLeft: 轨道距离左侧的距离
|
|
210
|
+
trackLeft.value = Number(data.left)
|
|
211
|
+
})
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function onTouchStart(event: any) {
|
|
215
|
+
const { disabled, modelValue } = props
|
|
216
|
+
if (disabled) return
|
|
217
|
+
touchLeft.touchStart(event)
|
|
218
|
+
startValue.value = !isArray(modelValue)
|
|
219
|
+
? format(modelValue)
|
|
220
|
+
: leftBarPercent.value < rightBarPercent.value
|
|
221
|
+
? format(modelValue[0])
|
|
222
|
+
: format(modelValue[1])
|
|
223
|
+
emit('dragstart', {
|
|
224
|
+
value: currentValue.value,
|
|
225
|
+
})
|
|
226
|
+
}
|
|
227
|
+
function onTouchMove(event: any) {
|
|
228
|
+
const { disabled } = props
|
|
229
|
+
if (disabled) return
|
|
230
|
+
touchLeft.touchMove(event)
|
|
231
|
+
// 移动间距 deltaX 就是向左(-)向右(+)
|
|
232
|
+
const diff = (touchLeft.deltaX.value / trackWidth.value) * (maxValue.value - minValue.value)
|
|
233
|
+
newValue.value = startValue.value + diff
|
|
234
|
+
|
|
235
|
+
// 左滑轮滑动控制
|
|
236
|
+
leftBarSlider(newValue.value)
|
|
237
|
+
emit('dragmove', {
|
|
238
|
+
value: currentValue.value,
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
function onTouchEnd() {
|
|
242
|
+
if (props.disabled) return
|
|
243
|
+
emit('dragend', {
|
|
244
|
+
value: currentValue.value,
|
|
245
|
+
})
|
|
246
|
+
}
|
|
247
|
+
// 右边滑轮滑动状态监听
|
|
248
|
+
function onTouchStartRight(event: any) {
|
|
249
|
+
if (props.disabled) return
|
|
250
|
+
const { modelValue } = props
|
|
251
|
+
// 右滑轮移动时数据绑定
|
|
252
|
+
touchRight.touchStart(event)
|
|
253
|
+
// 记录开始数据值
|
|
254
|
+
rightSlider.startValue =
|
|
255
|
+
leftBarPercent.value < rightBarPercent.value
|
|
256
|
+
? format((modelValue as number[])[1])
|
|
257
|
+
: format((modelValue as number[])[0])
|
|
258
|
+
emit('dragstart', {
|
|
259
|
+
value: currentValue.value,
|
|
260
|
+
})
|
|
261
|
+
}
|
|
262
|
+
function onTouchMoveRight(event: any) {
|
|
263
|
+
if (props.disabled) return
|
|
264
|
+
touchRight.touchMove(event)
|
|
265
|
+
// 移动间距 deltaX 就是向左向右
|
|
266
|
+
const diff = (touchRight.deltaX.value / trackWidth.value) * (maxValue.value - minValue.value)
|
|
267
|
+
rightSlider.newValue = format(rightSlider.startValue + diff)
|
|
268
|
+
// 右滑轮滑动控制
|
|
269
|
+
rightBarSlider(rightSlider.newValue)
|
|
270
|
+
emit('dragmove', {
|
|
271
|
+
value: currentValue.value,
|
|
272
|
+
})
|
|
273
|
+
}
|
|
274
|
+
function onTouchEndRight() {
|
|
275
|
+
if (props.disabled) return
|
|
276
|
+
emit('dragend', {
|
|
277
|
+
value: currentValue.value,
|
|
278
|
+
})
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* 控制右侧滑轮滑动, value校验
|
|
282
|
+
* @param {Number} value 当前滑轮绑定值
|
|
283
|
+
*/
|
|
284
|
+
function rightBarSlider(value: number) {
|
|
285
|
+
value = format(value)
|
|
286
|
+
rightNewValue.value = value
|
|
287
|
+
emit('update:modelValue', [
|
|
288
|
+
Math.min(leftNewValue.value, rightNewValue.value),
|
|
289
|
+
Math.max(leftNewValue.value, rightNewValue.value),
|
|
290
|
+
])
|
|
291
|
+
rightBarPercent.value = formatPercent(value)
|
|
292
|
+
styleControl()
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* 控制左滑轮滑动,更新渲染数据,对 value 进行校验取整
|
|
296
|
+
* @param {Number} value 当前滑轮绑定值
|
|
297
|
+
*/
|
|
298
|
+
function leftBarSlider(value: number) {
|
|
299
|
+
value = format(value)
|
|
300
|
+
|
|
301
|
+
// 把 value 转换成百分比
|
|
302
|
+
const percent = formatPercent(value)
|
|
303
|
+
if (!showRight.value) {
|
|
304
|
+
emit('update:modelValue', value)
|
|
305
|
+
leftNewValue.value = value
|
|
306
|
+
leftBarPercent.value = percent
|
|
307
|
+
barStyle.value = `width: ${percent}%; `
|
|
308
|
+
} else {
|
|
309
|
+
leftNewValue.value = value
|
|
310
|
+
leftBarPercent.value = percent
|
|
311
|
+
emit('update:modelValue', [
|
|
312
|
+
Math.min(leftNewValue.value, rightNewValue.value),
|
|
313
|
+
Math.max(leftNewValue.value, rightNewValue.value),
|
|
314
|
+
])
|
|
315
|
+
styleControl()
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
// 样式控制
|
|
319
|
+
function styleControl() {
|
|
320
|
+
// 左右滑轮距离左边最短为当前激活条所处位置
|
|
321
|
+
const barLeft =
|
|
322
|
+
leftBarPercent.value < rightBarPercent.value
|
|
323
|
+
? [leftBarPercent.value, rightBarPercent.value]
|
|
324
|
+
: [rightBarPercent.value, leftBarPercent.value]
|
|
325
|
+
// 通过左右滑轮的间距控制 激活条宽度 barLeft[1] - barLeft[0]
|
|
326
|
+
const barStyleTemp = `width: ${barLeft[1] - barLeft[0]}%; left: ${barLeft[0]}%`
|
|
327
|
+
currentValue.value =
|
|
328
|
+
leftNewValue.value < rightNewValue.value
|
|
329
|
+
? [leftNewValue.value, rightNewValue.value]
|
|
330
|
+
: [rightNewValue.value, leftNewValue.value]
|
|
331
|
+
barStyle.value = barStyleTemp
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function equal(arr1: number[], arr2: number[]) {
|
|
335
|
+
if (!isDef(arr1) || !isDef(arr2)) {
|
|
336
|
+
return false
|
|
337
|
+
}
|
|
338
|
+
let i = 0
|
|
339
|
+
arr1.forEach((item, index) => {
|
|
340
|
+
item === arr2[index] && i++
|
|
341
|
+
})
|
|
342
|
+
return i === 2
|
|
343
|
+
}
|
|
344
|
+
function format(value: number) {
|
|
345
|
+
const formatValue =
|
|
346
|
+
Math.round(Math.max(minValue.value, Math.min(value, maxValue.value)) / stepValue.value) *
|
|
347
|
+
stepValue.value
|
|
348
|
+
return formatValue
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// 计算占比
|
|
352
|
+
function formatPercent(value: number) {
|
|
353
|
+
const percentage = ((value - minValue.value) / (maxValue.value - minValue.value)) * 100
|
|
354
|
+
return percentage
|
|
355
|
+
}
|
|
356
|
+
// 计算滑块位置和进度长度
|
|
357
|
+
function calcBarPercent() {
|
|
358
|
+
const { modelValue } = props
|
|
359
|
+
let value = !isArray(modelValue)
|
|
360
|
+
? format(modelValue)
|
|
361
|
+
: leftBarPercent.value < rightBarPercent.value
|
|
362
|
+
? format(modelValue[0])
|
|
363
|
+
: format(modelValue[1])
|
|
364
|
+
value = format(value)
|
|
365
|
+
// 把 value 转换成百分比
|
|
366
|
+
const percent = formatPercent(value)
|
|
367
|
+
leftBarPercent.value = percent
|
|
368
|
+
barStyle.value = `width: ${percent}%; `
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
defineExpose<SliderExpose>({
|
|
372
|
+
initSlider,
|
|
373
|
+
})
|
|
374
|
+
</script>
|
|
375
|
+
<style lang="scss" scoped>
|
|
376
|
+
@import './index';
|
|
377
|
+
</style>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
@import '../common/abstracts/variable';
|
|
2
|
+
@import '../common/abstracts/mixin';
|
|
3
|
+
|
|
4
|
+
.wot-theme-dark {
|
|
5
|
+
@include b(sort-button) {
|
|
6
|
+
@include e(wrapper) {
|
|
7
|
+
color: $-dark-color;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@include b(sort-button) {
|
|
13
|
+
display: inline-block;
|
|
14
|
+
height: $-sort-button-height;
|
|
15
|
+
line-height: $-sort-button-height;
|
|
16
|
+
|
|
17
|
+
@include m(line) {
|
|
18
|
+
.wd-sort-button__left {
|
|
19
|
+
&::after {
|
|
20
|
+
position: absolute;
|
|
21
|
+
bottom: 6px;
|
|
22
|
+
left: 50%;
|
|
23
|
+
width: 19px;
|
|
24
|
+
height: 3px;
|
|
25
|
+
content: '';
|
|
26
|
+
background: $-sort-button-line-color;
|
|
27
|
+
border-radius: calc($-sort-button-line-height / 2);
|
|
28
|
+
opacity: 0;
|
|
29
|
+
transition: opacity 0.15s;
|
|
30
|
+
transform: translate(-50%, 0);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.is-active::after {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@include e(wrapper) {
|
|
40
|
+
font-size: $-sort-button-fs;
|
|
41
|
+
color: $-sort-button-color;
|
|
42
|
+
word-break: break-all;
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@include e(left) {
|
|
47
|
+
position: relative;
|
|
48
|
+
display: inline-block;
|
|
49
|
+
vertical-align: middle;
|
|
50
|
+
|
|
51
|
+
@include when(active) {
|
|
52
|
+
font-weight: $-fw-medium;
|
|
53
|
+
|
|
54
|
+
.wd-sort-button__right {
|
|
55
|
+
justify-content: center;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@include e(right) {
|
|
61
|
+
display: inline-block;
|
|
62
|
+
min-width: 14px;
|
|
63
|
+
margin-left: 2px;
|
|
64
|
+
line-height: 1.1;
|
|
65
|
+
vertical-align: middle;
|
|
66
|
+
|
|
67
|
+
@include when(active) {
|
|
68
|
+
:deep(.wd-sort-button__icon-up),
|
|
69
|
+
:deep(.wd-sort-button__icon-down) {
|
|
70
|
+
transform: scale(calc((10 / 14)));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@include edeep(icon-up) {
|
|
76
|
+
display: block !important;
|
|
77
|
+
line-height: 1.1;
|
|
78
|
+
transform: scale(calc((10 / 14))) translate(0, 7px);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@include edeep(icon-down) {
|
|
82
|
+
display: block !important;
|
|
83
|
+
line-height: 1.1;
|
|
84
|
+
transform: scale(calc((10 / 14))) translate(0, -7px);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ExtractPropTypes } from 'vue'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeNumberProp, makeStringProp } from '../common/props'
|
|
3
|
+
|
|
4
|
+
export const sortButtonProps = {
|
|
5
|
+
...baseProps,
|
|
6
|
+
/**
|
|
7
|
+
* 选中的箭头方向,1表示升序,0表示重置状态,-1表示降序。
|
|
8
|
+
* 类型: number
|
|
9
|
+
* 可选值: -1, 0, 1
|
|
10
|
+
* 默认值: 0或-1(根据具体实现可能有所不同)
|
|
11
|
+
*/
|
|
12
|
+
modelValue: makeNumberProp(0),
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 排序按钮展示的文案。
|
|
16
|
+
* 类型: string
|
|
17
|
+
* 默认值: ''
|
|
18
|
+
*/
|
|
19
|
+
title: makeStringProp(''),
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 当展示双箭头时,是否允许手动重置按钮。
|
|
23
|
+
* 类型: boolean
|
|
24
|
+
* 默认值: false
|
|
25
|
+
*/
|
|
26
|
+
allowReset: makeBooleanProp(false),
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 是否优先切换为降序,如果不开启则默认优先切换为升序。
|
|
30
|
+
* 类型: boolean
|
|
31
|
+
* 默认值: false
|
|
32
|
+
*/
|
|
33
|
+
descFirst: makeBooleanProp(false),
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 是否展示下划线,当只有一个排序按钮时,通常不展示下划线。
|
|
37
|
+
* 类型: boolean
|
|
38
|
+
* 默认值: true
|
|
39
|
+
*/
|
|
40
|
+
line: makeBooleanProp(true),
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type SortButtonProps = ExtractPropTypes<typeof sortButtonProps>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
:class="`wd-sort-button ${line ? 'wd-sort-button--line' : ''} ${customClass}`"
|
|
4
|
+
:style="customStyle"
|
|
5
|
+
@click="handleClick"
|
|
6
|
+
>
|
|
7
|
+
<view class="wd-sort-button__wrapper">
|
|
8
|
+
<view :class="`wd-sort-button__left ${modelValue !== 0 ? 'is-active' : ''}`">
|
|
9
|
+
{{ title }}
|
|
10
|
+
</view>
|
|
11
|
+
<view :class="`wd-sort-button__right ${modelValue !== 0 ? 'is-active' : ''}`">
|
|
12
|
+
<wd-icon v-if="modelValue !== 1" name="arrow-up" custom-class="wd-sort-button__icon-up" />
|
|
13
|
+
<wd-icon
|
|
14
|
+
v-if="modelValue !== -1"
|
|
15
|
+
name="arrow-down"
|
|
16
|
+
custom-class="wd-sort-button__icon-down"
|
|
17
|
+
/>
|
|
18
|
+
</view>
|
|
19
|
+
</view>
|
|
20
|
+
</view>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
export default {
|
|
25
|
+
name: 'wd-sort-button',
|
|
26
|
+
options: {
|
|
27
|
+
addGlobalClass: true,
|
|
28
|
+
virtualHost: true,
|
|
29
|
+
styleIsolation: 'shared',
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<script lang="ts" setup>
|
|
35
|
+
import { sortButtonProps } from './types'
|
|
36
|
+
|
|
37
|
+
const props = defineProps(sortButtonProps)
|
|
38
|
+
|
|
39
|
+
const emit = defineEmits(['change', 'update:modelValue'])
|
|
40
|
+
|
|
41
|
+
function handleClick() {
|
|
42
|
+
let { modelValue: value, allowReset, descFirst } = props
|
|
43
|
+
if (descFirst) {
|
|
44
|
+
if (value === 0) {
|
|
45
|
+
value = -1
|
|
46
|
+
} else if (value === -1) {
|
|
47
|
+
value = 1
|
|
48
|
+
} else if (value === 1) {
|
|
49
|
+
if (allowReset) {
|
|
50
|
+
value = 0
|
|
51
|
+
} else {
|
|
52
|
+
value = -1
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
if (value === 0) {
|
|
57
|
+
value = 1
|
|
58
|
+
} else if (value === 1) {
|
|
59
|
+
value = -1
|
|
60
|
+
} else if (value === -1) {
|
|
61
|
+
if (allowReset) {
|
|
62
|
+
value = 0
|
|
63
|
+
} else {
|
|
64
|
+
value = 1
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
emit('update:modelValue', value)
|
|
69
|
+
emit('change', {
|
|
70
|
+
value,
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
</script>
|
|
74
|
+
<style lang="scss" scoped>
|
|
75
|
+
@import './index';
|
|
76
|
+
</style>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@import '../common/abstracts/variable';
|
|
2
|
+
@import '../common/abstracts/mixin';
|
|
3
|
+
|
|
4
|
+
.wot-theme-dark {
|
|
5
|
+
background-color: $-dark-background2;
|
|
6
|
+
@include b(status-tip) {
|
|
7
|
+
@include e(text) {
|
|
8
|
+
color: $-dark-color3;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@include b(status-tip) {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
align-items: center;
|
|
18
|
+
width: 100%;
|
|
19
|
+
padding: $-statustip-padding;
|
|
20
|
+
margin: 0 auto;
|
|
21
|
+
font-size: $-statustip-fs;
|
|
22
|
+
color: $-statustip-color;
|
|
23
|
+
|
|
24
|
+
@include edeep(image) {
|
|
25
|
+
width: 160px;
|
|
26
|
+
height: 160px;
|
|
27
|
+
margin: 0 auto;
|
|
28
|
+
}
|
|
29
|
+
@include e(text) {
|
|
30
|
+
margin: 20px auto 0;
|
|
31
|
+
font-size: $-statustip-fs;
|
|
32
|
+
line-height: $-statustip-line-height;
|
|
33
|
+
color: $-statustip-color;
|
|
34
|
+
text-align: center;
|
|
35
|
+
word-break: break-all;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: weisheng
|
|
3
|
+
* @Date: 2024-03-15 13:49:00
|
|
4
|
+
* @LastEditTime: 2024-04-07 13:32:22
|
|
5
|
+
* @LastEditors: weisheng
|
|
6
|
+
* @Description:
|
|
7
|
+
* @FilePath: \wot-design-uni\src\uni_modules\wot-design-uni\components\wd-status-tip\types.ts
|
|
8
|
+
* 记得注释
|
|
9
|
+
*/
|
|
10
|
+
import type { ExtractPropTypes, PropType } from 'vue'
|
|
11
|
+
import { baseProps, makeStringProp } from '../common/props'
|
|
12
|
+
import type { ImageMode } from '../wd-img/types'
|
|
13
|
+
|
|
14
|
+
export type ImageSize = {
|
|
15
|
+
/**
|
|
16
|
+
* 宽度
|
|
17
|
+
*/
|
|
18
|
+
width: number | string
|
|
19
|
+
/**
|
|
20
|
+
* 高度
|
|
21
|
+
*/
|
|
22
|
+
height: number | string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const statusTipProps = {
|
|
26
|
+
...baseProps,
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 缺省图片类型,支持传入图片 URL。
|
|
30
|
+
* 类型: string
|
|
31
|
+
* 可选值: search, network, content, collect, comment, halo, message
|
|
32
|
+
* 默认值: network
|
|
33
|
+
*/
|
|
34
|
+
image: makeStringProp('network'),
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 图片大小,默认单位为 `px`。
|
|
38
|
+
* 类型: string 或 number 或 ImageSize
|
|
39
|
+
* 默认值: 空字符串
|
|
40
|
+
*/
|
|
41
|
+
imageSize: {
|
|
42
|
+
type: [String, Number, Object] as PropType<string | number | ImageSize>,
|
|
43
|
+
default: '',
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* 提示文案。
|
|
47
|
+
* 类型: string
|
|
48
|
+
* 默认值: 空字符串
|
|
49
|
+
*/
|
|
50
|
+
tip: makeStringProp(''),
|
|
51
|
+
/**
|
|
52
|
+
* 图片裁剪、缩放的模式
|
|
53
|
+
* 类型:string
|
|
54
|
+
* 默认值:'aspectFill'
|
|
55
|
+
*/
|
|
56
|
+
imageMode: makeStringProp<ImageMode>('aspectFill'),
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type StatusTipProps = ExtractPropTypes<typeof statusTipProps>
|