nankai-cms-website-gov/components/common/PopUpSelect.vue
2025-03-13 10:14:57 +08:00

100 lines
1.8 KiB
Vue

<template>
<div class="pop-up-select" @mouseover="active = true" @mouseout="active = false">
<span>{{ title }} <el-icon><ElIconArrowUpBold/></el-icon></span>
<ul
:class="{ active: active, leave: !active }"
@mouseover="active = true"
@mouseout="active = false"
>
<li v-for="option in data" :key="option.title">
<nuxt-link target="_blank" :to="option.value">{{ option.title }}</nuxt-link>
</li>
</ul>
</div>
</template>
<script>
export default {
name: 'PopUpSelect',
props: {
title: String,
data: {
default: () => {
return []
}
}
},
data () {
return {
active: false
}
}
}
</script>
<style scoped lang="scss">
.pop-up-select {
position: relative;
height: 40px;
background-color: #FFFFFF;
border: 1px solid #e4e7ed;
display: flex;
align-items: center;
&>span {
width: 100%;
padding: 5px 20px;
display: flex;
align-items: center;
justify-content: space-between;
.el-icon {
color: #aaa;
font-size: 18px;
line-height: 18px;
margin-top: 2px;
}
}
ul {
width: 100%;
position: absolute;
bottom: 30px;
left: -1px;
background-color: #FFFFFF;
overflow: hidden;
border: 1px solid #e4e7ed;
border-bottom: 0;
z-index: 9;
height: 0;
&.active {
height: auto;
animation: pop-up linear 0.5s 1;
animation-fill-mode: forwards;
}
&.leave {
display: none;
}
li {
&:hover {
background-color: rgb(216.8, 235.6, 255);
}
a {
position: relative;
display: flex;
padding: 10px 10px 10px 25px;
color: var(--font-color);
}
&:last-of-type {
margin-bottom: 10px;
}
}
}
}
@keyframes pop-up {
0% {
max-height: 0;
}
100% {
max-height: 300px;
}
}
</style>