feat: layout右上角的操作按钮添加动效

This commit is contained in:
xiaoxian521
2025-12-15 17:42:11 +08:00
parent 30459741d4
commit 8bc3f5686c
7 changed files with 73 additions and 22 deletions

View File

@@ -53,9 +53,11 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
<LaySearch id="header-search" />
<!-- 国际化 -->
<el-dropdown id="header-translation" trigger="click">
<GlobalizationIcon
class="navbar-bg-hover w-[40px] h-[48px] p-[11px] cursor-pointer outline-hidden"
/>
<div
class="globalization-icon navbar-bg-hover hover:animate-scale-bounce"
>
<IconifyIconOffline :icon="GlobalizationIcon" />
</div>
<template #dropdown>
<el-dropdown-menu class="translation">
<el-dropdown-item
@@ -113,7 +115,7 @@ const { t, locale, translationCh, translationEn } = useTranslationLang();
</template>
</el-dropdown>
<span
class="set-icon navbar-bg-hover"
class="set-icon navbar-bg-hover hover:animate-scale-bounce"
:title="t('buttons.pureOpenSystemSet')"
@click="onPanel"
>

View File

@@ -3,7 +3,7 @@ import { useI18n } from "vue-i18n";
import { ref, computed } from "vue";
import { noticesData } from "./data";
import NoticeList from "./components/NoticeList.vue";
import BellIcon from "~icons/ep/bell";
import BellIcon from "~icons/lucide/bell";
const { t } = useI18n();
const noticesNum = ref(0);
@@ -25,10 +25,10 @@ const getLabel = computed(
'dropdown-badge',
'navbar-bg-hover',
'select-none',
Number(noticesNum) !== 0 && 'mr-[10px]'
Number(noticesNum) !== 0 && 'mr-[7px]'
]"
>
<el-badge :value="Number(noticesNum) === 0 ? '' : noticesNum" :max="99">
<el-badge is-dot>
<span class="header-notice-icon">
<IconifyIconOffline :icon="BellIcon" />
</span>
@@ -65,6 +65,34 @@ const getLabel = computed(
</template>
<style lang="scss" scoped>
/* ”铃铛“摇晃衰减动画 */
@keyframes pure-bell-ring {
0%,
100% {
transform-origin: top;
}
15% {
transform: rotateZ(10deg);
}
30% {
transform: rotateZ(-10deg);
}
45% {
transform: rotateZ(5deg);
}
60% {
transform: rotateZ(-5deg);
}
75% {
transform: rotateZ(2deg);
}
}
.dropdown-badge {
display: flex;
align-items: center;
@@ -74,7 +102,13 @@ const getLabel = computed(
cursor: pointer;
.header-notice-icon {
font-size: 18px;
font-size: 16px;
}
&:hover {
.header-notice-icon svg {
animation: pure-bell-ring 1s both;
}
}
}

View File

@@ -11,7 +11,7 @@ function handleSearch() {
<template>
<div>
<div
class="search-container w-[40px] h-[48px] flex-c cursor-pointer navbar-bg-hover"
class="search-container w-[40px] h-[48px] flex-c cursor-pointer navbar-bg-hover hover:animate-scale-bounce"
@click="handleSearch"
>
<IconifyIconOffline icon="ri/search-line" />

View File

@@ -24,7 +24,10 @@ watch(
</script>
<template>
<span class="fullscreen-icon navbar-bg-hover" @click="toggle">
<span
class="fullscreen-icon navbar-bg-hover hover:animate-scale-bounce"
@click="toggle"
>
<IconifyIconOffline :icon="screenIcon" />
</span>
</template>

View File

@@ -35,3 +35,18 @@
.html-weakness {
filter: invert(80%);
}
/* 轻微缩小,再恢复原状的平滑缩放动画 */
@keyframes pure-scale-bounce {
0% {
transform: scale(1);
}
50% {
transform: scale(0.9);
}
100% {
transform: scale(1);
}
}

View File

@@ -34,12 +34,14 @@
}
.set-icon,
.fullscreen-icon {
.fullscreen-icon,
.globalization-icon {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 48px;
font-size: 16px;
cursor: pointer;
}
@@ -449,7 +451,7 @@
/* 搜索 */
.search-container,
/* 国际化 */
.globalization,
.globalization-icon,
/* 全屏 */
.fullscreen-icon,
/* 消息通知 */
@@ -468,15 +470,6 @@
color: var(--pure-theme-sub-menu-active-text);
}
.globalization {
width: 40px;
height: 48px;
padding: 11px;
color: var(--pure-theme-sub-menu-active-text);
cursor: pointer;
outline: none;
}
.el-dropdown-link {
display: flex;
align-items: center;
@@ -630,7 +623,7 @@ body[layout="vertical"] {
/* 搜索 */
.search-container,
/* 国际化 */
.globalization,
.globalization-icon,
/* 全屏 */
.fullscreen-icon,
/* 消息通知 */

View File

@@ -44,3 +44,7 @@
@utility navbar-bg-hover {
@apply dark:text-white dark:hover:bg-[#242424]!;
}
@utility animate-scale-bounce {
animation: pure-scale-bounce 0.3s ease-in-out;
}