feat: 引入 animate.css 动画库,移除自定义的 transtion 自定义动画样式文件

This commit is contained in:
郝先瑞 2024-02-21 18:17:57 +08:00
parent b1210cf2b8
commit 41234e7e57
7 changed files with 11 additions and 84 deletions

View File

@ -46,6 +46,7 @@
"@vueuse/core": "^10.7.2",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "5.1.10",
"animate.css": "^4.1.1",
"axios": "^1.6.7",
"echarts": "^5.5.0",
"element-plus": "^2.5.6",

View File

@ -1,12 +1,14 @@
<template>
<el-breadcrumb class="h-[50px] flex items-center">
<transition-group name="breadcrumb-transition">
<el-breadcrumb class="flex-y-center">
<transition-group
enter-active-class="animate__animated animate__fadeInRight"
>
<el-breadcrumb-item v-for="(item, index) in breadcrumbs" :key="item.path">
<span
v-if="
item.redirect === 'noredirect' || index === breadcrumbs.length - 1
"
class="text-[var(--el-disabled-text-color)]"
class="color-gray-400"
>{{ translateRouteTitle(item.meta.title) }}</span
>
<a v-else @click.prevent="handleLink(item)">
@ -18,8 +20,7 @@
</template>
<script setup lang="ts">
import { onBeforeMount, ref, watch } from "vue";
import { useRoute, RouteLocationMatched } from "vue-router";
import { RouteLocationMatched } from "vue-router";
import { compile } from "path-to-regexp";
import router from "@/router";
import { translateRouteTitle } from "@/utils/i18n";
@ -88,13 +89,6 @@ onBeforeMount(() => {
</script>
<style lang="scss" scoped>
.app-breadcrumb.el-breadcrumb {
display: inline-block;
margin-left: 8px;
font-size: 14px;
line-height: 50px;
}
// element-plus
.el-breadcrumb__inner,
.el-breadcrumb__inner a {

View File

@ -2,7 +2,7 @@
<section class="app-main">
<router-view>
<template #default="{ Component, route }">
<transition name="fade-translate" mode="out-in">
<transition mode="out-in">
<keep-alive :include="cachedViews">
<component :is="Component" :key="route.path" />
</keep-alive>

View File

@ -1,6 +1,6 @@
<template>
<div class="logo-container">
<transition name="logo-transition">
<transition enter-active-class="animate__animated animate__fadeInLeft">
<router-link v-if="collapse" class="wh-full flex-center" to="/">
<img v-if="settingsStore.sidebarLogo" :src="logo" class="logo-image" />
</router-link>
@ -41,6 +41,7 @@ const logo = ref(new URL(`../../../../assets/logo.png`, import.meta.url).href);
}
.logo-title {
flex-shrink: 0; /* 防止容器在空间不足时缩小 */
margin-left: 10px;
font-size: 14px;
font-weight: bold;

View File

@ -18,6 +18,7 @@ import i18n from "@/lang/index";
import "element-plus/theme-chalk/dark/css-vars.css";
import "@/styles/index.scss";
import "uno.css";
import "animate.css";
const app = createApp(App);
// 全局注册 自定义指令(directive)

View File

@ -1,4 +1,3 @@
@use "./transition";
@use "./reset";
.app-container {

View File

@ -1,69 +0,0 @@
/* 淡入淡出 */
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.28s;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
/* 平移和淡入淡出 */
.fade-translate-enter-active,
.fade-translate-leave-active {
transition: opacity 0.3s, transform 0.3s;
}
.fade-translate-enter-from,
.fade-translate-leave-to {
opacity: 0;
transform: translateX(-30px);
}
/* 缩放 */
.fade-scale-enter-active,
.fade-scale-leave-active {
transition: transform 0.3s ease-in-out;
}
.fade-scale-enter-from,
.fade-scale-leave-to {
transform: scale(0);
}
/* 旋转 */
.fade-rotate-enter-active,
.fade-rotate-leave-active {
transition: transform 0.3s ease-in-out;
}
.fade-rotate-enter-from,
.fade-rotate-leave-to {
transform: rotate(90deg);
}
/* 面包屑 */
.breadcrumb-transition-enter-active,
.breadcrumb-transition-leave-active {
transition: all 0.5s;
}
.breadcrumb-transition-enter-from,
.breadcrumb-transition-leave-to {
opacity: 0;
transform: translateX(20px);
}
/* Logo动画 */
// 进入动画2s内过渡到完全不透明(opacity默认值为1不需要显示声明)
.logo-transition-enter-active {
transition: opacity 2s;
}
// 进入动画开始时和离开动画的样式状态(opacity)
.logo-transition-enter-from,
.logo-transition-leave-to {
opacity: 0;
}