当前位置: 首页 > article >正文

vue3学习——router-view 过渡动画

虽然vue3说建vue页面不用包裹一个根节点,但是transition不能没有唯一的标签
所以还是得包一层~ o( ̄▽ ̄)o
	<el-main>
        <router-view v-slot="{ Component, route }">
          <transition name="MainFade" mode="out-in">
            <component :is="Component" :key="route.path" />
          </transition>
        </router-view>
      </el-main>
      
  .el-main {
    /* 渐变设置 */
    .MainFade-enter-from,
    .MainFade-leave-to {
      transform: translateX(20px);
      opacity: 0;
    }
    .MainFade-enter-to,
    .MainFade-leave-from {
      opacity: 1;
    }
    .MainFade-enter-active {
      transition: all 0.7s ease;
    }
    .MainFade-leave-active {
      transition: all 0.3s cubic-bezier(1, 0.6, 0.6, 1);
    }
  }

例如:
home.vue

<script setup lang="ts"></script>

<template>
  <div>home</div> // 根元素,包层div
</template>

<style scoped></style>


http://www.kler.cn/a/234505.html

相关文章:

  • Redis - 全局ID生成器 RedisIdWorker
  • 解锁反序列化漏洞:从原理到防护的安全指南
  • JVM图文入门
  • Selenium记录RPA初阶 - 基本输入元件
  • 【Leetcode 每日一题 - 补卡】680. 验证回文串 II
  • Beans模块之工厂模块注解模块CustomAutowireConfigurer
  • visual studio code could not establish connection to *: XHR failed
  • GreenSock Animation Platform(GSAP)动画库插件介绍
  • [C#] 如何使用ScottPlot.WPF在WPF桌面程序中绘制图表
  • Nginx配置php留档
  • C++ bool 布尔类型
  • opencv 图像色彩空间转化
  • 洛谷p4824 Censoring S
  • EMC学习笔记(二十四)降低EMI的PCB设计指南(四)
  • 网神 SecGate 3600 防火墙 route_ispinfo_import_save 文件上传漏洞
  • STM32F1 引脚重映射功能
  • 查看 iOS 系统的日志或崩溃日志
  • rancher迁移账号密码
  • Flask 项目自动生成 API 文档的高效实践
  • 阿里云游戏服务器一年费用多少?
  • Linux - updatedb 命令
  • c语言--指针数组(详解)
  • HTTP相关问题
  • Xilinx FPGA——在线升级
  • Tiny Http源码解析
  • AJAX——URL查询参数