-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTooltip.vue
51 lines (48 loc) · 852 Bytes
/
Tooltip.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<template>
<div class="tooltip" @mouseover="tip = true" @mouseleave="tip = false">
<div v-if="tip" class="tooltip__item">{{ text }}</div>
<slot />
</div>
</template>
<script>
export default {
props: {
text: {
type: String,
required: true,
},
},
data() {
return {
tip: false,
}
},
}
</script>
<style lang="scss" scoped>
.tooltip {
position: relative;
.tooltip__item {
position: absolute;
z-index: 500;
bottom: -35px;
background-color: #2d2d2d;
padding: 6px 10px;
color: #fff;
font-size: 12px;
font-weight: bold;
}
.tooltip__item::after {
content: '';
display: block;
position: absolute;
top: 0px;
left: 5px;
z-index: -1;
background-color: #2d2d2d;
height: 20px;
width: 20px;
transform: rotate(40deg);
}
}
</style>