Animate.css
greensock
<div id="analybox" class="animate__animated animate__bounce"></div>
transition结合animate动态库
<template> <div class="main"> <!-- 动画组件 --> <button @click="flag2 = !flag2">切换动画</button> <transition enter-active-class="animate__animated animate__fadeInLeft" leave-active-class="animate__animated animate__fadeInRight"> <div v-if="flag2" class="box">我是动画啊</div> </transition> </div> </template> <script setup lang="ts"> import { ref } from 'vue' import 'animate.css' let flag2 = ref<Boolean>(true) </script> <style lang="scss" scoped> .main { flex: 1; margin: 14px; border: 1px solid #ccc; overflow: auto; .box { width: 100px; height: 100px; background: red; } } </style>