美文网首页前端开发知识收录
Vue配合Animate.css实现动画效果

Vue配合Animate.css实现动画效果

作者: 桃花谷主V | 来源:发表于2019-06-10 11:11 被阅读0次

在Vue中可以通过过度transition配合animation实现自定义动画效果,但是需要对css3非常熟悉才能实现想要的效果。大家都知道有一个css动画库animate.css里面有丰富的动画效果,简单易用。那么在Vue中该如何使用呢?且看下面分享。

一、npm安装animate.css

 npm install animate.css --save

二、在组件中引入,并控制动画元素的显示消失

元素是在显示和消失的时候才会显示出动画,需要对动画作用的元素是否显示进行控制

<script>
  import animate from 'animate.css'
  export default {
    data() {
      return {
        isShow: false
      }
    },
    methods: {
      show() {
        this.isShow = true
      },
      hide() {
        this.isShow = false
      }
    }
  }
</script>

三、给动画组件添加过渡的类名绑定动画效果

<button @click="show">进入</button>
<button @click="hide">离开</button>

<transition
  // 进入动画
  enter-active-class="animated bounceInDown"
  // 离开动画
  leave-active-class="animated bounceOutRight"
  <div class='content' v-show="isShow">
    <p>我是动画显示的内容</p>
  </div>
</transition>

相关文章

  • Vue配合Animate.css实现动画效果

    在Vue中可以通过过度transition配合animation实现自定义动画效果,但是需要对css3非常熟悉才能...

  • Vue如何做动画

    使用bower下载animate.css,配合vue的transitions就可以做动画,需要给运动的元素加cla...

  • Vue中的动画

    Vue动画 Vue动画API 定义不同的名称动画 第三方动画库Animate.css和Vue的结合使用 enter...

  • Animate.css

    使用 1.github中搜索animate.css 2.下载下来 3.在html中引用动画库 语法(实现动画效果)...

  • vue相关的一些动画库整理

    基于 animate.css 的vue动画https://github.com/codekraft-studio/...

  • webpack#2.0结合vue-cli搭建开发环境

    搭建 让.vue文件中解析lang="less" 使用vue-router 结合animate.css 做动画 引...

  • 在Vue中使用Animate.css库

    在Vue中如何使用keyframs的动画 2.Vue中使用Animate.css库使用animate[https:...

  • vue实现动画效果

    一 淡入淡出效果 在这里我简单的记录一下vue动画的简单使用以及常用的案例部分,具体的可以看vue官网的介绍ht...

  • 提升页面高级感

    动画 利用 Animate.css 做一些简单的动画效果,例如hover动画。 利用js的动画库(例如著名的G...

  • Vue -- 过渡和动画

    单组件过渡和动画 动画方案:css过渡和动画中自动用class;配合css第三方库如 Animate.css;在钩...

网友评论

    本文标题:Vue配合Animate.css实现动画效果

    本文链接:https://www.haomeiwen.com/subject/ttgaxctx.html