<style>
  @keyframes bounce-in {
    0% {
      transform: scale(0);
    }
    50% {
      transform: scale(1.5)
    }
    100% {
      transform: scale(1);
    }
  }
  .fade-enter-active{
    transform-origin: left center;
    animation: bounce-in 1s;
  }
  .fade-leave-active{
    transform-origin: left center;
    animation: bounce-in 1s reverse;
  }
</style>
<div id='app'>
  <transition name='fade'>
    <div v-if='show'>hello world</div>
  </transition>
  <button @click='handleClick'>切换</button>
</div> <script>
var vm = new Vue({
  el:'#app',
  data:{
    show:true
  },
  methods:{
    handleClick:function(){
      this.show = !this.show;
    }
  }
})
</script>

这是个放大的动画效果,在vue里面能不能不用fade-leave-active,fade-enter-active这样的规定好的class,我要用自定义的可不可以,可以

<style>
  .active{
    transform-origin: left center;
    animation: bounce-in 1s;
  }
  .leave{
    transform-origin: left center;
    animation: bounce-in 1s reverse;
  }
</style> <transition
  name='fade'
  enter-active-class='active'
  leave-active-class='leave'
>
  <div v-if='show'>hello world</div>
</transition>

在transition里面起自己的别名

既然可以自定义自己的class,就可以使用我们的animate.css库,animate.css库是
https://daneden.github.io/animate.css/
这个库提供了很多动画效果,我们如果要使用这个动画效果,可以下载下来
<script src="../vue.js"></script>
<link rel='stylesheet' type='text/css' href="../animate.css">
<div id='app'>
  <transition
    name='fade'
    enter-active-class='animated swing'
    leave-active-class='animated
shake'
  >
    <div v-if='show'>hello world</div>
  </transition>
  <button @click='handleClick'>切换</button>
</div> <script>
var vm = new Vue({
  el:'#app',
  data:{
    show:true
  },
  methods:{
    handleClick:function(){
      this.show = !this.show;
    }
  }
})
</script>
引入animate,出场动画,入场动画就不用自己写了,animated表示引入库里面的动画,后面的swing,shake表示要引入的具体动画名
 
用这个动画库的好处是很多复杂的效果就不用自己写了,直接用库里面的动画效果就可以实现
 

在vue中使用animate库的更多相关文章

  1. vue中使用animate.css

    一:使用animate.css的使用 1.安装npm install animate.css --save 2.在main.js中引入import animate from 'animate.css' ...

  2. vue中使用animate.css动画库

    1.安装: npm install animate.css --save 2.引入及使用: //main.js中 import animated from 'animate.css' Vue.use( ...

  3. 050——VUE中使用js库控制vue过渡动作

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. 在vue中使用animate.css

    animate.css是一款前端动画库,相似的有velocity-animate 用法: 首先 npm install animate.css --save 然后在vue文件的script中引入: i ...

  5. 048——VUE中使用animate.css动画库控制vue.js过渡效果

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. 010——VUE中使用lodash库减少watch对后台请求的压力

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. vue中使用animate.css实现动画

    参考链接:https://www.cnblogs.com/ccyinghua/p/7872694.html 参考链接:https://www.jianshu.com/p/2e0b2f8d40cf 使用 ...

  8. Vue 中的动画特效

    Vue 中的动画特效 CSS 实现标签显隐 <!DOCTYPE html> <html lang="en"> <head> <meta c ...

  9. vue中使用第三方插件animate.css实现动画效果

    vue中使用第三方插件animate.css实现动画效果1.首先先引入第三方类animated.css2.将你所需要动画的标签用包裹起来3.在transition元素中添加enter-active-c ...

随机推荐

  1. mybatis mapper问题列表

    id出现两次 2018-11-14 16:15:03.833 DEBUG 41432 --- [           main] c.a.i.o.d.mapper.DatvMapper.insert  ...

  2. grep常用选项记录

    grep: 一.常用选项:    -i 不区分大小写针对单个字符    -v 显示不包括查找字符的所有行    -o 只打印出匹配到的字符    -c 显示有多少行被匹配到    -e 可以使用多个表 ...

  3. LBS开发

    功能:用户发送自动的位置,返回周围的厕所信息 思路:根据用户的经纬度信息,调用百度地图的api,查询周围的厕所位置并且返回! 步骤:进入百度地图官网注册账号,选择web api接入 我们先看开发者文档 ...

  4. 关于WampServer一些配置修改

    1.解决WAMP mysql中文乱码问题(在mysql的my.ini文件中) 1).找到client字段并添加:default-character-set=utf8 2).找到mysql字段并添加: ...

  5. Jquery 获取table中的td元素的值

    <table id="t1"> <tr> <td> 1-1 </td> <td> 1-2 </td> < ...

  6. Kafka Intro - Configuration

    #Notes: /opt/kafka/config/zookeeper.properties sample # the directory where the snapshot is stored.d ...

  7. maya2012安装失败如何卸载重装

    AUTODESK系列软件着实令人头疼,安装失败之后不能完全卸载!!!(比如maya,cad,3dsmax等).有时手动删除注册表重装之后还是会出现各种问题,每个版本的C++Runtime和.NET f ...

  8. Unity 双击Esc或者返回退出游戏,有文字提示

    第一次点击Esc或者返回,显示提示文字"再次按下返回键退出游戏",在文字消失之前再次点击Esc或者返回,退出游戏. 此脚本挂在Text文字提示上: using UnityEngin ...

  9. My first Python program(附增加清屏方法)

    #TempConvert.py TempStr = input("请输入带有符号的温度值:") if TempStr[-1] in ['F', 'f']: C = (eval(Te ...

  10. ssh设置别名

    通常我们在 Termianl 下用 ssh 链接远程主机的时候,每次都需要输入一长串的用户名加主机地址,是不是觉得很麻烦? 我们知道在 /etc/ssh/ 目录下通常都会有 ssh_config 和 ...