popover.vue
1.44 KB
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
52
53
54
55
56
57
58
59
<template>
<section class="popover" v-show="props.isVisible">
<div class="popover-arrow" :style="{ top: `${props.arrowTop}px` }" />
<span class="popover-header" v-text="props.title" />
<span class="popover-content">
<slot name="popover-content" />
</span>
</section>
</template>
<script setup>
const props = defineProps({
title: {
type: String,
default: 'Title'
},
isVisible: {
type: Boolean,
default: false
},
arrowTop: {
type: Number,
default: -1000
}
});
</script>
<style lang="less">
.popover {
display: flex;
flex-direction: column;
width: 290px;
border-radius: 10px;
box-shadow: rgba(0, 0, 0, 0.1) 1px 1px 2px 0px;
border: 1px solid #cdd1d5;
background-color: #ffffff;
padding: 12px 15px;
pointer-events: initial;
.popover-arrow {
position: absolute;
background-color: rgb(255, 255, 255);
width: 14px;
height: 14px;
left: 81px;
transform: rotate(45deg);
border-bottom: 1px solid rgb(205, 209, 213);
border-left: 1px solid rgb(205, 209, 213);
display: none;
}
.popover-header {
display: flex;
flex-direction: row;
-webkit-box-pack: justify;
justify-content: space-between;
margin: 0px;
font-size: 16px;
line-height: 24px;
font-weight: 700;
}
}
</style>