首页 > 其他分享 >假期vue学习笔记11 动画

假期vue学习笔记11 动画

时间:2024-02-28 17:44:05浏览次数:19  
标签:11 动画 vue translateX transform export Test hello

<template>     <div id = "root">         <Test/>         <Test2/>         <Test3/>     </div> </template>
<script> import Test from './components/Test.vue' import Test2 from './components/Test2.vue' import Test3 from './components/Test3.vue' export default{     name:'App',     components:{         Test,         Test2,         Test3     }, } </script>


<template>     <div>         <button @click="isShow = !isShow">显示/隐藏</button>         <transition name="hello" :appear="true">             <h1 v-show="isShow" >你好啊!</h1>         </transition>     </div> </template>
<script>     export default{         name:'Test',         data() {             return {                 isShow:true             }         },     } </script>
<style>     h1{         background-color: orange;     }     .hello-enter-active{         animation: atguigu 1s;     }
    .hello-leave-active{         animation: atguigu 1s reverse   ;     }
    @keyframes atguigu{         from{             transform: translateX(-100%);         }         to{             transform: translateX(0px);         }     } </style>   <template>     <div>         <button @click="isShow = !isShow">显示/隐藏</button>         <transition-group name="hello" :appear="true">             <h1 v-show="isShow" key="1">你好啊!</h1>             <h1 v-show="isShow" key="2">尚硅谷!</h1>         </transition-group>     </div> </template>
<script>     export default{         name:'Test',         data() {             return {                 isShow:true             }         },     } </script>
<style>     h1{         background-color: orange;         transition: 1s linear;     }         /* 进入的起点 *//* 离开的终点 */     .hello-enter,.hello-leave-to{         transform: translateX(-100%);     }     /* 进入的终点 *//* 离开的起点 */     .hello-enter-to,.hello-leave{         transform: translateX(0);     } </style>   <template>     <div>         <button @click="isShow = !isShow">显示/隐藏</button>         <transition-group         name="animate_animated animate_bounce"         enter-active-class="animate__bounce"         leave-active-class="animate__backOutUp"         appear         >             <h1 v-show="!isShow" key="1">你好啊!</h1>             <h1 v-show="isShow" key="2">尚硅谷!</h1>         </transition-group>     </div> </template>
<script>     import 'animate.css'     export default{         name:'Test',         data() {             return {                 isShow:true             }         },     } </script>
<style>     h1{         background-color: orange;     }     </style>

标签:11,动画,vue,translateX,transform,export,Test,hello
From: https://www.cnblogs.com/hbro/p/18041239

相关文章

  • 假期vue学习笔记01 ref
    <template>  <div>    <h1v-text="msg"ref="title"></h1>    <button@click="showDOM">点我输出上方的DOM元素</button>    <School/>  </div></template><script......
  • 假期vue学习笔记02 mixin
    <template>  <div >    <h2@click="showName">学校名称:{{name}}</h2>     <h2>学校地址:{{address}}</h2>  </div></template><script>  exportdefault{    name:'School'......
  • javaweb02-JavaScript&vue
    JavaScript控制网页行为js引入方式内部脚本:script标签外部脚本:js文件js基础语法书写语法区分大小写每行结尾分号可有可无,建议写上输出语句警告框window.alerthtml输出document.write浏览器控制台console.log变量用var关键字声明变量JavaScript是一......
  • 假期vue学习笔记04 插件
    exportdefault{  install(Vue){    //全局过滤器    Vue.filter('mySclice',function(value){      returnvalue.slice(0,4)    }),    //定义全局指令    Vue.directive('fbind',{      bind(......
  • 【vue】做一个从右边出来又回去的一个抽屉div
    前言:工作需要做一个从右往左出现的一个弹窗,要有抽屉效果,看了网上各种方法好多都不能用,最后试了一种可以用,但是忘记是哪个网址了,现在就是自己写一下这个随便以后用到方便找。做一个从右边出来又回去的一个抽屉divhtml代码<divclass="addBtn"@click="show">点击按钮出......
  • Vue学习笔记21-列表排序
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0"><title>列表排序</title><script......
  • Vue学习笔记19--列表过滤(watch属性过滤 + computed属性过滤)
    列表过滤--监听属性过滤<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width,initial-scale=1.0"><title>列表过滤</title>......
  • P1110 [ZJOI2007] 报表统计 题解
    考察点:STL的熟练运用。记:\(l_i\)表示序列中不超过\(a_i\)的最大数,\(r_i\)表示序列中超过\(a_i\)的最小数。开一个vectorinsert[N]存储\(a_i\)后面插入的所有数字。首先,我们使用一个multisets1来存储相邻元素的差的绝对值,然后再开一个multisets2来存储当前出......
  • 2.11
    packagecom.example.myapplication;publicclasscostList{privateString_id;privateStringse;privateStringTitle;privateStringDate;privateStringMoney;publicStringgetMoney(){returnMoney;}public......
  • Vue3 配合 Element-Plus 和 iframe-resizer 完美实现抽屉 Drawer 和 iframe
    环境准备pnpminstallvuelodashelement-plusiframe-resizerpnpminstall@types/iframe-resizer-Diframe新建文件src/utils/directives/iframeResize.ts​import{Directive,DirectiveBinding,nextTick}from"vue"importiframeResizefrom"iframe-r......