oxy-uni-ui 1.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/LICENSE +21 -0
- package/README.md +13 -0
- package/attributes.json +1 -0
- package/components/common/AbortablePromise.ts +28 -0
- package/components/common/abstracts/_config.scss +7 -0
- package/components/common/abstracts/_function.scss +89 -0
- package/components/common/abstracts/_mixin.scss +385 -0
- package/components/common/abstracts/variable.scss +974 -0
- package/components/common/base64.ts +29 -0
- package/components/common/canvasHelper.ts +49 -0
- package/components/common/clickoutside.ts +25 -0
- package/components/common/event.ts +8 -0
- package/components/common/interceptor.ts +43 -0
- package/components/common/props.ts +51 -0
- package/components/common/util.ts +778 -0
- package/components/composables/index.ts +11 -0
- package/components/composables/useCell.ts +13 -0
- package/components/composables/useChildren.ts +113 -0
- package/components/composables/useCountDown.ts +138 -0
- package/components/composables/useLockScroll.ts +37 -0
- package/components/composables/useParent.ts +41 -0
- package/components/composables/usePopover.ts +176 -0
- package/components/composables/useQueue.ts +52 -0
- package/components/composables/useRaf.ts +37 -0
- package/components/composables/useTouch.ts +43 -0
- package/components/composables/useTranslate.ts +12 -0
- package/components/composables/useUpload.ts +364 -0
- package/components/oxy-action-sheet/index.scss +204 -0
- package/components/oxy-action-sheet/oxy-action-sheet.vue +155 -0
- package/components/oxy-action-sheet/types.ts +118 -0
- package/components/oxy-backtop/index.scss +25 -0
- package/components/oxy-backtop/oxy-backtop.vue +45 -0
- package/components/oxy-backtop/types.ts +37 -0
- package/components/oxy-badge/index.scss +63 -0
- package/components/oxy-badge/oxy-badge.vue +61 -0
- package/components/oxy-badge/types.ts +41 -0
- package/components/oxy-button/index.scss +336 -0
- package/components/oxy-button/oxy-button.vue +195 -0
- package/components/oxy-button/types.ts +133 -0
- package/components/oxy-calendar/index.scss +158 -0
- package/components/oxy-calendar/oxy-calendar.vue +451 -0
- package/components/oxy-calendar/types.ts +217 -0
- package/components/oxy-calendar-view/index.scss +0 -0
- package/components/oxy-calendar-view/month/index.scss +162 -0
- package/components/oxy-calendar-view/month/month.vue +389 -0
- package/components/oxy-calendar-view/month/types.ts +20 -0
- package/components/oxy-calendar-view/monthPanel/index.scss +89 -0
- package/components/oxy-calendar-view/monthPanel/month-panel.vue +374 -0
- package/components/oxy-calendar-view/monthPanel/types.ts +48 -0
- package/components/oxy-calendar-view/oxy-calendar-view.vue +111 -0
- package/components/oxy-calendar-view/types.ts +109 -0
- package/components/oxy-calendar-view/utils.ts +429 -0
- package/components/oxy-calendar-view/year/index.scss +153 -0
- package/components/oxy-calendar-view/year/types.ts +20 -0
- package/components/oxy-calendar-view/year/year.vue +202 -0
- package/components/oxy-calendar-view/yearPanel/index.scss +24 -0
- package/components/oxy-calendar-view/yearPanel/types.ts +38 -0
- package/components/oxy-calendar-view/yearPanel/year-panel.vue +135 -0
- package/components/oxy-card/index.scss +71 -0
- package/components/oxy-card/oxy-card.vue +37 -0
- package/components/oxy-card/types.ts +30 -0
- package/components/oxy-cell/index.scss +206 -0
- package/components/oxy-cell/oxy-cell.vue +140 -0
- package/components/oxy-cell/types.ts +111 -0
- package/components/oxy-cell-group/index.scss +56 -0
- package/components/oxy-cell-group/oxy-cell-group.vue +45 -0
- package/components/oxy-cell-group/types.ts +32 -0
- package/components/oxy-checkbox/index.scss +285 -0
- package/components/oxy-checkbox/oxy-checkbox.vue +177 -0
- package/components/oxy-checkbox/types.ts +68 -0
- package/components/oxy-checkbox-group/index.scss +20 -0
- package/components/oxy-checkbox-group/oxy-checkbox-group.vue +100 -0
- package/components/oxy-checkbox-group/types.ts +59 -0
- package/components/oxy-circle/index.scss +18 -0
- package/components/oxy-circle/oxy-circle.vue +296 -0
- package/components/oxy-circle/types.ts +54 -0
- package/components/oxy-col/index.scss +19 -0
- package/components/oxy-col/oxy-col.vue +49 -0
- package/components/oxy-col/types.ts +15 -0
- package/components/oxy-col-picker/index.scss +168 -0
- package/components/oxy-col-picker/oxy-col-picker.vue +498 -0
- package/components/oxy-col-picker/types.ts +166 -0
- package/components/oxy-collapse/index.scss +55 -0
- package/components/oxy-collapse/oxy-collapse.vue +151 -0
- package/components/oxy-collapse/types.ts +58 -0
- package/components/oxy-collapse-item/index.scss +90 -0
- package/components/oxy-collapse-item/oxy-collapse-item.vue +171 -0
- package/components/oxy-collapse-item/types.ts +48 -0
- package/components/oxy-config-provider/oxy-config-provider.vue +73 -0
- package/components/oxy-config-provider/types.ts +1052 -0
- package/components/oxy-count-down/index.scss +15 -0
- package/components/oxy-count-down/oxy-count-down.vue +60 -0
- package/components/oxy-count-down/types.ts +41 -0
- package/components/oxy-count-down/utils.ts +52 -0
- package/components/oxy-count-to/index.scss +7 -0
- package/components/oxy-count-to/oxy-count-to.vue +125 -0
- package/components/oxy-count-to/types.ts +117 -0
- package/components/oxy-curtain/index.scss +85 -0
- package/components/oxy-curtain/oxy-curtain.vue +172 -0
- package/components/oxy-curtain/types.ts +73 -0
- package/components/oxy-datetime-picker/index.scss +164 -0
- package/components/oxy-datetime-picker/oxy-datetime-picker.vue +801 -0
- package/components/oxy-datetime-picker/types.ts +231 -0
- package/components/oxy-datetime-picker-view/oxy-datetime-picker-view.vue +499 -0
- package/components/oxy-datetime-picker-view/types.ts +120 -0
- package/components/oxy-datetime-picker-view/util.ts +30 -0
- package/components/oxy-design-uni/oxy-design-uni.vue +5 -0
- package/components/oxy-divider/index.scss +100 -0
- package/components/oxy-divider/oxy-divider.vue +52 -0
- package/components/oxy-divider/types.ts +35 -0
- package/components/oxy-drop-menu/index.scss +86 -0
- package/components/oxy-drop-menu/oxy-drop-menu.vue +166 -0
- package/components/oxy-drop-menu/types.ts +38 -0
- package/components/oxy-drop-menu-item/index.scss +66 -0
- package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +221 -0
- package/components/oxy-drop-menu-item/types.ts +94 -0
- package/components/oxy-fab/index.scss +116 -0
- package/components/oxy-fab/oxy-fab.vue +276 -0
- package/components/oxy-fab/types.ts +66 -0
- package/components/oxy-floating-panel/index.scss +64 -0
- package/components/oxy-floating-panel/oxy-floating-panel.vue +140 -0
- package/components/oxy-floating-panel/type.ts +32 -0
- package/components/oxy-form/oxy-form.vue +207 -0
- package/components/oxy-form/types.ts +76 -0
- package/components/oxy-form-item/index.scss +18 -0
- package/components/oxy-form-item/oxy-form-item.vue +56 -0
- package/components/oxy-form-item/types.ts +16 -0
- package/components/oxy-gap/index.scss +9 -0
- package/components/oxy-gap/oxy-gap.vue +36 -0
- package/components/oxy-gap/types.ts +17 -0
- package/components/oxy-grid/index.scss +9 -0
- package/components/oxy-grid/oxy-grid.vue +106 -0
- package/components/oxy-grid/types.ts +50 -0
- package/components/oxy-grid-item/index.scss +148 -0
- package/components/oxy-grid-item/oxy-grid-item.vue +176 -0
- package/components/oxy-grid-item/types.ts +77 -0
- package/components/oxy-icon/index.scss +1230 -0
- package/components/oxy-icon/oxy-icon.vue +53 -0
- package/components/oxy-icon/oxy-icons.ttf +0 -0
- package/components/oxy-icon/types.ts +21 -0
- package/components/oxy-img/index.scss +19 -0
- package/components/oxy-img/oxy-img.vue +81 -0
- package/components/oxy-img/types.ts +61 -0
- package/components/oxy-img-cropper/index.scss +231 -0
- package/components/oxy-img-cropper/oxy-img-cropper.vue +664 -0
- package/components/oxy-img-cropper/types.ts +76 -0
- package/components/oxy-index-anchor/index.scss +35 -0
- package/components/oxy-index-anchor/oxy-index-anchor.vue +55 -0
- package/components/oxy-index-anchor/type.ts +9 -0
- package/components/oxy-index-bar/index.scss +39 -0
- package/components/oxy-index-bar/oxy-index-bar.vue +156 -0
- package/components/oxy-index-bar/type.ts +23 -0
- package/components/oxy-input/index.scss +323 -0
- package/components/oxy-input/oxy-input.vue +300 -0
- package/components/oxy-input/placeholder.scss +21 -0
- package/components/oxy-input/types.ts +189 -0
- package/components/oxy-input-number/index.scss +132 -0
- package/components/oxy-input-number/oxy-input-number.vue +464 -0
- package/components/oxy-input-number/types.ts +101 -0
- package/components/oxy-keyboard/constants.ts +81 -0
- package/components/oxy-keyboard/index.scss +102 -0
- package/components/oxy-keyboard/key/index.scss +79 -0
- package/components/oxy-keyboard/key/index.vue +76 -0
- package/components/oxy-keyboard/key/types.ts +11 -0
- package/components/oxy-keyboard/oxy-keyboard.vue +206 -0
- package/components/oxy-keyboard/types.ts +92 -0
- package/components/oxy-loading/index.scss +37 -0
- package/components/oxy-loading/oxy-loading.vue +90 -0
- package/components/oxy-loading/types.ts +22 -0
- package/components/oxy-loadmore/index.scss +39 -0
- package/components/oxy-loadmore/oxy-loadmore.vue +59 -0
- package/components/oxy-loadmore/types.ts +30 -0
- package/components/oxy-message-box/index.scss +108 -0
- package/components/oxy-message-box/index.ts +87 -0
- package/components/oxy-message-box/oxy-message-box.vue +291 -0
- package/components/oxy-message-box/types.ts +132 -0
- package/components/oxy-navbar/index.scss +93 -0
- package/components/oxy-navbar/oxy-navbar.vue +111 -0
- package/components/oxy-navbar/types.ts +52 -0
- package/components/oxy-navbar-capsule/index.scss +66 -0
- package/components/oxy-navbar-capsule/oxy-navbar-capsule.vue +35 -0
- package/components/oxy-navbar-capsule/types.ts +8 -0
- package/components/oxy-notice-bar/index.scss +68 -0
- package/components/oxy-notice-bar/oxy-notice-bar.vue +266 -0
- package/components/oxy-notice-bar/types.ts +67 -0
- package/components/oxy-notify/index.scss +34 -0
- package/components/oxy-notify/index.ts +61 -0
- package/components/oxy-notify/oxy-notify.vue +85 -0
- package/components/oxy-notify/types.ts +66 -0
- package/components/oxy-number-keyboard/index.scss +78 -0
- package/components/oxy-number-keyboard/key/index.scss +81 -0
- package/components/oxy-number-keyboard/key/index.vue +78 -0
- package/components/oxy-number-keyboard/key/types.ts +11 -0
- package/components/oxy-number-keyboard/oxy-number-keyboard.vue +151 -0
- package/components/oxy-number-keyboard/types.ts +83 -0
- package/components/oxy-overlay/index.scss +17 -0
- package/components/oxy-overlay/oxy-overlay.vue +47 -0
- package/components/oxy-overlay/types.ts +25 -0
- package/components/oxy-pagination/index.scss +57 -0
- package/components/oxy-pagination/oxy-pagination.vue +110 -0
- package/components/oxy-pagination/types.ts +41 -0
- package/components/oxy-password-input/index.scss +124 -0
- package/components/oxy-password-input/oxy-password-input.vue +49 -0
- package/components/oxy-password-input/types.ts +33 -0
- package/components/oxy-picker/index.scss +110 -0
- package/components/oxy-picker/oxy-picker.vue +412 -0
- package/components/oxy-picker/types.ts +189 -0
- package/components/oxy-picker-view/index.scss +92 -0
- package/components/oxy-picker-view/oxy-picker-view.vue +369 -0
- package/components/oxy-picker-view/types.ts +152 -0
- package/components/oxy-popover/index.scss +116 -0
- package/components/oxy-popover/oxy-popover.vue +180 -0
- package/components/oxy-popover/types.ts +69 -0
- package/components/oxy-popup/index.scss +84 -0
- package/components/oxy-popup/oxy-popup.vue +169 -0
- package/components/oxy-popup/types.ts +95 -0
- package/components/oxy-progress/index.scss +68 -0
- package/components/oxy-progress/oxy-progress.vue +197 -0
- package/components/oxy-progress/types.ts +35 -0
- package/components/oxy-radio/index.scss +301 -0
- package/components/oxy-radio/oxy-radio.vue +118 -0
- package/components/oxy-radio/types.ts +42 -0
- package/components/oxy-radio-group/index.scss +23 -0
- package/components/oxy-radio-group/oxy-radio-group.vue +51 -0
- package/components/oxy-radio-group/types.ts +39 -0
- package/components/oxy-rate/index.scss +25 -0
- package/components/oxy-rate/oxy-rate.vue +178 -0
- package/components/oxy-rate/types.ts +103 -0
- package/components/oxy-resize/index.scss +27 -0
- package/components/oxy-resize/oxy-resize.vue +144 -0
- package/components/oxy-resize/types.ts +6 -0
- package/components/oxy-root-portal/oxy-root-portal.vue +50 -0
- package/components/oxy-row/index.scss +10 -0
- package/components/oxy-row/oxy-row.vue +42 -0
- package/components/oxy-row/types.ts +16 -0
- package/components/oxy-search/index.scss +148 -0
- package/components/oxy-search/oxy-search.vue +187 -0
- package/components/oxy-search/types.ts +93 -0
- package/components/oxy-segmented/index.scss +101 -0
- package/components/oxy-segmented/oxy-segmented.vue +143 -0
- package/components/oxy-segmented/types.ts +71 -0
- package/components/oxy-select-picker/index.scss +102 -0
- package/components/oxy-select-picker/oxy-select-picker.vue +432 -0
- package/components/oxy-select-picker/types.ts +123 -0
- package/components/oxy-sidebar/index.scss +25 -0
- package/components/oxy-sidebar/oxy-sidebar.vue +63 -0
- package/components/oxy-sidebar/types.ts +38 -0
- package/components/oxy-sidebar-item/index.scss +97 -0
- package/components/oxy-sidebar-item/oxy-sidebar-item.vue +116 -0
- package/components/oxy-sidebar-item/types.ts +31 -0
- package/components/oxy-signature/index.scss +31 -0
- package/components/oxy-signature/oxy-signature.vue +630 -0
- package/components/oxy-signature/types.ts +108 -0
- package/components/oxy-skeleton/index.scss +96 -0
- package/components/oxy-skeleton/index.ts +1 -0
- package/components/oxy-skeleton/oxy-skeleton.vue +110 -0
- package/components/oxy-skeleton/types.ts +69 -0
- package/components/oxy-slider/index.scss +98 -0
- package/components/oxy-slider/oxy-slider.vue +356 -0
- package/components/oxy-slider/types.ts +138 -0
- package/components/oxy-sort-button/index.scss +89 -0
- package/components/oxy-sort-button/oxy-sort-button.vue +69 -0
- package/components/oxy-sort-button/types.ts +43 -0
- package/components/oxy-status-tip/images/collect.png +0 -0
- package/components/oxy-status-tip/images/content.png +0 -0
- package/components/oxy-status-tip/images/network.png +0 -0
- package/components/oxy-status-tip/images/search.png +0 -0
- package/components/oxy-status-tip/index.scss +37 -0
- package/components/oxy-status-tip/oxy-status-tip.vue +71 -0
- package/components/oxy-status-tip/types.ts +50 -0
- package/components/oxy-step/index.scss +235 -0
- package/components/oxy-step/oxy-step.vue +150 -0
- package/components/oxy-step/types.ts +33 -0
- package/components/oxy-steps/index.scss +10 -0
- package/components/oxy-steps/oxy-steps.vue +28 -0
- package/components/oxy-steps/types.ts +50 -0
- package/components/oxy-sticky/index.scss +9 -0
- package/components/oxy-sticky/oxy-sticky.vue +190 -0
- package/components/oxy-sticky/types.ts +13 -0
- package/components/oxy-sticky-box/index.scss +6 -0
- package/components/oxy-sticky-box/oxy-sticky-box.vue +155 -0
- package/components/oxy-sticky-box/types.ts +11 -0
- package/components/oxy-swipe-action/index.scss +22 -0
- package/components/oxy-swipe-action/oxy-swipe-action.vue +294 -0
- package/components/oxy-swipe-action/types.ts +40 -0
- package/components/oxy-swiper/index.scss +53 -0
- package/components/oxy-swiper/oxy-swiper.vue +318 -0
- package/components/oxy-swiper/types.ts +264 -0
- package/components/oxy-swiper-nav/index.scss +159 -0
- package/components/oxy-swiper-nav/oxy-swiper-nav.vue +37 -0
- package/components/oxy-swiper-nav/types.ts +42 -0
- package/components/oxy-switch/index.scss +58 -0
- package/components/oxy-switch/oxy-switch.vue +83 -0
- package/components/oxy-switch/types.ts +58 -0
- package/components/oxy-tab/index.scss +16 -0
- package/components/oxy-tab/oxy-tab.vue +88 -0
- package/components/oxy-tab/types.ts +30 -0
- package/components/oxy-tabbar/index.scss +62 -0
- package/components/oxy-tabbar/oxy-tabbar.vue +91 -0
- package/components/oxy-tabbar/types.ts +73 -0
- package/components/oxy-tabbar-item/index.scss +55 -0
- package/components/oxy-tabbar-item/oxy-tabbar-item.vue +99 -0
- package/components/oxy-tabbar-item/types.ts +51 -0
- package/components/oxy-table/index.scss +163 -0
- package/components/oxy-table/oxy-table.vue +283 -0
- package/components/oxy-table/types.ts +58 -0
- package/components/oxy-table-col/index.scss +46 -0
- package/components/oxy-table-col/oxy-table-col.vue +149 -0
- package/components/oxy-table-col/types.ts +54 -0
- package/components/oxy-tabs/index.scss +299 -0
- package/components/oxy-tabs/oxy-tabs.vue +443 -0
- package/components/oxy-tabs/types.ts +107 -0
- package/components/oxy-tag/index.scss +115 -0
- package/components/oxy-tag/oxy-tag.vue +148 -0
- package/components/oxy-tag/types.ts +81 -0
- package/components/oxy-text/index.scss +37 -0
- package/components/oxy-text/oxy-text.vue +139 -0
- package/components/oxy-text/types.ts +98 -0
- package/components/oxy-textarea/index.scss +340 -0
- package/components/oxy-textarea/oxy-textarea.vue +296 -0
- package/components/oxy-textarea/placeholder.scss +20 -0
- package/components/oxy-textarea/types.ts +288 -0
- package/components/oxy-toast/index.scss +75 -0
- package/components/oxy-toast/index.ts +92 -0
- package/components/oxy-toast/oxy-toast.vue +198 -0
- package/components/oxy-toast/types.ts +181 -0
- package/components/oxy-tooltip/index.scss +66 -0
- package/components/oxy-tooltip/oxy-tooltip.vue +141 -0
- package/components/oxy-tooltip/types.ts +107 -0
- package/components/oxy-transition/index.scss +95 -0
- package/components/oxy-transition/oxy-transition.vue +232 -0
- package/components/oxy-transition/types.ts +98 -0
- package/components/oxy-upload/index.scss +175 -0
- package/components/oxy-upload/oxy-upload.vue +673 -0
- package/components/oxy-upload/types.ts +391 -0
- package/components/oxy-video-preview/index.scss +34 -0
- package/components/oxy-video-preview/oxy-video-preview.vue +72 -0
- package/components/oxy-video-preview/types.ts +23 -0
- package/components/oxy-watermark/index.scss +18 -0
- package/components/oxy-watermark/oxy-watermark.vue +486 -0
- package/components/oxy-watermark/types.ts +76 -0
- package/dayjs/constant.js +26 -0
- package/dayjs/index.d.ts +430 -0
- package/dayjs/index.js +542 -0
- package/dayjs/locale/en.js +13 -0
- package/dayjs/utils.js +59 -0
- package/global.d.ts +101 -0
- package/index.ts +12 -0
- package/locale/index.ts +32 -0
- package/locale/lang/ar-SA.ts +133 -0
- package/locale/lang/en-US.ts +133 -0
- package/locale/lang/zh-CN.ts +137 -0
- package/package.json +1 -0
- package/tags.json +1 -0
- package/web-types.json +1 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@import '../common/abstracts/variable';
|
|
2
|
+
@import '../common/abstracts/mixin';
|
|
3
|
+
|
|
4
|
+
.oxy-theme-dark {
|
|
5
|
+
@include b(count-down) {
|
|
6
|
+
color: $-dark-color;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@include b(count-down) {
|
|
12
|
+
color: $-count-down-text-color;
|
|
13
|
+
font-size: $-count-down-font-size;
|
|
14
|
+
line-height: $-count-down-line-height;
|
|
15
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="`oxy-count-down ${customClass}`" :style="customStyle">
|
|
3
|
+
<slot :current="current" v-if="$slots.default" />
|
|
4
|
+
<block v-else>{{ timeText }}</block>
|
|
5
|
+
</view>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
export default {
|
|
10
|
+
name: 'oxy-count-down',
|
|
11
|
+
options: {
|
|
12
|
+
virtualHost: true,
|
|
13
|
+
addGlobalClass: true,
|
|
14
|
+
styleIsolation: 'shared'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { watch, computed, onMounted } from 'vue'
|
|
21
|
+
import { parseFormat } from './utils'
|
|
22
|
+
import { useCountDown } from '../composables/useCountDown'
|
|
23
|
+
import { countDownProps, type CountDownExpose } from './types'
|
|
24
|
+
|
|
25
|
+
const props = defineProps(countDownProps)
|
|
26
|
+
|
|
27
|
+
const emit = defineEmits(['change', 'finish'])
|
|
28
|
+
|
|
29
|
+
const { start, pause, reset, current } = useCountDown({
|
|
30
|
+
time: props.time,
|
|
31
|
+
millisecond: props.millisecond,
|
|
32
|
+
onChange: (current) => emit('change', current),
|
|
33
|
+
onFinish: () => emit('finish')
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const timeText = computed(() => parseFormat(props.format, current.value))
|
|
37
|
+
|
|
38
|
+
const resetTime = () => {
|
|
39
|
+
reset(props.time)
|
|
40
|
+
if (props.autoStart) {
|
|
41
|
+
start()
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
watch(() => props.time, resetTime, { immediate: false })
|
|
46
|
+
|
|
47
|
+
onMounted(() => {
|
|
48
|
+
resetTime()
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
defineExpose<CountDownExpose>({
|
|
52
|
+
start,
|
|
53
|
+
pause,
|
|
54
|
+
reset: resetTime
|
|
55
|
+
})
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<style lang="scss" scoped>
|
|
59
|
+
@import './index.scss';
|
|
60
|
+
</style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ComponentPublicInstance, ExtractPropTypes } from 'vue'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeRequiredProp, makeStringProp } from '../common/props'
|
|
3
|
+
|
|
4
|
+
export const countDownProps = {
|
|
5
|
+
...baseProps,
|
|
6
|
+
/**
|
|
7
|
+
* 倒计时时长,单位毫秒
|
|
8
|
+
*/
|
|
9
|
+
time: makeRequiredProp(Number),
|
|
10
|
+
/**
|
|
11
|
+
* 是否开启毫秒
|
|
12
|
+
*/
|
|
13
|
+
millisecond: makeBooleanProp(false),
|
|
14
|
+
/**
|
|
15
|
+
* 格式化时间
|
|
16
|
+
*/
|
|
17
|
+
format: makeStringProp('HH:mm:ss'),
|
|
18
|
+
/**
|
|
19
|
+
* 是否自动开始
|
|
20
|
+
*/
|
|
21
|
+
autoStart: makeBooleanProp(true)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type CountDownProps = ExtractPropTypes<typeof countDownProps>
|
|
25
|
+
|
|
26
|
+
export type CountDownExpose = {
|
|
27
|
+
/**
|
|
28
|
+
* 开始倒计时
|
|
29
|
+
*/
|
|
30
|
+
start: () => void
|
|
31
|
+
/**
|
|
32
|
+
* 暂停倒计时
|
|
33
|
+
*/
|
|
34
|
+
pause: () => void
|
|
35
|
+
/**
|
|
36
|
+
* 重设倒计时,若 auto-start 为 true,重设后会自动开始倒计时
|
|
37
|
+
*/
|
|
38
|
+
reset: () => void
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type CountDownInstance = ComponentPublicInstance<CountDownProps, CountDownExpose>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { padZero } from '../common/util'
|
|
2
|
+
|
|
3
|
+
export type TimeData = {
|
|
4
|
+
days: number
|
|
5
|
+
hours: number
|
|
6
|
+
minutes: number
|
|
7
|
+
seconds: number
|
|
8
|
+
milliseconds: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function parseFormat(format: string, timeData: TimeData): string {
|
|
12
|
+
const { days } = timeData
|
|
13
|
+
let { hours, minutes, seconds, milliseconds } = timeData
|
|
14
|
+
|
|
15
|
+
if (format.includes('DD')) {
|
|
16
|
+
format = format.replace('DD', padZero(days))
|
|
17
|
+
} else {
|
|
18
|
+
hours += days * 24
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (format.includes('HH')) {
|
|
22
|
+
format = format.replace('HH', padZero(hours))
|
|
23
|
+
} else {
|
|
24
|
+
minutes += hours * 60
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (format.includes('mm')) {
|
|
28
|
+
format = format.replace('mm', padZero(minutes))
|
|
29
|
+
} else {
|
|
30
|
+
seconds += minutes * 60
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (format.includes('ss')) {
|
|
34
|
+
format = format.replace('ss', padZero(seconds))
|
|
35
|
+
} else {
|
|
36
|
+
milliseconds += seconds * 1000
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (format.includes('S')) {
|
|
40
|
+
const ms = padZero(milliseconds, 3)
|
|
41
|
+
|
|
42
|
+
if (format.includes('SSS')) {
|
|
43
|
+
format = format.replace('SSS', ms)
|
|
44
|
+
} else if (format.includes('SS')) {
|
|
45
|
+
format = format.replace('SS', ms.slice(0, 2))
|
|
46
|
+
} else {
|
|
47
|
+
format = format.replace('S', ms.charAt(0))
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return format
|
|
52
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view :class="rootClass">
|
|
3
|
+
<!-- 前缀插槽 -->
|
|
4
|
+
<slot name="prefix">
|
|
5
|
+
<oxy-text :type="props.type" :color="props.color" :size="`${props.fontSize * 0.7}px`" :text="props.prefix"></oxy-text>
|
|
6
|
+
</slot>
|
|
7
|
+
<!-- 默认文本插槽 -->
|
|
8
|
+
<slot>
|
|
9
|
+
<oxy-text :type="props.type" :color="props.color" :size="`${props.fontSize}px`" :text="timeText"></oxy-text>
|
|
10
|
+
</slot>
|
|
11
|
+
<!-- 后缀插槽 -->
|
|
12
|
+
<slot name="suffix">
|
|
13
|
+
<oxy-text :type="props.type" :color="props.color" :size="`${props.fontSize * 0.7}px`" :text="props.suffix"></oxy-text>
|
|
14
|
+
</slot>
|
|
15
|
+
</view>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
export default {
|
|
20
|
+
name: 'oxy-count-to',
|
|
21
|
+
options: {
|
|
22
|
+
virtualHost: true,
|
|
23
|
+
addGlobalClass: true,
|
|
24
|
+
styleIsolation: 'shared'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<script lang="ts" setup>
|
|
30
|
+
import OxyText from '../oxy-text/oxy-text.vue'
|
|
31
|
+
import { computed, watch, onMounted } from 'vue'
|
|
32
|
+
import { countToProps } from './types'
|
|
33
|
+
import { easingFn, isNumber } from '../common/util'
|
|
34
|
+
import { useCountDown } from '../composables/useCountDown'
|
|
35
|
+
import type { CountDownExpose } from '../oxy-count-down/types'
|
|
36
|
+
|
|
37
|
+
const props = defineProps(countToProps)
|
|
38
|
+
const emit = defineEmits(['mounted', 'finish'])
|
|
39
|
+
|
|
40
|
+
const { start, pause, reset, current } = useCountDown({
|
|
41
|
+
time: props.duration,
|
|
42
|
+
millisecond: true,
|
|
43
|
+
onFinish: () => emit('finish')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
// 计算根元素的类名
|
|
47
|
+
const rootClass = computed(() => {
|
|
48
|
+
return `oxy-count-to ${props.customClass}`
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const timeText = computed(() => {
|
|
52
|
+
return parseFormat(current.value.total)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
watch([() => props.startVal, () => props.endVal, () => props.duration], resetTime, { immediate: false })
|
|
56
|
+
|
|
57
|
+
onMounted(() => {
|
|
58
|
+
resetTime()
|
|
59
|
+
emit('mounted')
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
// 重置动画
|
|
63
|
+
function resetTime() {
|
|
64
|
+
reset(props.duration)
|
|
65
|
+
if (props.autoStart) {
|
|
66
|
+
start()
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function parseFormat(remain: number) {
|
|
71
|
+
const { startVal, endVal, duration, useEasing } = props
|
|
72
|
+
const progress = duration - remain // 已经进行的时间
|
|
73
|
+
const isPositive = startVal > endVal // 判断startVal是否大于endVal
|
|
74
|
+
const progressRatio = progress / duration // 计算进度比例
|
|
75
|
+
|
|
76
|
+
let currentVal: number
|
|
77
|
+
|
|
78
|
+
if (useEasing) {
|
|
79
|
+
// 使用缓动函数计算currentVal
|
|
80
|
+
if (isPositive) {
|
|
81
|
+
currentVal = startVal - easingFn(progress, 0, startVal - endVal, duration) || 0
|
|
82
|
+
} else {
|
|
83
|
+
currentVal = easingFn(progress, startVal, endVal - startVal, duration)
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
// 不使用缓动函数时的计算方式
|
|
87
|
+
if (isPositive) {
|
|
88
|
+
currentVal = startVal - (startVal - endVal) * progressRatio
|
|
89
|
+
} else {
|
|
90
|
+
currentVal = startVal + (endVal - startVal) * progressRatio
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// 确保currentVal在startVal和endVal之间
|
|
94
|
+
currentVal = isPositive ? Math.max(endVal, currentVal) : Math.min(endVal, currentVal)
|
|
95
|
+
return formatNumber(currentVal)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 格式化数字
|
|
99
|
+
function formatNumber(num: any): string {
|
|
100
|
+
if (typeof num !== 'number') {
|
|
101
|
+
num = parseFloat(num)
|
|
102
|
+
if (isNaN(num)) {
|
|
103
|
+
return '0'
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
num = num.toFixed(props.decimals)
|
|
107
|
+
const parts = num.split('.')
|
|
108
|
+
let integerPart = parts[0]
|
|
109
|
+
const decimalPart = parts.length > 1 ? props.decimal + parts[1] : ''
|
|
110
|
+
const rgx = /(\d+)(\d{3})/
|
|
111
|
+
|
|
112
|
+
if (props.separator && !isNumber(props.separator)) {
|
|
113
|
+
while (rgx.test(integerPart)) {
|
|
114
|
+
integerPart = integerPart.replace(rgx, '$1' + props.separator + '$2')
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return integerPart + decimalPart
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
defineExpose<CountDownExpose>({ start, reset: resetTime, pause })
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<style lang="scss" scoped>
|
|
124
|
+
@import './index.scss';
|
|
125
|
+
</style>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { ComponentPublicInstance, ExtractPropTypes } from 'vue'
|
|
2
|
+
import { baseProps, makeBooleanProp, makeNumberProp, makeStringProp } from '../common/props'
|
|
3
|
+
import type { TextType } from '../oxy-text/types'
|
|
4
|
+
|
|
5
|
+
export const countToProps = {
|
|
6
|
+
...baseProps,
|
|
7
|
+
|
|
8
|
+
// 字体大小
|
|
9
|
+
fontSize: makeNumberProp(16),
|
|
10
|
+
|
|
11
|
+
// 文本颜色
|
|
12
|
+
color: makeStringProp(''),
|
|
13
|
+
/**
|
|
14
|
+
* 主题类型
|
|
15
|
+
* 类型:string
|
|
16
|
+
* 可选值:'default' /'primary' / 'error' / 'warning' / 'success'
|
|
17
|
+
* 默认值:'default'
|
|
18
|
+
*/
|
|
19
|
+
type: makeStringProp<TextType>('default'),
|
|
20
|
+
/**
|
|
21
|
+
* 起始值
|
|
22
|
+
* 类型:number
|
|
23
|
+
* 默认值:0
|
|
24
|
+
*/
|
|
25
|
+
startVal: makeNumberProp(0),
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 最终值
|
|
29
|
+
* 类型:number
|
|
30
|
+
* 默认值:2021
|
|
31
|
+
*/
|
|
32
|
+
endVal: makeNumberProp(2024),
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 从起始值到结束值数字变动的时间,单位毫秒
|
|
36
|
+
* 类型:number
|
|
37
|
+
* 默认值:3000
|
|
38
|
+
*/
|
|
39
|
+
duration: makeNumberProp(3000),
|
|
40
|
+
/**
|
|
41
|
+
* 是否自动开始
|
|
42
|
+
* 类型:boolean
|
|
43
|
+
* 默认值:true
|
|
44
|
+
*/
|
|
45
|
+
autoStart: makeBooleanProp(true),
|
|
46
|
+
/**
|
|
47
|
+
* 保留的小数位数
|
|
48
|
+
* 类型:number
|
|
49
|
+
* 默认值:0
|
|
50
|
+
* 校验:大于等于0
|
|
51
|
+
*/
|
|
52
|
+
decimals: {
|
|
53
|
+
type: Number,
|
|
54
|
+
required: false,
|
|
55
|
+
default: 0,
|
|
56
|
+
validator(value: number) {
|
|
57
|
+
return value >= 0
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
// 小数点
|
|
62
|
+
decimal: makeStringProp('.'),
|
|
63
|
+
|
|
64
|
+
// 三位三位的隔开效果
|
|
65
|
+
separator: makeStringProp(','),
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 前缀
|
|
69
|
+
* 类型:string
|
|
70
|
+
* 默认值:''
|
|
71
|
+
* @example '¥' 人民币前缀
|
|
72
|
+
*/
|
|
73
|
+
prefix: makeStringProp(''),
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* 后缀
|
|
77
|
+
* 类型:string
|
|
78
|
+
* 默认值:''
|
|
79
|
+
*/
|
|
80
|
+
suffix: makeStringProp(''),
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 是否具有连贯性
|
|
84
|
+
* 类型:boolean
|
|
85
|
+
* 默认值:true
|
|
86
|
+
*/
|
|
87
|
+
useEasing: makeBooleanProp(true),
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 自定义根节点样式
|
|
91
|
+
*/
|
|
92
|
+
customStyle: makeStringProp(''),
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* 自定义根节点样式类
|
|
96
|
+
*/
|
|
97
|
+
customClass: makeStringProp('')
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type CountDownProps = ExtractPropTypes<typeof countToProps>
|
|
101
|
+
|
|
102
|
+
export type CountUpExpose = {
|
|
103
|
+
/**
|
|
104
|
+
* 开始倒计时
|
|
105
|
+
*/
|
|
106
|
+
start: () => void
|
|
107
|
+
/**
|
|
108
|
+
* 暂停倒计时
|
|
109
|
+
*/
|
|
110
|
+
pause: () => void
|
|
111
|
+
/**
|
|
112
|
+
* 重设倒计时,若 auto-start 为 true,重设后会自动开始倒计时
|
|
113
|
+
*/
|
|
114
|
+
reset: () => void
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export type CountToInstance = ComponentPublicInstance<CountDownProps, CountUpExpose>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
@import "./../common/abstracts/_mixin.scss";
|
|
2
|
+
@import "./../common/abstracts/variable.scss";
|
|
3
|
+
|
|
4
|
+
@include b(curtain-wrapper){
|
|
5
|
+
:deep(.oxy-curtain){
|
|
6
|
+
display: inline-block;
|
|
7
|
+
border-radius: $-curtain-content-radius;
|
|
8
|
+
overflow-y: visible !important;
|
|
9
|
+
background: transparent;
|
|
10
|
+
font-size: 0;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@include b(curtain) {
|
|
16
|
+
|
|
17
|
+
@include e(content) {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: inline-block;
|
|
20
|
+
background: transparent;
|
|
21
|
+
border-radius: $-curtain-content-radius;
|
|
22
|
+
}
|
|
23
|
+
@include e(content-link) {
|
|
24
|
+
display: block;
|
|
25
|
+
border-radius: $-curtain-content-radius;
|
|
26
|
+
}
|
|
27
|
+
@include e(content-img) {
|
|
28
|
+
display: block;
|
|
29
|
+
width: auto;
|
|
30
|
+
height: auto;
|
|
31
|
+
border-radius: $-curtain-content-radius;
|
|
32
|
+
}
|
|
33
|
+
@include edeep(content-close) {
|
|
34
|
+
position: absolute;
|
|
35
|
+
margin: 0;
|
|
36
|
+
padding: 6px;
|
|
37
|
+
top: 10px;
|
|
38
|
+
right: 10px;
|
|
39
|
+
color: $-curtain-content-close-color;
|
|
40
|
+
font-size: $-curtain-content-close-fs;
|
|
41
|
+
-webkit-tap-highlight-color: transparent;
|
|
42
|
+
&.top {
|
|
43
|
+
margin: 0 0 0 -18px;
|
|
44
|
+
top: -62px;
|
|
45
|
+
right: unset;
|
|
46
|
+
left: 50%;
|
|
47
|
+
bottom: unset;
|
|
48
|
+
}
|
|
49
|
+
&.top-left {
|
|
50
|
+
margin: 0;
|
|
51
|
+
top: -62px;
|
|
52
|
+
right: unset;
|
|
53
|
+
left: -6px;
|
|
54
|
+
bottom: unset;
|
|
55
|
+
}
|
|
56
|
+
&.top-right {
|
|
57
|
+
margin: 0;
|
|
58
|
+
top: -62px;
|
|
59
|
+
right: -6px;
|
|
60
|
+
left: unset;
|
|
61
|
+
bottom: unset;
|
|
62
|
+
}
|
|
63
|
+
&.bottom {
|
|
64
|
+
margin: 0 0 0 -18px;
|
|
65
|
+
top: unset;
|
|
66
|
+
right: unset;
|
|
67
|
+
left: 50%;
|
|
68
|
+
bottom: -62px;
|
|
69
|
+
}
|
|
70
|
+
&.bottom-left {
|
|
71
|
+
margin: 0;
|
|
72
|
+
top: unset;
|
|
73
|
+
right: unset;
|
|
74
|
+
left: -6px;
|
|
75
|
+
bottom: -62px;
|
|
76
|
+
}
|
|
77
|
+
&.bottom-right {
|
|
78
|
+
margin: 0;
|
|
79
|
+
top: unset;
|
|
80
|
+
right: -6px;
|
|
81
|
+
left: unset;
|
|
82
|
+
bottom: -62px;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="oxy-curtain-wrapper">
|
|
3
|
+
<oxy-popup
|
|
4
|
+
v-model="modelValue"
|
|
5
|
+
transition="zoom-in"
|
|
6
|
+
position="center"
|
|
7
|
+
:close-on-click-modal="closeOnClickModal"
|
|
8
|
+
:hide-when-close="hideWhenClose"
|
|
9
|
+
:z-index="zIndex"
|
|
10
|
+
:root-portal="rootPortal"
|
|
11
|
+
@before-enter="beforeenter"
|
|
12
|
+
@enter="enter"
|
|
13
|
+
@after-enter="afterenter"
|
|
14
|
+
@before-leave="beforeleave"
|
|
15
|
+
@leave="leave"
|
|
16
|
+
@after-leave="afterleave"
|
|
17
|
+
@close="close"
|
|
18
|
+
@click-modal="clickModal"
|
|
19
|
+
:custom-class="`oxy-curtain ${customClass}`"
|
|
20
|
+
:custom-style="customStyle"
|
|
21
|
+
>
|
|
22
|
+
<view class="oxy-curtain__content">
|
|
23
|
+
<image
|
|
24
|
+
:src="src"
|
|
25
|
+
class="oxy-curtain__content-img"
|
|
26
|
+
:style="imgStyle"
|
|
27
|
+
:show-menu-by-longpress="showMenuByLongpress"
|
|
28
|
+
@click="clickImage"
|
|
29
|
+
@error="imgErr"
|
|
30
|
+
@load="imgLoad"
|
|
31
|
+
></image>
|
|
32
|
+
<slot name="close">
|
|
33
|
+
<oxy-icon
|
|
34
|
+
name="close-outline"
|
|
35
|
+
:custom-class="`oxy-curtain__content-close ${closePosition} ${customCloseClass}`"
|
|
36
|
+
:custom-style="customCloseStyle"
|
|
37
|
+
@click="close"
|
|
38
|
+
/>
|
|
39
|
+
</slot>
|
|
40
|
+
</view>
|
|
41
|
+
</oxy-popup>
|
|
42
|
+
</view>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script lang="ts">
|
|
46
|
+
export default {
|
|
47
|
+
name: 'oxy-curtain',
|
|
48
|
+
options: {
|
|
49
|
+
virtualHost: true,
|
|
50
|
+
addGlobalClass: true,
|
|
51
|
+
styleIsolation: 'shared'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<script lang="ts" setup>
|
|
57
|
+
import OxyIcon from '../oxy-icon/oxy-icon.vue'
|
|
58
|
+
import OxyPopup from '../oxy-popup/oxy-popup.vue'
|
|
59
|
+
import { computed, ref, watch } from 'vue'
|
|
60
|
+
import { curtainProps } from './types'
|
|
61
|
+
|
|
62
|
+
const props = defineProps(curtainProps)
|
|
63
|
+
const emit = defineEmits([
|
|
64
|
+
'beforeenter',
|
|
65
|
+
'enter',
|
|
66
|
+
'afterenter',
|
|
67
|
+
'beforeleave',
|
|
68
|
+
'leave',
|
|
69
|
+
'afterleave',
|
|
70
|
+
'close',
|
|
71
|
+
'closed',
|
|
72
|
+
'click-modal',
|
|
73
|
+
'load',
|
|
74
|
+
'error',
|
|
75
|
+
'click',
|
|
76
|
+
'update:modelValue'
|
|
77
|
+
])
|
|
78
|
+
|
|
79
|
+
const modelValue = ref(props.modelValue || props.value)
|
|
80
|
+
|
|
81
|
+
watch(
|
|
82
|
+
() => props.modelValue,
|
|
83
|
+
(newVal) => {
|
|
84
|
+
modelValue.value = newVal
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
watch(
|
|
89
|
+
() => props.value,
|
|
90
|
+
(newVal) => {
|
|
91
|
+
modelValue.value = newVal
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
watch(modelValue, (newVal) => {
|
|
96
|
+
emit('update:modelValue', newVal)
|
|
97
|
+
if (!newVal) {
|
|
98
|
+
emit('close')
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
const imgSucc = ref<boolean>(true)
|
|
103
|
+
const imgScale = ref<number>(1)
|
|
104
|
+
|
|
105
|
+
const imgStyle = computed(() => {
|
|
106
|
+
let style = ''
|
|
107
|
+
if (props.width) {
|
|
108
|
+
style += `width: ${props.width}px ;`
|
|
109
|
+
style += `height: ${props.width / imgScale.value}px`
|
|
110
|
+
}
|
|
111
|
+
return style
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
function beforeenter() {
|
|
115
|
+
emit('beforeenter')
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function enter() {
|
|
119
|
+
emit('enter')
|
|
120
|
+
}
|
|
121
|
+
function afterenter() {
|
|
122
|
+
emit('afterenter')
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function beforeleave() {
|
|
126
|
+
emit('beforeleave')
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function leave() {
|
|
130
|
+
emit('leave')
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function afterleave() {
|
|
134
|
+
emit('afterleave')
|
|
135
|
+
emit('closed')
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function close() {
|
|
139
|
+
modelValue.value = false
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function clickModal() {
|
|
143
|
+
emit('click-modal')
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function imgLoad(event: any) {
|
|
147
|
+
const { height, width } = event.detail
|
|
148
|
+
imgScale.value = width / height
|
|
149
|
+
imgSucc.value = true
|
|
150
|
+
emit('load')
|
|
151
|
+
}
|
|
152
|
+
function imgErr() {
|
|
153
|
+
imgSucc.value = false
|
|
154
|
+
emit('error')
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function clickImage() {
|
|
158
|
+
if (props.to) {
|
|
159
|
+
uni.navigateTo({
|
|
160
|
+
url: props.to
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
emit('click')
|
|
164
|
+
if (props.closeOnClick) {
|
|
165
|
+
close()
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
</script>
|
|
169
|
+
|
|
170
|
+
<style lang="scss" scoped>
|
|
171
|
+
@import './index.scss';
|
|
172
|
+
</style>
|