hy-app 0.3.16 → 0.4.0
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/hy-action-sheet/hy-action-sheet.vue +2 -2
- package/components/hy-action-sheet/typing.d.ts +32 -33
- package/components/hy-back-top/hy-back-top.vue +36 -32
- package/components/hy-button/hy-button.vue +7 -7
- package/components/hy-button/typing.d.ts +39 -40
- package/components/hy-calendar/index.scss +1 -1
- package/components/hy-card/hy-card.vue +3 -3
- package/components/hy-cell/hy-cell.vue +125 -118
- package/components/hy-cell/index.scss +7 -7
- package/components/hy-checkbox/hy-checkbox.vue +17 -16
- package/components/hy-checkbox/index.scss +1 -1
- package/components/hy-checkbox-item/hy-checkbox-item.vue +25 -30
- package/components/hy-checkbox-item/index.scss +1 -1
- package/components/hy-code-input/hy-code-input.vue +314 -314
- package/components/hy-code-input/index.scss +12 -12
- package/components/hy-count-down/index.scss +1 -1
- package/components/hy-datetime-picker/index.scss +1 -1
- package/components/hy-datetime-picker/typing.d.ts +0 -1
- package/components/hy-divider/index.scss +3 -3
- package/components/hy-dropdown-item/hy-dropdown-item.vue +2 -2
- package/components/hy-dropdown-item/index.scss +5 -5
- package/components/hy-float-button/hy-float-button.vue +1 -1
- package/components/hy-float-button/index.scss +9 -18
- package/components/hy-folding-panel/index.scss +1 -1
- package/components/hy-form-item/hy-form-item.vue +10 -11
- package/components/hy-grid/hy-grid.vue +23 -23
- package/components/hy-grid/index.scss +2 -8
- package/components/hy-icon/index.scss +8 -8
- package/components/hy-input/hy-input.vue +45 -44
- package/components/hy-input/index.scss +12 -11
- package/components/hy-line-progress/index.scss +3 -3
- package/components/hy-list/hy-list.vue +2 -2
- package/components/hy-list/index.scss +4 -4
- package/components/hy-loading/hy-loading.vue +2 -3
- package/components/hy-loading/index.scss +17 -15
- package/components/hy-menu/hy-menu.vue +38 -30
- package/components/hy-menu/index.scss +1 -1
- package/components/hy-menu/typing.d.ts +16 -12
- package/components/hy-modal/hy-modal.vue +11 -11
- package/components/hy-modal/index.scss +17 -17
- package/components/hy-modal/typing.d.ts +0 -2
- package/components/hy-navbar/hy-navbar.vue +3 -3
- package/components/hy-navbar/index.scss +10 -11
- package/components/hy-notice-bar/hy-column-notice.vue +2 -2
- package/components/hy-notice-bar/hy-row-notice.vue +3 -3
- package/components/hy-notice-bar/index.scss +9 -12
- package/components/hy-notify/hy-notify.vue +8 -5
- package/components/hy-notify/index.scss +2 -2
- package/components/hy-number-step/index.scss +9 -10
- package/components/hy-pagination/index.scss +7 -2
- package/components/hy-parse/index.scss +0 -9
- package/components/hy-picker/hy-picker.vue +1 -1
- package/components/hy-picker/index.scss +9 -16
- package/components/hy-popover/hy-popover.vue +6 -4
- package/components/hy-popup/hy-popup.vue +4 -2
- package/components/hy-popup/index.scss +45 -32
- package/components/hy-qrcode/hy-qrcode.vue +3 -3
- package/components/hy-qrcode/index.scss +18 -17
- package/components/hy-radio/hy-radio.vue +20 -18
- package/components/hy-radio/index.scss +26 -22
- package/components/hy-rate/hy-rate.vue +5 -5
- package/components/hy-rate/index.scss +4 -4
- package/components/hy-read-more/hy-read-more.vue +19 -20
- package/components/hy-read-more/index.scss +12 -6
- package/components/hy-scroll-list/hy-scroll-list.vue +3 -6
- package/components/hy-scroll-list/index.scss +4 -4
- package/components/hy-search/index.scss +9 -8
- package/components/hy-slider/hy-slider.vue +5 -5
- package/components/hy-slider/index.scss +12 -12
- package/components/hy-status-bar/index.scss +3 -1
- package/components/hy-steps/hy-steps.vue +50 -23
- package/components/hy-submit-bar/hy-submit-bar.vue +1 -1
- package/components/hy-submit-bar/index.scss +5 -4
- package/components/hy-subsection/hy-subsection.vue +3 -3
- package/components/hy-subsection/index.scss +7 -7
- package/components/hy-swipe-action/hy-swipe-action.vue +8 -8
- package/components/hy-swipe-action/index.scss +8 -4
- package/components/hy-swiper/hy-swiper-indicator.vue +2 -2
- package/components/hy-swiper/hy-swiper.vue +6 -6
- package/components/hy-swiper/index.scss +6 -10
- package/components/hy-switch/hy-switch.vue +4 -4
- package/components/hy-switch/index.scss +4 -22
- package/components/hy-tabs/hy-tabs.vue +16 -16
- package/components/hy-tabs/index.scss +16 -16
- package/components/hy-tag/index.scss +1 -1
- package/components/hy-text/index.scss +3 -3
- package/components/hy-textarea/hy-textarea.vue +11 -11
- package/components/hy-textarea/index.scss +11 -10
- package/components/hy-toast/hy-toast.vue +5 -5
- package/components/hy-toast/index.scss +8 -8
- package/components/hy-tooltip/hy-tooltip.vue +193 -183
- package/components/hy-tooltip/index.scss +69 -45
- package/components/hy-upload/hy-upload.vue +15 -10
- package/components/hy-upload/index.scss +37 -36
- package/components/hy-warn/hy-warn.vue +11 -11
- package/components/hy-warn/index.scss +76 -82
- package/components/hy-waterfall/index.scss +2 -1
- package/composables/usePopover.ts +2 -2
- package/libs/css/mixin.scss +0 -9
- package/package.json +2 -2
- package/utils/inside.ts +4 -1
- package/utils/utils.ts +187 -162
|
@@ -1,98 +1,126 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view
|
|
2
|
+
<view
|
|
3
|
+
:class="['hy-tooltip', customClass]"
|
|
4
|
+
:style="customStyle"
|
|
5
|
+
@click.stop="closeHandler"
|
|
6
|
+
>
|
|
3
7
|
<HyOverlay
|
|
4
8
|
:show="showTooltip && tooltipTop !== -10000 && overlay"
|
|
5
9
|
:customStyle="{ backgroundColor: 'rgba(0, 0, 0, 0)' }"
|
|
6
|
-
@click="
|
|
10
|
+
@click="closeHandler"
|
|
7
11
|
></HyOverlay>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
:customStyle="{
|
|
31
|
-
position: 'absolute',
|
|
32
|
-
top: addUnit(tooltipTop),
|
|
33
|
-
zIndex: zIndex,
|
|
34
|
-
...tooltipStyle,
|
|
35
|
-
}"
|
|
36
|
-
>
|
|
37
|
-
<view
|
|
38
|
-
class="hy-tooltip__wrapper__popup"
|
|
39
|
-
:id="tooltipId"
|
|
40
|
-
:ref="tooltipId"
|
|
41
|
-
>
|
|
12
|
+
<!-- 文本内容区域 -->
|
|
13
|
+
<view
|
|
14
|
+
class="hy-tooltip__content"
|
|
15
|
+
id="target"
|
|
16
|
+
@longpress.stop="longPressHandler"
|
|
17
|
+
@tap.stop="clickHandler"
|
|
18
|
+
:style="{
|
|
19
|
+
color: color,
|
|
20
|
+
backgroundColor:
|
|
21
|
+
bgColor && showTooltip && tooltipTop !== -10000
|
|
22
|
+
? bgColor
|
|
23
|
+
: 'transparent',
|
|
24
|
+
}"
|
|
25
|
+
>
|
|
26
|
+
<slot v-if="$slots.default"></slot>
|
|
27
|
+
<text class="hy-tooltip__content--text" v-else>{{ text }}</text>
|
|
28
|
+
</view>
|
|
29
|
+
|
|
30
|
+
<!-- 用于获取弹窗宽高 -->
|
|
31
|
+
<view class="hy-tooltip__popup hy-tooltip__hidden" id="pos">
|
|
32
|
+
<view class="hy-tooltip__container custom-pop">
|
|
33
|
+
<view class="hy-tooltip__container--list">
|
|
42
34
|
<view
|
|
43
|
-
v-if="showCopy
|
|
44
|
-
class="hy-
|
|
45
|
-
hover-class="hy-
|
|
46
|
-
|
|
47
|
-
indicatorStyle,
|
|
48
|
-
{
|
|
49
|
-
width: addUnit(indicatorWidth),
|
|
50
|
-
height: addUnit(indicatorWidth),
|
|
51
|
-
},
|
|
52
|
-
]"
|
|
35
|
+
v-if="showCopy"
|
|
36
|
+
class="hy-tooltip__container--list__btn"
|
|
37
|
+
hover-class="hy-tooltip__container--list__btn--hover"
|
|
38
|
+
@tap="setClipboardData"
|
|
53
39
|
>
|
|
54
|
-
|
|
40
|
+
<text class="hy-tooltip__container--list__btn--text">复制</text>
|
|
55
41
|
</view>
|
|
56
|
-
<
|
|
42
|
+
<HyLine
|
|
43
|
+
direction="column"
|
|
44
|
+
color="#8d8e90"
|
|
45
|
+
v-if="showCopy && buttons.length > 0"
|
|
46
|
+
length="18"
|
|
47
|
+
></HyLine>
|
|
48
|
+
<template v-for="(item, index) in buttons" :key="index">
|
|
57
49
|
<view
|
|
58
|
-
|
|
59
|
-
class="hy-
|
|
60
|
-
hover-class="hy-tooltip__wrapper__popup__list__btn--hover"
|
|
61
|
-
@tap="setClipboardData"
|
|
50
|
+
class="hy-tooltip__container--list__btn"
|
|
51
|
+
hover-class="hy-tooltip__container--list__btn--hover"
|
|
62
52
|
>
|
|
63
|
-
<text
|
|
64
|
-
|
|
53
|
+
<text
|
|
54
|
+
class="hy-tooltip__container--list__btn--text"
|
|
55
|
+
@tap="btnClickHandler(index)"
|
|
65
56
|
>
|
|
57
|
+
{{ item }}
|
|
58
|
+
</text>
|
|
66
59
|
</view>
|
|
67
60
|
<HyLine
|
|
68
61
|
direction="column"
|
|
69
62
|
color="#8d8e90"
|
|
70
|
-
v-if="
|
|
63
|
+
v-if="index < buttons.length - 1"
|
|
71
64
|
length="18"
|
|
72
65
|
></HyLine>
|
|
73
|
-
|
|
74
|
-
<view
|
|
75
|
-
class="hy-tooltip__wrapper__popup__list__btn"
|
|
76
|
-
hover-class="hy-tooltip__wrapper__popup__list__btn--hover"
|
|
77
|
-
>
|
|
78
|
-
<text
|
|
79
|
-
class="hy-tooltip__wrapper__popup__list__btn__text"
|
|
80
|
-
@tap="btnClickHandler(index)"
|
|
81
|
-
>
|
|
82
|
-
{{ item }}
|
|
83
|
-
</text>
|
|
84
|
-
</view>
|
|
85
|
-
<HyLine
|
|
86
|
-
direction="column"
|
|
87
|
-
color="#8d8e90"
|
|
88
|
-
v-if="index < buttons.length - 1"
|
|
89
|
-
length="18"
|
|
90
|
-
></HyLine>
|
|
91
|
-
</template>
|
|
92
|
-
</view>
|
|
66
|
+
</template>
|
|
93
67
|
</view>
|
|
94
|
-
</
|
|
68
|
+
</view>
|
|
95
69
|
</view>
|
|
70
|
+
|
|
71
|
+
<HyTransition
|
|
72
|
+
mode="fade"
|
|
73
|
+
:show="showTooltip"
|
|
74
|
+
:duration="300"
|
|
75
|
+
custom-class="hy-tooltip__popup"
|
|
76
|
+
:custom-style="popover.popStyle.value"
|
|
77
|
+
>
|
|
78
|
+
<view class="hy-tooltip__container">
|
|
79
|
+
<!-- 三角形 -->
|
|
80
|
+
<view
|
|
81
|
+
v-if="showCopy"
|
|
82
|
+
:class="`hy-tooltip__arrow ${popover.arrowClass.value}`"
|
|
83
|
+
:style="popover.arrowStyle.value"
|
|
84
|
+
></view>
|
|
85
|
+
<!-- 三角形 -->
|
|
86
|
+
|
|
87
|
+
<view class="hy-tooltip__container--list">
|
|
88
|
+
<view
|
|
89
|
+
v-if="showCopy"
|
|
90
|
+
class="hy-tooltip__container--list__btn"
|
|
91
|
+
hover-class="hy-tooltip__container--list__btn--hover"
|
|
92
|
+
@tap="setClipboardData"
|
|
93
|
+
>
|
|
94
|
+
<text class="hy-tooltip__container--list__btn--text">复制</text>
|
|
95
|
+
</view>
|
|
96
|
+
<HyLine
|
|
97
|
+
direction="column"
|
|
98
|
+
color="#8d8e90"
|
|
99
|
+
v-if="showCopy && buttons.length > 0"
|
|
100
|
+
length="18"
|
|
101
|
+
></HyLine>
|
|
102
|
+
<template v-for="(item, index) in buttons" :key="index">
|
|
103
|
+
<view
|
|
104
|
+
class="hy-tooltip__container--list__btn"
|
|
105
|
+
hover-class="hy-tooltip__container--list__btn--hover"
|
|
106
|
+
>
|
|
107
|
+
<text
|
|
108
|
+
class="hy-tooltip__container--list__btn--text"
|
|
109
|
+
@tap="btnClickHandler(index)"
|
|
110
|
+
>
|
|
111
|
+
{{ item }}
|
|
112
|
+
</text>
|
|
113
|
+
</view>
|
|
114
|
+
<HyLine
|
|
115
|
+
direction="column"
|
|
116
|
+
color="#8d8e90"
|
|
117
|
+
v-if="index < buttons.length - 1"
|
|
118
|
+
length="18"
|
|
119
|
+
></HyLine>
|
|
120
|
+
</template>
|
|
121
|
+
</view>
|
|
122
|
+
</view>
|
|
123
|
+
</HyTransition>
|
|
96
124
|
</view>
|
|
97
125
|
</template>
|
|
98
126
|
|
|
@@ -108,15 +136,24 @@ export default {
|
|
|
108
136
|
</script>
|
|
109
137
|
|
|
110
138
|
<script setup lang="ts">
|
|
111
|
-
import {
|
|
139
|
+
import {
|
|
140
|
+
ref,
|
|
141
|
+
onMounted,
|
|
142
|
+
watch,
|
|
143
|
+
inject,
|
|
144
|
+
onBeforeUnmount,
|
|
145
|
+
getCurrentInstance,
|
|
146
|
+
} from "vue";
|
|
112
147
|
import type { CSSProperties, PropType } from "vue";
|
|
113
148
|
import type { ITooltipEmits } from "./typing";
|
|
114
|
-
import {
|
|
149
|
+
import { type Queue, queueKey, usePopover } from "../../composables";
|
|
150
|
+
import type { IPlacementVo } from "../hy-popover/typing";
|
|
151
|
+
import { closeOther, removeFromQueue, pushToQueue } from "../../common";
|
|
115
152
|
|
|
116
153
|
// 组件
|
|
117
|
-
import HyOverlay from "../hy-overlay/hy-overlay.vue";
|
|
118
154
|
import HyTransition from "../hy-transition/hy-transition.vue";
|
|
119
155
|
import HyLine from "../hy-line/hy-line.vue";
|
|
156
|
+
import HyOverlay from "../hy-overlay/hy-overlay.vue";
|
|
120
157
|
|
|
121
158
|
/**
|
|
122
159
|
* Tooltip组件主要用于长按操作,类似微信的长按气泡
|
|
@@ -141,6 +178,22 @@ const props = defineProps({
|
|
|
141
178
|
type: [String, Number],
|
|
142
179
|
default: 14,
|
|
143
180
|
},
|
|
181
|
+
/**
|
|
182
|
+
* 触发模式
|
|
183
|
+
* @values longpress,click
|
|
184
|
+
* */
|
|
185
|
+
triggerMode: {
|
|
186
|
+
type: String as PropType<"longpress" | "click">,
|
|
187
|
+
default: "longpress",
|
|
188
|
+
},
|
|
189
|
+
/**
|
|
190
|
+
* 指定 popover 的放置位置
|
|
191
|
+
* @values top,top-start,top-end,bottom,bottom-start,bottom-end,left,left-start,left-end,right,right-start,right-end
|
|
192
|
+
* */
|
|
193
|
+
placement: {
|
|
194
|
+
type: String as PropType<IPlacementVo>,
|
|
195
|
+
default: "bottom",
|
|
196
|
+
},
|
|
144
197
|
/** 字体颜色 */
|
|
145
198
|
color: String,
|
|
146
199
|
/** 弹出提示框时,文本的背景色 */
|
|
@@ -190,131 +243,88 @@ const props = defineProps({
|
|
|
190
243
|
});
|
|
191
244
|
const emit = defineEmits<ITooltipEmits>();
|
|
192
245
|
|
|
193
|
-
const
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
const
|
|
246
|
+
const queue = inject<Queue | null>(queueKey, null);
|
|
247
|
+
const { proxy } = getCurrentInstance() as any;
|
|
248
|
+
// 显示三角标
|
|
249
|
+
const visibleArrow = ref<boolean>(true);
|
|
250
|
+
const popover = usePopover(visibleArrow.value);
|
|
251
|
+
const showTooltip = ref<boolean>(false);
|
|
197
252
|
const tooltipTop = ref<number>(-10000);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
253
|
+
const selector: string = "tooltip";
|
|
254
|
+
|
|
255
|
+
watch(
|
|
256
|
+
() => props.placement,
|
|
257
|
+
() => {
|
|
258
|
+
popover.init(props.placement, visibleArrow.value, selector);
|
|
259
|
+
},
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
watch(
|
|
263
|
+
() => showTooltip.value,
|
|
264
|
+
(newValue) => {
|
|
265
|
+
if (newValue) {
|
|
266
|
+
popover.control(props.placement, 0);
|
|
267
|
+
if (queue && queue.closeOther) {
|
|
268
|
+
queue.closeOther(proxy);
|
|
269
|
+
} else {
|
|
270
|
+
closeOther(proxy);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
);
|
|
275
|
+
|
|
276
|
+
onMounted(() => {
|
|
277
|
+
// getElRect();
|
|
278
|
+
popover.init(props.placement, visibleArrow.value, selector);
|
|
212
279
|
});
|
|
213
|
-
// 气泡在可能超出屏幕边沿范围时,重新定位后,距离屏幕边沿的距离
|
|
214
|
-
const screenGap = ref(12);
|
|
215
|
-
// 三角形指示器的宽高,由于对元素进行了角度旋转,精确计算指示器位置时,需要用到其尺寸信息
|
|
216
|
-
const indicatorWidth = ref(14);
|
|
217
280
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
// #ifdef APP || H5 || MP-WEIXIN
|
|
224
|
-
sysInfo = uni.getWindowInfo();
|
|
225
|
-
// #endif
|
|
226
|
-
if (
|
|
227
|
-
tooltipInfo.value.width! / 2 >
|
|
228
|
-
textInfo.value.left! + textInfo.value.width! / 2 - screenGap.value
|
|
229
|
-
) {
|
|
230
|
-
indicatorStyle.value = {};
|
|
231
|
-
style.left = `-${addUnit(textInfo.value.left! - screenGap.value)}`;
|
|
232
|
-
indicatorStyle.value.left = addUnit(
|
|
233
|
-
textInfo.value.width! / 2 - Number(style.left) - indicatorWidth.value / 2,
|
|
234
|
-
);
|
|
235
|
-
} else if (
|
|
236
|
-
tooltipInfo.value.width! / 2 >
|
|
237
|
-
sysInfo.windowWidth -
|
|
238
|
-
textInfo.value.right! +
|
|
239
|
-
textInfo.value.width! / 2 -
|
|
240
|
-
screenGap.value
|
|
241
|
-
) {
|
|
242
|
-
indicatorStyle.value = {};
|
|
243
|
-
style.right = `-${addUnit(sysInfo.windowWidth - textInfo.value.right! - screenGap.value)}`;
|
|
244
|
-
indicatorStyle.value.right = addUnit(
|
|
245
|
-
textInfo.value.width! / 2 -
|
|
246
|
-
Number(style.right) -
|
|
247
|
-
indicatorWidth.value / 2,
|
|
248
|
-
);
|
|
249
|
-
} else {
|
|
250
|
-
const left = Math.abs(
|
|
251
|
-
textInfo.value.width! / 2 - tooltipInfo.value.width! / 2,
|
|
252
|
-
);
|
|
253
|
-
style.left =
|
|
254
|
-
textInfo.value.width! > tooltipInfo.value.width!
|
|
255
|
-
? addUnit(left)
|
|
256
|
-
: -addUnit(left);
|
|
257
|
-
indicatorStyle.value = {};
|
|
258
|
-
}
|
|
259
|
-
if (props.direction === "top") {
|
|
260
|
-
style.marginTop = "-10px";
|
|
261
|
-
indicatorStyle.value.bottom = "-4px";
|
|
281
|
+
function onBeforeMount(param: () => void) {}
|
|
282
|
+
|
|
283
|
+
onBeforeMount(() => {
|
|
284
|
+
if (queue && queue.pushToQueue) {
|
|
285
|
+
queue.pushToQueue(proxy);
|
|
262
286
|
} else {
|
|
263
|
-
|
|
264
|
-
indicatorStyle.value.top = "-4px";
|
|
287
|
+
pushToQueue(proxy);
|
|
265
288
|
}
|
|
266
|
-
return style;
|
|
267
289
|
});
|
|
268
290
|
|
|
269
|
-
|
|
270
|
-
|
|
291
|
+
onBeforeUnmount(() => {
|
|
292
|
+
if (queue && queue.removeFromQueue) {
|
|
293
|
+
queue.removeFromQueue(proxy);
|
|
294
|
+
} else {
|
|
295
|
+
removeFromQueue(proxy);
|
|
296
|
+
}
|
|
271
297
|
});
|
|
272
298
|
|
|
273
|
-
|
|
274
|
-
* @description 长按触发事件
|
|
275
|
-
* */
|
|
299
|
+
// 长按触发事件
|
|
276
300
|
const longPressHandler = () => {
|
|
277
|
-
|
|
278
|
-
|
|
301
|
+
if (props.triggerMode === "longpress") {
|
|
302
|
+
tooltipTop.value = 0;
|
|
303
|
+
showTooltip.value = true;
|
|
304
|
+
}
|
|
279
305
|
};
|
|
280
306
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
307
|
+
// 点击触发事件
|
|
308
|
+
const clickHandler = () => {
|
|
309
|
+
if (props.triggerMode === "click") {
|
|
310
|
+
tooltipTop.value = 0;
|
|
311
|
+
showTooltip.value = true;
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
// 点击关闭
|
|
316
|
+
const closeHandler = () => {
|
|
285
317
|
showTooltip.value = false;
|
|
286
318
|
};
|
|
287
319
|
|
|
288
|
-
|
|
289
|
-
* @description 点击弹出按钮
|
|
290
|
-
* */
|
|
320
|
+
// 点击操作栏按钮
|
|
291
321
|
const btnClickHandler = (index: number) => {
|
|
292
322
|
showTooltip.value = false;
|
|
293
323
|
// 如果需要展示复制按钮,此处index需要加1,因为复制按钮在第一个位置
|
|
294
324
|
emit("click", props.showCopy ? index + 1 : index);
|
|
295
325
|
};
|
|
296
326
|
|
|
297
|
-
|
|
298
|
-
* @description 元素尺寸
|
|
299
|
-
* */
|
|
300
|
-
const getElRect = () => {
|
|
301
|
-
// 调用之前,先将指示器调整到屏幕外,方便获取尺寸
|
|
302
|
-
showTooltip.value = true;
|
|
303
|
-
tooltipTop.value = -10000;
|
|
304
|
-
sleep(500).then(() => {
|
|
305
|
-
getRect(`#${tooltipId.value}`, false, instance).then((size) => {
|
|
306
|
-
tooltipInfo.value = size as UniApp.NodeInfo;
|
|
307
|
-
// 获取气泡尺寸之后,将其隐藏,为了让下次切换气泡显示与隐藏时,有淡入淡出的效果
|
|
308
|
-
showTooltip.value = false;
|
|
309
|
-
});
|
|
310
|
-
getRect(`#${textId.value}`, false, instance).then((size) => {
|
|
311
|
-
textInfo.value = size as UniApp.NodeInfo;
|
|
312
|
-
});
|
|
313
|
-
});
|
|
314
|
-
};
|
|
315
|
-
/**
|
|
316
|
-
* @description 复制文本到粘贴板
|
|
317
|
-
* */
|
|
327
|
+
// 复制文本到粘贴板
|
|
318
328
|
const setClipboardData = () => {
|
|
319
329
|
// 关闭组件
|
|
320
330
|
showTooltip.value = false;
|
|
@@ -1,66 +1,90 @@
|
|
|
1
1
|
@use "../../libs/css/theme" as *;
|
|
2
2
|
@use "../../libs/css/mixin.scss" as *;
|
|
3
3
|
|
|
4
|
+
$hy-tooltip--z-index: 998;
|
|
5
|
+
$hy-tooltip--background-color: rgb(50, 50, 51);
|
|
6
|
+
|
|
4
7
|
@include b(tooltip) {
|
|
5
8
|
position: relative;
|
|
6
9
|
@include flex;
|
|
7
10
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
@include squareArrow(6px, $hy-tooltip--background-color, $hy-tooltip--z-index, $hy-box-shadow);
|
|
12
|
+
|
|
13
|
+
@include edeep(popup) {
|
|
14
|
+
position: absolute;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
background-clip: padding-box;
|
|
17
|
+
text-align: center;
|
|
18
|
+
min-height: 36px;
|
|
19
|
+
z-index: $hy-tooltip--z-index;
|
|
20
|
+
transition: opacity 0.2s;
|
|
21
|
+
box-shadow: $hy-box-shadow;
|
|
22
|
+
border-radius: $hy-border-radius-sm;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@include e(hidden) {
|
|
27
|
+
left: -220vw;
|
|
28
|
+
visibility: hidden;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@include e(container) {
|
|
32
|
+
position: relative;
|
|
33
|
+
border-radius: $hy-border-radius-sm;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@include e(inner) {
|
|
37
|
+
position: relative;
|
|
38
|
+
padding: $hy-border-margin-padding-base;
|
|
39
|
+
line-height: 22px;
|
|
40
|
+
z-index: $hy-tooltip--z-index;
|
|
41
|
+
border-radius: $hy-border-radius-sm;
|
|
42
|
+
box-sizing: content-box;
|
|
43
|
+
width: 200px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@include e(content) {
|
|
47
|
+
//@include flex;
|
|
48
|
+
//justify-content: center;
|
|
11
49
|
/* #ifndef APP-NVUE */
|
|
12
50
|
white-space: nowrap;
|
|
13
51
|
/* #endif */
|
|
14
52
|
|
|
15
|
-
|
|
16
|
-
font-size:
|
|
53
|
+
@include m(text) {
|
|
54
|
+
font-size: 28rpx;
|
|
17
55
|
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@include e(container) {
|
|
59
|
+
@include flex;
|
|
60
|
+
justify-content: center;
|
|
61
|
+
|
|
62
|
+
@include m(list) {
|
|
63
|
+
background-color: $hy-tooltip--background-color;
|
|
64
|
+
position: relative;
|
|
65
|
+
flex: 1;
|
|
66
|
+
border-radius: $hy-border-radius-sm;
|
|
67
|
+
padding: 0;
|
|
68
|
+
@include flex(row);
|
|
69
|
+
align-items: center;
|
|
70
|
+
z-index: 999;
|
|
18
71
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
&__list {
|
|
24
|
-
background-color: rgb(50, 50, 51);
|
|
25
|
-
position: relative;
|
|
26
|
-
flex: 1;
|
|
27
|
-
border-radius: $hy-border-radius-sm;
|
|
28
|
-
padding: 0;
|
|
29
|
-
@include flex(row);
|
|
72
|
+
@include e(btn) {
|
|
73
|
+
padding: $hy-border-margin-padding-base;
|
|
74
|
+
display: flex;
|
|
75
|
+
justify-content: center;
|
|
30
76
|
align-items: center;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
padding: $hy-border-margin-padding-sm $hy-border-margin-padding-base;
|
|
35
|
-
display: flex;
|
|
36
|
-
justify-content: center;
|
|
37
|
-
align-items: center;
|
|
38
|
-
|
|
39
|
-
&--hover {
|
|
40
|
-
background-color: $hy-background--hover;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&__text {
|
|
44
|
-
font-size: 13px;
|
|
45
|
-
color: #ffffff;
|
|
46
|
-
}
|
|
77
|
+
|
|
78
|
+
@include m(hover) {
|
|
79
|
+
background-color: $hy-background--hover;
|
|
47
80
|
}
|
|
48
|
-
}
|
|
49
81
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
width: 14px;
|
|
54
|
-
height: 14px;
|
|
55
|
-
bottom: -4px;
|
|
56
|
-
transform: rotate(45deg);
|
|
57
|
-
border-radius: 2px;
|
|
58
|
-
z-index: -1;
|
|
59
|
-
|
|
60
|
-
&--hover {
|
|
61
|
-
background-color: $hy-text-color--hover;
|
|
82
|
+
@include m(text) {
|
|
83
|
+
font-size: 13px;
|
|
84
|
+
color: #ffffff;
|
|
62
85
|
}
|
|
63
86
|
}
|
|
64
87
|
}
|
|
88
|
+
|
|
65
89
|
}
|
|
66
90
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<view class="hy-upload__wrap">
|
|
4
4
|
<template v-if="previewImage">
|
|
5
5
|
<view
|
|
6
|
-
class="hy-
|
|
6
|
+
class="hy-upload__wrap--preview"
|
|
7
7
|
v-for="(item, index) in lists"
|
|
8
8
|
:key="index"
|
|
9
9
|
>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
v-if="item.isImage || (item.type && item.type === 'image')"
|
|
12
12
|
:src="item.thumb || item.url"
|
|
13
13
|
:mode="imageMode"
|
|
14
|
-
class="hy-
|
|
14
|
+
class="hy-upload__wrap--preview__image"
|
|
15
15
|
@tap="onPreviewImage(item, index)"
|
|
16
16
|
:style="[
|
|
17
17
|
{
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
/>
|
|
23
23
|
<view
|
|
24
24
|
v-else
|
|
25
|
-
class="hy-
|
|
25
|
+
class="hy-upload__wrap--preview__other"
|
|
26
26
|
@tap="onClickPreview(item, index)"
|
|
27
27
|
>
|
|
28
28
|
<HyIcon
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
: 'folder'
|
|
35
35
|
"
|
|
36
36
|
></HyIcon>
|
|
37
|
-
<text class="hy-
|
|
37
|
+
<text class="hy-upload__wrap--preview__other--text">
|
|
38
38
|
{{
|
|
39
39
|
item.isVideo || (item.type && item.type === "video")
|
|
40
40
|
? "视频"
|
|
@@ -44,14 +44,19 @@
|
|
|
44
44
|
</view>
|
|
45
45
|
|
|
46
46
|
<!-- 上传进度条 -->
|
|
47
|
-
<view
|
|
47
|
+
<view
|
|
48
|
+
class="hy-upload__wrap--preview__progress"
|
|
49
|
+
v-if="item.status === 'loading'"
|
|
50
|
+
>
|
|
48
51
|
<progress
|
|
49
|
-
class="
|
|
52
|
+
class="hy-upload__wrap--preview__progress--number"
|
|
50
53
|
:percent="item.schedule"
|
|
51
54
|
stroke-width="4"
|
|
52
55
|
activeColor="#B99C65"
|
|
53
56
|
/>
|
|
54
|
-
<view class="
|
|
57
|
+
<view class="hy-upload__wrap--preview__progress--value"
|
|
58
|
+
>上传进度{{ item.schedule }}%</view
|
|
59
|
+
>
|
|
55
60
|
</view>
|
|
56
61
|
<!-- 上传进度条 -->
|
|
57
62
|
|
|
@@ -61,7 +66,7 @@
|
|
|
61
66
|
v-if="item.status !== 'loading' && (deletable || item.deletable)"
|
|
62
67
|
@tap.stop="deleteItem(index)"
|
|
63
68
|
>
|
|
64
|
-
<view class="hy-
|
|
69
|
+
<view class="hy-upload__deletable--icon">
|
|
65
70
|
<HyIcon
|
|
66
71
|
:name="IconConfig.CLOSE"
|
|
67
72
|
color="#ffffff"
|
|
@@ -74,7 +79,7 @@
|
|
|
74
79
|
<!-- 上传成功图标 -->
|
|
75
80
|
<view class="hy-upload__success" v-if="item.status === 'success'">
|
|
76
81
|
<!-- #ifndef APP-NVUE -->
|
|
77
|
-
<view class="hy-
|
|
82
|
+
<view class="hy-upload__success--icon">
|
|
78
83
|
<HyIcon
|
|
79
84
|
:name="IconConfig.CHECK_MASK"
|
|
80
85
|
color="#ffffff"
|
|
@@ -116,7 +121,7 @@
|
|
|
116
121
|
size="26"
|
|
117
122
|
:color="uploadIconColor"
|
|
118
123
|
></HyIcon>
|
|
119
|
-
<text v-if="uploadText" class="hy-
|
|
124
|
+
<text v-if="uploadText" class="hy-upload__button--text">{{
|
|
120
125
|
uploadText
|
|
121
126
|
}}</text>
|
|
122
127
|
</view>
|