hy-app 0.1.1 → 0.1.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/README.md +1 -1
- package/api/http.ts +8 -8
- package/components/dialog/index.ts +2 -2
- package/components/hy-address-picker/hy-address-picker.vue +14 -42
- package/components/hy-address-picker/index.scss +27 -0
- package/components/hy-address-picker/props.ts +2 -3
- package/components/hy-address-picker/typing.d.ts +1 -2
- package/components/hy-avatar/hy-avatar.vue +10 -54
- package/components/hy-avatar/index.scss +45 -0
- package/components/hy-avatar/props.ts +2 -2
- package/components/hy-avatar/typing.d.ts +2 -2
- package/components/hy-back-top/hy-back-top.vue +7 -22
- package/components/hy-back-top/index.scss +16 -0
- package/components/hy-back-top/props.ts +4 -4
- package/components/hy-back-top/typing.d.ts +2 -3
- package/components/hy-badge/hy-badge.vue +5 -75
- package/components/hy-badge/index.scss +72 -0
- package/components/hy-badge/props.ts +2 -2
- package/components/hy-badge/typing.d.ts +2 -2
- package/components/hy-button/hy-button.vue +22 -134
- package/components/hy-button/index.scss +116 -0
- package/components/hy-button/props.ts +4 -5
- package/components/hy-button/typing.d.ts +3 -3
- package/components/hy-calendar/header.vue +76 -0
- package/components/hy-calendar/hy-calendar.vue +366 -0
- package/components/hy-calendar/index.scss +171 -0
- package/components/hy-calendar/month.vue +524 -0
- package/components/hy-calendar/props.ts +37 -0
- package/components/hy-calendar/typing.d.ts +126 -0
- package/components/hy-card/hy-card.vue +21 -84
- package/components/hy-card/index.scss +57 -0
- package/components/hy-card/props.ts +2 -2
- package/components/hy-card/typing.d.ts +1 -1
- package/components/hy-cell/hy-cell.vue +30 -131
- package/components/hy-cell/index.scss +137 -0
- package/components/hy-cell/props.ts +2 -2
- package/components/hy-cell/typing.d.ts +4 -3
- package/components/hy-check-button/hy-check-button.vue +14 -7
- package/components/hy-check-button/index.scss +5 -0
- package/components/hy-check-button/props.ts +3 -3
- package/components/hy-checkbox/hy-checkbox.vue +24 -107
- package/components/hy-checkbox/index.scss +94 -0
- package/components/hy-checkbox/props.ts +4 -5
- package/components/hy-checkbox/typing.d.ts +3 -7
- package/components/hy-count-down/hy-count-down.vue +150 -0
- package/components/hy-count-down/index.scss +6 -0
- package/components/hy-count-down/index.ts +52 -0
- package/components/hy-count-down/props.ts +10 -0
- package/components/hy-count-down/typing.d.ts +20 -0
- package/components/hy-count-to/hy-count-to.vue +213 -0
- package/components/hy-count-to/index.scss +6 -0
- package/components/hy-count-to/props.ts +17 -0
- package/components/hy-count-to/typing.d.ts +48 -0
- package/components/hy-datetime-picker/hy-datetime-picker.vue +38 -64
- package/components/hy-datetime-picker/index.scss +28 -0
- package/components/hy-datetime-picker/props.ts +2 -2
- package/components/hy-datetime-picker/typing.d.ts +1 -1
- package/components/hy-divider/hy-divider.vue +24 -49
- package/components/hy-divider/index.scss +25 -0
- package/components/hy-divider/props.ts +2 -2
- package/components/hy-divider/typing.d.ts +1 -1
- package/components/hy-dropdown/hy-dropdown.vue +43 -0
- package/components/hy-dropdown/index.scss +17 -0
- package/components/hy-dropdown/props.ts +17 -0
- package/components/hy-dropdown/typing.d.ts +48 -0
- package/components/hy-dropdown-item/hy-dropdown-item.vue +194 -0
- package/components/hy-dropdown-item/index.scss +96 -0
- package/components/hy-dropdown-item/props.ts +10 -0
- package/components/hy-dropdown-item/typing.d.ts +31 -0
- package/components/hy-empty/hy-empty.vue +8 -26
- package/components/hy-empty/index.scss +19 -0
- package/components/hy-empty/props.ts +2 -2
- package/components/hy-empty/typing.d.ts +1 -1
- package/components/hy-float-button/hy-float-button.vue +201 -0
- package/components/hy-float-button/index.scss +69 -0
- package/components/hy-float-button/props.ts +25 -0
- package/components/hy-float-button/typing.d.ts +93 -0
- package/components/hy-folding-panel/hy-folding-panel.vue +9 -12
- package/components/hy-folding-panel/index.scss +6 -0
- package/components/hy-folding-panel/props.ts +2 -2
- package/components/hy-folding-panel/typing.d.ts +2 -2
- package/components/hy-form/hy-form.vue +22 -39
- package/components/hy-form/index.scss +30 -0
- package/components/hy-form/props.ts +4 -2
- package/components/hy-form/typing.d.ts +10 -2
- package/components/hy-grid/hy-grid.vue +4 -45
- package/components/hy-grid/index.scss +40 -0
- package/components/hy-grid/props.ts +5 -5
- package/components/hy-grid/typing.d.ts +2 -2
- package/components/hy-icon/hy-icon.vue +7 -97
- package/components/hy-icon/index.scss +84 -0
- package/components/hy-icon/props.ts +5 -5
- package/components/hy-image/hy-image.vue +212 -0
- package/components/hy-image/index.scss +26 -0
- package/components/hy-image/props.ts +24 -0
- package/components/hy-image/typing.d.ts +76 -0
- package/components/hy-input/hy-input.vue +11 -82
- package/components/hy-input/index.scss +65 -0
- package/components/hy-input/props.ts +2 -2
- package/components/hy-input/typing.d.ts +2 -2
- package/components/hy-line/hy-line.vue +4 -8
- package/components/hy-line/index.scss +5 -0
- package/components/hy-line/props.ts +3 -3
- package/components/hy-line/typing.d.ts +2 -2
- package/components/hy-line-progress/hy-line-progress.vue +15 -44
- package/components/hy-line-progress/index.scss +38 -0
- package/components/hy-line-progress/props.ts +2 -2
- package/components/hy-line-progress/typing.d.ts +1 -1
- package/components/hy-list/hy-list.vue +11 -41
- package/components/hy-list/index.scss +32 -0
- package/components/hy-list/props.ts +2 -2
- package/components/hy-loading/hy-loading.vue +95 -0
- package/components/hy-loading/index.scss +103 -0
- package/components/hy-loading/props.ts +17 -0
- package/components/hy-loading/typing.d.ts +52 -0
- package/components/hy-login/TheUserLogin.vue +16 -16
- package/components/hy-login/hy-login.vue +9 -9
- package/components/hy-login/props.ts +4 -4
- package/components/hy-modal/hy-modal.vue +11 -89
- package/components/hy-modal/index.scss +77 -0
- package/components/hy-modal/props.ts +2 -2
- package/components/hy-modal/typing.d.ts +1 -1
- package/components/hy-navbar/hy-navbar.vue +20 -92
- package/components/hy-navbar/index.scss +67 -0
- package/components/hy-navbar/props.ts +2 -2
- package/components/hy-navbar/typing.d.ts +1 -1
- package/components/hy-notice-bar/hy-column-notice.vue +11 -39
- package/components/hy-notice-bar/hy-notice-bar.vue +10 -12
- package/components/hy-notice-bar/hy-row-notice.vue +5 -56
- package/components/hy-notice-bar/index.scss +93 -0
- package/components/hy-notice-bar/props.ts +4 -2
- package/components/hy-notice-bar/typing.d.ts +13 -3
- package/components/hy-number-step/hy-number-step.vue +55 -105
- package/components/hy-number-step/index.scss +71 -0
- package/components/hy-number-step/props.ts +2 -2
- package/components/hy-number-step/typing.d.ts +1 -1
- package/components/hy-overlay/hy-overlay.vue +5 -17
- package/components/hy-overlay/index.scss +9 -0
- package/components/hy-overlay/props.ts +2 -2
- package/components/hy-overlay/typing.d.ts +1 -1
- package/components/hy-picker/hy-picker.vue +21 -87
- package/components/hy-picker/index.scss +68 -0
- package/components/hy-picker/props.ts +3 -2
- package/components/hy-picker/typing.d.ts +5 -1
- package/components/hy-popup/hy-popup.vue +7 -80
- package/components/hy-popup/index.scss +60 -0
- package/components/hy-popup/props.ts +2 -2
- package/components/hy-popup/typing.d.ts +1 -1
- package/components/hy-price/hy-price.vue +5 -15
- package/components/hy-price/index.scss +11 -0
- package/components/hy-price/props.ts +2 -2
- package/components/hy-price/typing.d.ts +1 -1
- package/components/hy-qrcode/hy-qrcode.vue +15 -37
- package/components/hy-qrcode/index.scss +23 -0
- package/components/hy-qrcode/props.ts +2 -2
- package/components/hy-qrcode/typing.d.ts +2 -2
- package/components/hy-radio/hy-radio.vue +27 -113
- package/components/hy-radio/index.scss +93 -0
- package/components/hy-radio/props.ts +4 -4
- package/components/hy-radio/typing.d.ts +2 -2
- package/components/hy-rate/hy-rate.vue +33 -53
- package/components/hy-rate/index.scss +33 -0
- package/components/hy-rate/props.ts +4 -3
- package/components/hy-rate/typing.d.ts +1 -1
- package/components/hy-read-more/hy-read-more.vue +7 -30
- package/components/hy-read-more/index.scss +25 -0
- package/components/hy-read-more/props.ts +3 -3
- package/components/hy-read-more/typing.d.ts +1 -1
- package/components/hy-safe-bottom/hy-safe-bottom.vue +5 -9
- package/components/hy-safe-bottom/index.scss +5 -0
- package/components/hy-scroll-list/hy-scroll-list.vue +13 -43
- package/components/hy-scroll-list/index.scss +34 -0
- package/components/hy-scroll-list/props.ts +2 -2
- package/components/hy-scroll-list/typing.d.ts +1 -1
- package/components/hy-search/hy-search.vue +12 -94
- package/components/hy-search/index.scss +83 -0
- package/components/hy-search/props.ts +2 -2
- package/components/hy-search/typing.d.ts +1 -2
- package/components/hy-slider/hy-slider.vue +42 -119
- package/components/hy-slider/index.scss +77 -0
- package/components/hy-slider/props.ts +2 -2
- package/components/hy-status-bar/hy-status-bar.vue +41 -0
- package/components/hy-status-bar/index.scss +6 -0
- package/components/hy-status-bar/props.ts +8 -0
- package/components/hy-status-bar/typing.d.ts +12 -0
- package/components/hy-steps/hy-steps.vue +36 -163
- package/components/hy-steps/index.scss +131 -0
- package/components/hy-steps/props.ts +2 -2
- package/components/hy-steps/typing.d.ts +2 -2
- package/components/hy-subsection/hy-subsection.vue +62 -125
- package/components/hy-subsection/index.scss +82 -0
- package/components/hy-subsection/props.ts +7 -3
- package/components/hy-subsection/typing.d.ts +20 -8
- package/components/hy-swipe-action/hy-swipe-action.vue +294 -0
- package/components/hy-swipe-action/index.scss +9 -0
- package/components/hy-swipe-action/index.wxs +235 -0
- package/components/hy-swipe-action/props.ts +16 -0
- package/components/hy-swipe-action/typing.d.ts +55 -0
- package/components/hy-swipe-action/wxs.js +15 -0
- package/components/hy-swiper/hy-swiper-indicator.vue +5 -35
- package/components/hy-swiper/hy-swiper.vue +45 -65
- package/components/hy-swiper/index.scss +82 -0
- package/components/hy-swiper/props.ts +3 -3
- package/components/hy-swiper/typing.d.ts +7 -4
- package/components/hy-switch/hy-switch.vue +65 -68
- package/components/hy-switch/index.scss +46 -0
- package/components/hy-switch/props.ts +6 -3
- package/components/hy-switch/typing.d.ts +14 -1
- package/components/hy-tabs/hy-tabs.vue +22 -81
- package/components/hy-tabs/index.scss +63 -0
- package/components/hy-tabs/props.ts +5 -5
- package/components/hy-tabs/typing.d.ts +1 -1
- package/components/hy-tag/hy-tag.vue +15 -230
- package/components/hy-tag/index.scss +204 -0
- package/components/hy-tag/props.ts +2 -2
- package/components/hy-tag/typing.d.ts +2 -2
- package/components/hy-text/hy-text.vue +238 -0
- package/components/hy-text/index.scss +70 -0
- package/components/hy-text/index.ts +0 -0
- package/components/hy-text/props.ts +30 -0
- package/components/hy-text/typing.d.ts +98 -0
- package/components/hy-textarea/hy-textarea.vue +13 -51
- package/components/hy-textarea/index.scss +40 -0
- package/components/hy-textarea/props.ts +2 -2
- package/components/hy-textarea/typing.d.ts +1 -1
- package/components/hy-tooltip/hy-tooltip.vue +42 -95
- package/components/hy-tooltip/index.scss +64 -0
- package/components/hy-tooltip/props.ts +2 -2
- package/components/hy-tooltip/typing.d.ts +1 -1
- package/components/hy-transition/hy-transition.vue +17 -8
- package/components/hy-transition/props.ts +2 -2
- package/components/hy-transition/typing.d.ts +2 -14
- package/components/hy-upload/hy-upload.vue +37 -182
- package/components/hy-upload/index.scss +147 -0
- package/components/hy-upload/props.ts +2 -2
- package/components/hy-upload/typing.d.ts +11 -11
- package/components/hy-warn/hy-warn.vue +15 -123
- package/components/hy-warn/index.scss +109 -0
- package/components/hy-warn/props.ts +3 -3
- package/components/hy-warn/typing.d.ts +4 -3
- package/components/hy-waterfall/index.scss +82 -0
- package/components/index.ts +25 -1
- package/components/message/index.ts +54 -54
- package/config/color.ts +2 -1
- package/global/index.ts +6 -6
- package/global/register-properties.ts +2 -2
- package/index.scss +2 -0
- package/libs/css/common.scss +16 -0
- package/package.json +4 -4
- package/{libs/css → public/font}/iconfont.css +5 -5
- package/{libs/css → public/font}/iconfont.ttf +0 -0
- package/public/font/iconfont.woff +0 -0
- package/public/font/iconfont.woff2 +0 -0
- package/theme.scss +9 -7
- package/typing/index.ts +0 -1
- package/typing/modules/common.d.ts +66 -1
- package/typing/modules/form.ts +3 -3
- package/utils/calendar.js +1021 -0
- package/utils/colorGradient.ts +112 -0
- package/utils/index.ts +2 -0
- package/utils/inside.ts +80 -34
- package/utils/inspect.ts +66 -0
- package/utils/utils.ts +27 -19
- package/typing/modules/img.ts +0 -15
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="
|
|
2
|
+
<view class="hy-tooltip" :style="customStyle">
|
|
3
3
|
<HyOverlay
|
|
4
4
|
:show="showTooltip && tooltipTop !== -10000 && overlay"
|
|
5
5
|
:customStyle="{ backgroundColor: 'rgba(0, 0, 0, 0)' }"
|
|
6
6
|
@click="overlayClickHandler"
|
|
7
7
|
></HyOverlay>
|
|
8
|
-
<view class="
|
|
8
|
+
<view class="hy-tooltip__wrapper">
|
|
9
9
|
<text
|
|
10
|
-
class="
|
|
10
|
+
class="hy-tooltip__wrapper__text"
|
|
11
11
|
:id="textId"
|
|
12
12
|
:ref="textId"
|
|
13
13
|
:userSelect="false"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
backgroundColor:
|
|
19
19
|
bgColor && showTooltip && tooltipTop !== -10000
|
|
20
20
|
? bgColor
|
|
21
|
-
: 'transparent'
|
|
21
|
+
: 'transparent',
|
|
22
22
|
}"
|
|
23
23
|
>{{ text }}</text
|
|
24
24
|
>
|
|
@@ -30,36 +30,36 @@
|
|
|
30
30
|
position: 'absolute',
|
|
31
31
|
top: addUnit(tooltipTop),
|
|
32
32
|
zIndex: zIndex,
|
|
33
|
-
...tooltipStyle
|
|
33
|
+
...tooltipStyle,
|
|
34
34
|
}"
|
|
35
35
|
>
|
|
36
36
|
<view
|
|
37
|
-
class="
|
|
37
|
+
class="hy-tooltip__wrapper__popup"
|
|
38
38
|
:id="tooltipId"
|
|
39
39
|
:ref="tooltipId"
|
|
40
40
|
>
|
|
41
41
|
<view
|
|
42
42
|
v-if="showCopy || buttons.length"
|
|
43
|
-
class="
|
|
44
|
-
hover-class="
|
|
43
|
+
class="hy-tooltip__wrapper__popup__indicator"
|
|
44
|
+
hover-class="hy-tooltip__wrapper__popup__indicator--hover"
|
|
45
45
|
:style="[
|
|
46
46
|
indicatorStyle,
|
|
47
47
|
{
|
|
48
48
|
width: addUnit(indicatorWidth),
|
|
49
|
-
height: addUnit(indicatorWidth)
|
|
50
|
-
}
|
|
49
|
+
height: addUnit(indicatorWidth),
|
|
50
|
+
},
|
|
51
51
|
]"
|
|
52
52
|
>
|
|
53
53
|
<!-- 由于nvue不支持三角形绘制,这里就做一个四方形,再旋转45deg,得到露出的一个三角 -->
|
|
54
54
|
</view>
|
|
55
|
-
<view class="
|
|
55
|
+
<view class="hy-tooltip__wrapper__popup__list">
|
|
56
56
|
<view
|
|
57
57
|
v-if="showCopy"
|
|
58
|
-
class="
|
|
59
|
-
hover-class="
|
|
58
|
+
class="hy-tooltip__wrapper__popup__list__btn"
|
|
59
|
+
hover-class="hy-tooltip__wrapper__popup__list__btn--hover"
|
|
60
60
|
@tap="setClipboardData"
|
|
61
61
|
>
|
|
62
|
-
<text class="
|
|
62
|
+
<text class="hy-tooltip__wrapper__popup__list__btn__text"
|
|
63
63
|
>复制</text
|
|
64
64
|
>
|
|
65
65
|
</view>
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
></HyLine>
|
|
72
72
|
<block v-for="(item, index) in buttons" :key="index">
|
|
73
73
|
<view
|
|
74
|
-
class="
|
|
75
|
-
hover-class="
|
|
74
|
+
class="hy-tooltip__wrapper__popup__list__btn"
|
|
75
|
+
hover-class="hy-tooltip__wrapper__popup__list__btn--hover"
|
|
76
76
|
>
|
|
77
77
|
<text
|
|
78
|
-
class="
|
|
78
|
+
class="hy-tooltip__wrapper__popup__list__btn__text"
|
|
79
79
|
@tap="btnClickHandler(index)"
|
|
80
80
|
>{{ item }}</text
|
|
81
81
|
>
|
|
@@ -95,9 +95,15 @@
|
|
|
95
95
|
</template>
|
|
96
96
|
|
|
97
97
|
<script setup lang="ts">
|
|
98
|
-
import {
|
|
98
|
+
import {
|
|
99
|
+
computed,
|
|
100
|
+
type CSSProperties,
|
|
101
|
+
toRefs,
|
|
102
|
+
ref,
|
|
103
|
+
onMounted, getCurrentInstance,
|
|
104
|
+
} from "vue";
|
|
99
105
|
import defaultProps from "./props";
|
|
100
|
-
import IProps from "./typing";
|
|
106
|
+
import type IProps from "./typing";
|
|
101
107
|
import { addUnit, getRect, guid, sleep } from "../../utils";
|
|
102
108
|
|
|
103
109
|
// 组件
|
|
@@ -110,6 +116,7 @@ const { showToast, copyText, text, showCopy, buttons, direction } =
|
|
|
110
116
|
toRefs(props);
|
|
111
117
|
const emit = defineEmits(["click"]);
|
|
112
118
|
|
|
119
|
+
const instance = getCurrentInstance();
|
|
113
120
|
const showTooltip = ref<boolean>(true);
|
|
114
121
|
const textId = ref(guid());
|
|
115
122
|
const tooltipId = ref(guid());
|
|
@@ -117,17 +124,17 @@ const tooltipTop = ref<number>(-10000);
|
|
|
117
124
|
// 气泡的位置信息
|
|
118
125
|
const tooltipInfo = ref<UniApp.NodeInfo>({
|
|
119
126
|
width: 0,
|
|
120
|
-
left: 0
|
|
127
|
+
left: 0,
|
|
121
128
|
});
|
|
122
129
|
const textInfo = ref<UniApp.NodeInfo>({
|
|
123
130
|
width: 0,
|
|
124
131
|
left: 0,
|
|
125
|
-
right: 0
|
|
132
|
+
right: 0,
|
|
126
133
|
});
|
|
127
134
|
// 三角形指示器的样式
|
|
128
135
|
const indicatorStyle = ref<CSSProperties>({
|
|
129
136
|
left: 0,
|
|
130
|
-
right: 0
|
|
137
|
+
right: 0,
|
|
131
138
|
});
|
|
132
139
|
// 气泡在可能超出屏幕边沿范围时,重新定位后,距离屏幕边沿的距离
|
|
133
140
|
const screenGap = ref(12);
|
|
@@ -142,7 +149,7 @@ const propsChange = computed(() => {
|
|
|
142
149
|
// 计算气泡和指示器的位置信息
|
|
143
150
|
const tooltipStyle = computed(() => {
|
|
144
151
|
const style: CSSProperties = {
|
|
145
|
-
transform: `translateY(${direction.value === "top" ? "-100%" : "100%"})
|
|
152
|
+
transform: `translateY(${direction.value === "top" ? "-100%" : "100%"})`,
|
|
146
153
|
},
|
|
147
154
|
// #ifdef APP || H5 || MP-WEIXIN
|
|
148
155
|
sysInfo = uni.getWindowInfo();
|
|
@@ -154,7 +161,7 @@ const tooltipStyle = computed(() => {
|
|
|
154
161
|
indicatorStyle.value = {};
|
|
155
162
|
style.left = `-${addUnit(textInfo.value.left! - screenGap.value)}`;
|
|
156
163
|
indicatorStyle.value.left = addUnit(
|
|
157
|
-
textInfo.value.width! / 2 - Number(style.left) - indicatorWidth.value / 2
|
|
164
|
+
textInfo.value.width! / 2 - Number(style.left) - indicatorWidth.value / 2,
|
|
158
165
|
);
|
|
159
166
|
} else if (
|
|
160
167
|
tooltipInfo.value.width! / 2 >
|
|
@@ -165,14 +172,16 @@ const tooltipStyle = computed(() => {
|
|
|
165
172
|
) {
|
|
166
173
|
indicatorStyle.value = {};
|
|
167
174
|
style.right = `-${addUnit(
|
|
168
|
-
sysInfo.windowWidth - textInfo.value.right! - screenGap.value
|
|
175
|
+
sysInfo.windowWidth - textInfo.value.right! - screenGap.value,
|
|
169
176
|
)}`;
|
|
170
177
|
indicatorStyle.value.right = addUnit(
|
|
171
|
-
textInfo.value.width! / 2 -
|
|
178
|
+
textInfo.value.width! / 2 -
|
|
179
|
+
Number(style.right) -
|
|
180
|
+
indicatorWidth.value / 2,
|
|
172
181
|
);
|
|
173
182
|
} else {
|
|
174
183
|
const left = Math.abs(
|
|
175
|
-
textInfo.value.width! / 2 - tooltipInfo.value.width! / 2
|
|
184
|
+
textInfo.value.width! / 2 - tooltipInfo.value.width! / 2,
|
|
176
185
|
);
|
|
177
186
|
style.left =
|
|
178
187
|
textInfo.value.width! > tooltipInfo.value.width!
|
|
@@ -226,12 +235,12 @@ const getElRect = () => {
|
|
|
226
235
|
showTooltip.value = true;
|
|
227
236
|
tooltipTop.value = -10000;
|
|
228
237
|
sleep(500).then(() => {
|
|
229
|
-
getRect(`#${tooltipId.value}
|
|
238
|
+
getRect(`#${tooltipId.value}`, false, instance).then((size) => {
|
|
230
239
|
tooltipInfo.value = size as UniApp.NodeInfo;
|
|
231
240
|
// 获取气泡尺寸之后,将其隐藏,为了让下次切换气泡显示与隐藏时,有淡入淡出的效果
|
|
232
241
|
showTooltip.value = false;
|
|
233
242
|
});
|
|
234
|
-
getRect(`#${textId.value}
|
|
243
|
+
getRect(`#${textId.value}`, false, instance).then((size) => {
|
|
235
244
|
textInfo.value = size as UniApp.NodeInfo;
|
|
236
245
|
});
|
|
237
246
|
});
|
|
@@ -249,84 +258,22 @@ const setClipboardData = () => {
|
|
|
249
258
|
success: () => {
|
|
250
259
|
showToast.value &&
|
|
251
260
|
uni.showToast({
|
|
252
|
-
title: "复制成功"
|
|
261
|
+
title: "复制成功",
|
|
253
262
|
});
|
|
254
263
|
},
|
|
255
264
|
fail: () => {
|
|
256
265
|
showToast.value &&
|
|
257
266
|
uni.showToast({
|
|
258
|
-
title: "复制失败"
|
|
267
|
+
title: "复制失败",
|
|
259
268
|
});
|
|
260
269
|
},
|
|
261
270
|
complete: () => {
|
|
262
271
|
showTooltip.value = false;
|
|
263
|
-
}
|
|
272
|
+
},
|
|
264
273
|
});
|
|
265
274
|
};
|
|
266
275
|
</script>
|
|
267
276
|
|
|
268
277
|
<style lang="scss" scoped>
|
|
269
|
-
@import "
|
|
270
|
-
|
|
271
|
-
.u-tooltip {
|
|
272
|
-
position: relative;
|
|
273
|
-
@include flex;
|
|
274
|
-
|
|
275
|
-
&__wrapper {
|
|
276
|
-
@include flex;
|
|
277
|
-
justify-content: center;
|
|
278
|
-
/* #ifndef APP-NVUE */
|
|
279
|
-
white-space: nowrap;
|
|
280
|
-
/* #endif */
|
|
281
|
-
|
|
282
|
-
&__text {
|
|
283
|
-
font-size: 14px;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
&__popup {
|
|
287
|
-
@include flex;
|
|
288
|
-
justify-content: center;
|
|
289
|
-
|
|
290
|
-
&__list {
|
|
291
|
-
background-color: #060607;
|
|
292
|
-
position: relative;
|
|
293
|
-
flex: 1;
|
|
294
|
-
border-radius: 5px;
|
|
295
|
-
padding: 0px 0;
|
|
296
|
-
@include flex(row);
|
|
297
|
-
align-items: center;
|
|
298
|
-
overflow: hidden;
|
|
299
|
-
|
|
300
|
-
&__btn {
|
|
301
|
-
padding: 11px 13px;
|
|
302
|
-
|
|
303
|
-
&--hover {
|
|
304
|
-
background-color: #58595b;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
&__text {
|
|
308
|
-
line-height: 12px;
|
|
309
|
-
font-size: 13px;
|
|
310
|
-
color: #ffffff;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
&__indicator {
|
|
316
|
-
position: absolute;
|
|
317
|
-
background-color: #060607;
|
|
318
|
-
width: 14px;
|
|
319
|
-
height: 14px;
|
|
320
|
-
bottom: -4px;
|
|
321
|
-
transform: rotate(45deg);
|
|
322
|
-
border-radius: 2px;
|
|
323
|
-
z-index: -1;
|
|
324
|
-
|
|
325
|
-
&--hover {
|
|
326
|
-
background-color: #58595b;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
278
|
+
@import "./index.scss";
|
|
332
279
|
</style>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
@use "../../theme.scss" as *;
|
|
2
|
+
@use "../../libs/css/mixin.scss" as *;
|
|
3
|
+
|
|
4
|
+
.hy-tooltip {
|
|
5
|
+
position: relative;
|
|
6
|
+
@include flex;
|
|
7
|
+
|
|
8
|
+
&__wrapper {
|
|
9
|
+
@include flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
/* #ifndef APP-NVUE */
|
|
12
|
+
white-space: nowrap;
|
|
13
|
+
/* #endif */
|
|
14
|
+
|
|
15
|
+
&__text {
|
|
16
|
+
font-size: 14px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__popup {
|
|
20
|
+
@include flex;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
|
|
23
|
+
&__list {
|
|
24
|
+
background-color: #060607;
|
|
25
|
+
position: relative;
|
|
26
|
+
flex: 1;
|
|
27
|
+
border-radius: $hy-border-radius-sm;
|
|
28
|
+
padding: 0;
|
|
29
|
+
@include flex(row);
|
|
30
|
+
align-items: center;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
|
|
33
|
+
&__btn {
|
|
34
|
+
padding: $hy-border-margin-padding-base;
|
|
35
|
+
|
|
36
|
+
&--hover {
|
|
37
|
+
background-color: #58595b;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__text {
|
|
41
|
+
line-height: 12px;
|
|
42
|
+
font-size: 13px;
|
|
43
|
+
color: #ffffff;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&__indicator {
|
|
49
|
+
position: absolute;
|
|
50
|
+
background-color: #060607;
|
|
51
|
+
width: 14px;
|
|
52
|
+
height: 14px;
|
|
53
|
+
bottom: -4px;
|
|
54
|
+
transform: rotate(45deg);
|
|
55
|
+
border-radius: 2px;
|
|
56
|
+
z-index: -1;
|
|
57
|
+
|
|
58
|
+
&--hover {
|
|
59
|
+
background-color: #58595b;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import IProps from "./typing";
|
|
1
|
+
import type IProps from "./typing";
|
|
2
2
|
|
|
3
3
|
const defaultProps: IProps = {
|
|
4
4
|
text: "",
|
|
@@ -11,7 +11,7 @@ const defaultProps: IProps = {
|
|
|
11
11
|
showCopy: true,
|
|
12
12
|
buttons: [],
|
|
13
13
|
overlay: true,
|
|
14
|
-
showToast: true
|
|
14
|
+
showToast: true,
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export default defaultProps;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
v-if="hasInit"
|
|
4
4
|
class="hy-transition"
|
|
5
5
|
ref="u-transition"
|
|
6
|
-
@tap="clickHandler"
|
|
6
|
+
@tap.stop="clickHandler"
|
|
7
7
|
:class="classes"
|
|
8
8
|
:style="[mergeStyle]"
|
|
9
9
|
>
|
|
@@ -12,10 +12,17 @@
|
|
|
12
12
|
</template>
|
|
13
13
|
|
|
14
14
|
<script setup lang="ts">
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
computed,
|
|
17
|
+
type CSSProperties,
|
|
18
|
+
ref,
|
|
19
|
+
watch,
|
|
20
|
+
nextTick,
|
|
21
|
+
toRefs,
|
|
22
|
+
} from "vue";
|
|
16
23
|
import { sleep } from "../../utils";
|
|
17
24
|
import defaultProps from "./props";
|
|
18
|
-
import IProps from "./typing";
|
|
25
|
+
import type IProps from "./typing";
|
|
19
26
|
|
|
20
27
|
const props = withDefaults(defineProps<IProps>(), defaultProps);
|
|
21
28
|
const { show, mode, duration } = toRefs(props);
|
|
@@ -26,7 +33,7 @@ const emit = defineEmits([
|
|
|
26
33
|
"afterEnter",
|
|
27
34
|
"beforeLeave",
|
|
28
35
|
"leave",
|
|
29
|
-
"afterLeave"
|
|
36
|
+
"afterLeave",
|
|
30
37
|
]);
|
|
31
38
|
|
|
32
39
|
const hasInit = ref<boolean>(false); // 是否显示/隐藏组件
|
|
@@ -42,7 +49,7 @@ const getClassNames = (name: string) => ({
|
|
|
42
49
|
enter: `u-${name}-enter u-${name}-enter-active`,
|
|
43
50
|
"enter-to": `u-${name}-enter-to u-${name}-enter-active`,
|
|
44
51
|
leave: `u-${name}-leave u-${name}-leave-active`,
|
|
45
|
-
"leave-to": `u-${name}-leave-to u-${name}-leave-active
|
|
52
|
+
"leave-to": `u-${name}-leave-to u-${name}-leave-active`,
|
|
46
53
|
});
|
|
47
54
|
// #endif
|
|
48
55
|
|
|
@@ -104,7 +111,7 @@ watch(
|
|
|
104
111
|
newVal ? vueEnter() : vueLeave();
|
|
105
112
|
// #endif
|
|
106
113
|
},
|
|
107
|
-
{ immediate: true }
|
|
114
|
+
{ immediate: true },
|
|
108
115
|
);
|
|
109
116
|
|
|
110
117
|
const mergeStyle = computed(() => {
|
|
@@ -117,11 +124,13 @@ const mergeStyle = computed(() => {
|
|
|
117
124
|
// #endif
|
|
118
125
|
// 避免自定义样式影响到动画属性,所以写在viewStyle前面
|
|
119
126
|
...customStyle,
|
|
120
|
-
...viewStyle
|
|
127
|
+
...viewStyle,
|
|
121
128
|
};
|
|
122
129
|
});
|
|
123
130
|
|
|
124
|
-
|
|
131
|
+
/**
|
|
132
|
+
* @description 组件被点击发出事件
|
|
133
|
+
* */
|
|
125
134
|
const clickHandler = () => {
|
|
126
135
|
emit("click");
|
|
127
136
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties } from "vue";
|
|
1
|
+
import type { CSSProperties } from "vue";
|
|
2
2
|
|
|
3
3
|
export default interface IProps {
|
|
4
4
|
/**
|
|
@@ -8,19 +8,7 @@ export default interface IProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* @description 使用的动画模式(默认:fade)
|
|
10
10
|
* */
|
|
11
|
-
mode?:
|
|
12
|
-
| "fade"
|
|
13
|
-
| "fade-up"
|
|
14
|
-
| "fade-down"
|
|
15
|
-
| "fade-left"
|
|
16
|
-
| "fade-right"
|
|
17
|
-
| "fade-zoom"
|
|
18
|
-
| "slide-up"
|
|
19
|
-
| "slide-down"
|
|
20
|
-
| "slide-left"
|
|
21
|
-
| "slide-right"
|
|
22
|
-
| "zoom-in"
|
|
23
|
-
| "zoom-out";
|
|
11
|
+
mode?: HyApp.TransitionMode;
|
|
24
12
|
/**
|
|
25
13
|
* @description 动画的执行时间,单位ms
|
|
26
14
|
* */
|