index.vue
4.15 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<template>
<n-popover
:disabled="disabled"
:placement="popupConfig.placement"
trigger="click"
raw
@update:show="handleUpdateShow"
>
<template #trigger>
<slot />
</template>
<div
style="transform-origin: inherit"
:style="`width:${popupConfig.borderWidth}px;
height: ${popupConfig.borderHeight}px;
box-shadow: 0 0 10px 10px ${popupConfig.boxShadowColor};
background:linear-gradient(to right, ${popupConfig.linearLeftColor} , ${popupConfig.linearRightColor});
`"
>
<div class="popup-body">
<div class="popup-arrow-right" :style="`border-color:${popupConfig.arrowColor}`"></div>
<div class="popup-header-content">
<p
class="header-title"
:style="`color:${popupConfig.fontColor};font-size:${popupConfig.fontSize}px;font-weight:${popupConfig.fontWeight}`"
>
{{ popupConfig.fontContent }}
</p>
<div class="header-content-graphical">
<div class="graphical-circle-left"><Circle /></div>
<div class="graphical-line">
<div class="line-left" :style="`background-color:${popupConfig.lineColor}`"></div>
<div class="line-center" :style="`background-color:${popupConfig.lineColor}`"></div>
<div class="line-right" :style="`background-color:${popupConfig.lineColor}`"></div>
</div>
<div class="graphical-circle-right"><Circle /></div>
</div>
</div>
</div>
<div class="content-body">
<div class="body" v-for="(item, index) in popupConfigData" :key="index">
<span :style="`color:${popupConfig.labelColor};`">{{ item.label }}</span>
<span :style="`color:${popupConfig.valueColor};`">{{ item.value }}</span>
</div>
</div>
</div>
</n-popover>
</template>
<script lang="ts" setup name="TKDialog">
import { PropType } from 'vue'
import { PopupConfigInterface, PopupConfigData } from './index.d'
import Circle from './components/Circle.vue'
defineProps({
popupConfig: {
type: Object as PropType<PopupConfigInterface>,
required: true
},
popupConfigData: {
type: Array as PropType<PopupConfigData[]>
},
w: Number,
h: Number,
disabled: {
type: Boolean,
default: false
}
})
const emits = defineEmits(['updateShow'])
const handleUpdateShow = (show: boolean) => {
console.log(show)
emits('updateShow', show)
}
</script>
<style lang="scss" scoped>
@mixin base-text-ellipsis() {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
}
.popup-body {
display: flex;
justify-content: center;
flex-direction: column;
.popup-arrow-right {
position: absolute;
top: 15px;
left: 10px;
border-right: 1px solid;
border-bottom: 1px solid;
width: 7px;
height: 7px;
transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
}
.popup-header-content {
margin: 23px;
display: flex;
justify-content: center;
flex-direction: column;
.header-title {
@include base-text-ellipsis;
}
.header-content-graphical {
display: flex;
align-items: center;
.graphical-circle-left {
position: relative;
left: -2px;
}
.graphical-line {
display: flex;
position: relative;
.line-left {
width: 115px;
height: 2px;
position: relative;
}
.line-center {
width: 35px;
height: 2px;
transform: rotateZ(145deg);
position: absolute;
top: -10px;
left: 112px;
}
.line-right {
width: 50px;
height: 2px;
position: absolute;
top: -20px;
left: 143px;
}
}
.graphical-circle-right {
position: absolute;
top: 29px;
left: 231px;
}
}
}
}
.content-body {
display: flex;
flex-direction: column;
gap: 4px;
width: v-bind('w+"px"');
margin: 0 15px;
height: v-bind('h+"px"');
}
</style>