Vue中使用animate.css「建议收藏」

Vue中使用animate.css「建议收藏」最近把公司官网项目依赖进行了升级,里面用到了animate.css。目前版本4.1.0。目前4.x版本相比之前3.x的breakingchange如下:Animate.cssv4broughtsomeimprovements,improvedanimations,andnewanimations,whichmakesitworthupgrading.Butitalsocomeswithabreakingchange:wehaveaddedpref

大家好,又见面了,我是你们的朋友全栈君。

最近把公司官网项目依赖进行了升级,里面用到了animate.css。目前版本4.1.0。

目前4.x版本相比之前3.x的breaking change如下:

Animate.css v4 brought some improvements, improved animations, and new animations, which makes it worth upgrading. But it also comes with a breaking change: we have added prefix for all of the Animate.css classes – defaulting to animate__ – so a direct migration is not possible.

But fear not! Although the default build, animate.min.css, brings the animate__ prefix we also provide the animate.compat.css file which brings no prefix at all, like the previous versions (3.x and under).

现总结下animate.css V4版本在Vue中的使用方法。

安装
yarn add animate.css
1
引入
在main.js中引入

import animate from ‘animate.css’

Vue.use(animate)

使用
在App.vue中

<template>
  <div id=”app”>
    <button @click=”toggleVisible”>transition</button>
    <!–方法一–>
    <transition
      enter-active-class=”animate__fadeIn”
      leave-active-class=”animate__fadeOut”
    >
      <h1 v-show=”visible” class=”animate__animated”>Animate.css</h1>
    </transition>
    <!–方法二–>
    <transition
      enter-active-class=”animate__animated animate__fadeInLeft”
      leave-active-class=”animate__animated animate__fadeOutLeft”
    >
      <h1 v-show=”visible”>Animate.css</h1>
    </transition>
    <!–方法三–>
    <transition-group
      enter-active-class=”animate__fadeInRight”
      leave-active-class=”animate__fadeOutRight”
    >
      <h1 v-show=”visible” class=”animate__animated” :key=”1″>Animate.css</h1>
      <h2 v-show=”visible” class=”animate__animated” :key=”2″>Just-add-water CSS animations</h2>
    </transition-group>
  </div>
</template>

<script>

export default {

  name: ‘App’,
  data () {

    return {

      visible: false
    }
  },
  methods: {

    toggleVisible () {

      this.visible = !this.visible
    }
  }
}
</script>

<style>
#app {

  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

补充
更多高级用法请参考官方文档:https://animate.style/

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/159142.html原文链接:https://javaforall.net

赞 (0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • mysql删除表数据及其关联数据_MYSQL中delete删除多表数据与删除关联数据

    mysql删除表数据及其关联数据_MYSQL中delete删除多表数据与删除关联数据在mysql中删除数据方法有很多种,最常用的是使用delete来删除记录,下面我来介绍delete删除单条记录与删除多表关联数据的一些简单实例。1、deletefromt1where条件2、deletet1fromt1where条件3、deletet1fromt1,t2where条件4、deletet1,t2fromt1,t2where条件前3者是可行的,第…

    2022年7月17日
  • hdfs常用操作命令

    hdfs常用操作命令hdfs常用操作命令

    2022年4月23日
  • SQL语句大全大全(经典珍藏版)

    SQL语句大全大全(经典珍藏版)SQL语句大全–语句功能–数据操作SELECT–从数据库表中检索数据行和列INSERT–向数据库表添加新数据行DELETE–从数据库表中删除数据行UPDATE–更新数据库表中的数据-数据定义CREATETABLE–创建一个数据库表DROPTABLE–从数据库中删除表ALTERTABLE–修改数据库表结构CREATEVIEW

    2022年5月19日
  • (精华)2020年6月28日 JavaScript高级篇 设计模式-发布订阅模式

    (精华)2020年6月28日 JavaScript高级篇 设计模式-发布订阅模式//发布订阅对象vareventObj={//缓存列表,存放订阅者的信息list:{},//添加订阅listen:function(key,fn){if(!this.list[key]){this.list[key]=[];}typeoffn===’function’&&this.list[key].push(fn);},//发布信息

    2022年8月20日
  • 计算机编程入门教程

    计算机编程入门教程用什么语言可以写木马程序啊!!!首先确定你需要什么功能,如果是控制Http服务器的话,就是ASP木马,用脚本语言(VBS、JS)来写,Window自带的记事本就可以胜任如果是控制Windows的话,就属于一般的Win32木马,几乎什么程序都可以写,不管是MASM32、VC++、VB、Delphi、BCB都可以,个人推荐MASM32,毕竟汇编的东西短小精悍,而且设计直观方便,其他的语

    2022年6月16日
  • 浅谈SQL游标

    浅谈SQL游标
    游标(Cursor)是处理数据的一种方法,为了查看或者处理结果集中的数据,游标提供了在结果集中一次以行或者多行前进或向后浏览数据的能力。我们可以把游标当作一个指针,它可以指定结果中的任何位置,然后允许用户对指定位置的数据进行处理。游标允许你选择一组数据,通过翻阅这组数据记录——通常被称为数据集,检查每一个游标所在的特定的行。你可以将游标和局部变量组合在一起对每一个记录进行检查,当游标移动到下一个记录时,来执行一些外部操作。游标的另一个常见的用法是:保存查询结果以备以后使用。一个游标结果集是通过执

    2022年7月12日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号