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

transition组件的使用

<template><button @click="flag = !flag">切换</button><transition name="fade"><div v-if="flag" class="box"></div></transition>
</template><script setup lang="ts">import { ref, reactive } from 'vue';const flag = ref(true);
</script><style scoped>.box {background: red;width: 200px;height: 200px;}/* //开始过度 */.fade-enter-from {background: red;width: 0px;height: 0px;transform: rotate(360deg);}/* //开始过度了 */.fade-enter-active {transition: all 2.5s linear;}/* //过度完成 */.fade-enter-to {background: yellow;width: 200px;height: 200px;}/* //离开的过度 */.fade-leave-from {width: 200px;height: 200px;transform: rotate(360deg);}/* //离开中过度 */.fade-leave-active {transition: all 1s linear;}.fade-leave-to {width: 0px;height: 0px;}
</style>
http://www.lryc.cn/news/3479.html

相关文章:

  • 多行文本在块元素中垂直居中
  • 在 WebAssembly 中使用 C/C++ 和 libbpf 编写 eBPF 程序
  • leveldb源码解析六——compact
  • 数据结构(二):单向链表、双向链表
  • COCO物体检测评测方法简介
  • 记一次上环境获取资源失败的案例
  • 实战超详细MySQL8离线安装
  • 依赖倒置原则|SOLID as a rock
  • Webpack的知识要点
  • handler解析(2) -Handler源码解析
  • 【算法】kmp
  • git 常用命令之 git checkout
  • 一些常见错误
  • [单片机框架][调试功能] 回溯案发现场
  • MySQL主从同步-(二)搭建从机服务器
  • Linux系列 备份与分享文档
  • SNI生效条件 - 补充nginx-host绕过实例复现中SNI绕过的先决条件
  • 傻白探索Chiplet,Modular Routing Design for Chiplet-based Systems(十一)
  • C语言静态库、动态库的封装和注意事项
  • MyBatis-Plus分页插件和MyBatisX插件
  • 年前无情被裁,面试大厂的这几个月…
  • 基于Java的分片上传功能
  • KDS安装步骤
  • JavaSE-线程池(1)- 线程池概念
  • 开源代码的寿命为何只有1年?
  • 完善登录功能--过滤器的使用
  • CSS基础:属性和关系选择器
  • 设计模式:原型模式解决对象创建成本大问题
  • 驱动开发(二)
  • 《狂飙》大结局,这22句经典台词值得细品