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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • [转]AVALONDOCK 2.0入门指南第一部分

    [转]AVALONDOCK 2.0入门指南第一部分AvalonDock2.0可以用来为WPF创建一个类似VisualStudio的界面,深入理解如何使用AvalonDock进行开发是很重要的。在这个入门指南里,我将演示如何开始使用AvalonDock,下面的文章都是基于2.0版本的。并且不能用于早期的版本。AvalonDock是一个组合的布局模型,很多的控件都在视图上显示,一个DockingManager类也显示在停靠…

    2022年7月20日
    12
  • js中四舍五入的方法_JS取整

    js中四舍五入的方法_JS取整主题:主要记录一下js中的一些Math函数Detail:1.四舍五入:Math.round(1.23);//12.只取整数:Math.parseInt(1.23);//13.向上取整数:Math.floor(1.23);//14.向下取整:Math.ceil(1.23);//25.取绝对值:Math.abs(-1.23);//1.236….

    2025年8月18日
    1
  • thinkphp5中的配置如何使用

    thinkphp5中的配置如何使用

    2021年6月16日
    77
  • mysql sql常用语句大全「建议收藏」

    mysql sql常用语句大全「建议收藏」一、常用操作数据库的命令1.showdatabases;查看所有的数据库2.createdatabasetest;创建一个叫test的数据库3.dropdatabasetest;删除一个叫test的数据库4.usetest;选中库,在建表之前必须要选择数据库5.showtables;在选中的数据库之中查看所有的表6.createtable表名(字段1…

    2022年4月29日
    57
  • 怎么看计算机的历史记录手机_科学计算器怎么查看历史记录

    怎么看计算机的历史记录手机_科学计算器怎么查看历史记录如何查看电脑历史操作记录?随便打开我的电脑或者浏览器,然后同时按下Ctrl+H组合键,窗口的左侧就会弹出浏览过的历史记录的小窗口,选择相应的日期之后下拉菜单后,会有浏览的网页记录和我的电脑(下图),双击我的电脑,出现的就是这一天你的电脑上的被浏览过的文件夹或文件(前提是,浏览者,并没有删除历史记录,因为在此,选中目标,单击右键选择删除,同样也是可以将今天的浏览记录删除以上只是简单的IE记录查看!电…

    2025年7月20日
    2
  • hough变换检测直线原理(opencv霍夫直线检测)

    直线的霍夫变换:霍夫空间极坐标与图像空间的转换公式:p=y*sin(theta)+x*cos(theta);之后遍历图像的每个坐标点,每个坐标点以一度为增量,求取对应的p值,存入数组中,查找数组中数目大于一定阈值的p和theta,再在图像空间中把直线恢复出来霍夫变换就是把图像左边空间上的线段转换到霍夫空间一个点,然后通过点的数目多少来确定是否为一条线段(但是画出的结果为一条

    2022年4月16日
    96

发表回复

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

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