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


相关推荐

  • MDK(KEIL5)如何生成.bin文件(亲测可用)「建议收藏」

    MDK(KEIL5)如何生成.bin文件(亲测可用)「建议收藏」    最近师傅要求我们利用keil5生成.bin文件,但是在网上查找了很多资料,也按照网上的方法来设计,但是结果都不如意,没有出来。今天早上有折腾了一段时间,历经千辛万苦,终于生成了.bin文件了。下面分享一下,希望能帮到各位小伙伴。由于语言和能力不足,如果有错,还劳烦大佬斧正。    生产.bin文件方法有两种,一种是打开安装路径中的中的fromelf.exe,另一种是如我下图所示…

    2022年10月20日
    5
  • 八种方式实现跨域请求

    八种方式实现跨域请求前端开发中我们经常会遇到跨域请求的情况,处理跨域请求方式很多,特整理如下:浏览器的同源策略​提到跨域不能不先说一下”同源策略”。​何为同源?只有当协议、端口、和域名都相同的页面,则两个页面具有相同的源。只要网站的协议名protocol、主机host、端口号port这三个中的任意一个不同,网站间的数据请求与传输便构成了跨域调用,会受到同源策略的限制。​同源策略限制从

    2022年5月10日
    58
  • FileUpload文件上传控件「建议收藏」

    FileUpload文件上传控件「建议收藏」1.FileUpload控件的主要功能是向指定目录上传文件。FileUpload控件不会自动上传控件,而需要设置相关的事件处理程序,然后在程序中实现文件上传。2.FileUpload控件常见的属性

    2022年7月1日
    30
  • proteus仿真之DS1302+LCD1602显示试验[通俗易懂]

    proteus仿真:DS1302LCD1602显示试验

    2022年4月6日
    49
  • 京东活动+自动运行脚本+签到2021.05.26更新

    京东活动+自动运行脚本+签到2021.05.26更新先下载Node.js运行环境https://nodejs.org/en下载14.15.4版本。WIN7下载12.20的版本https://nodejs.org/dist/latest-v12.x/node-v12.20.1-x64.msi。只需要一路安装就可以。检测是否安装成功:点击开始-运行-cmd(win+R),打开dos,输入“node–version”检查Node.js版本:只要有显示就说明没问题了。每天大概300-400个京豆,有时候现金红包会有6元左右。下载脚本包:https://..

    2022年7月23日
    12
  • python打包小程序[通俗易懂]

    概述pyinstaller是一个十分有用的第三方库,能够在Windows,Linux、MacOSX等操作系统下将Python源文件打包。通过打包可以在没有Python的环境中运行。pipinstaller需要在命令行用pip3安装pip3installpyinstallerpyinstaller库会自动将pyinstaller命令安装到Python解释器目录中,与pip3的命令路…

    2022年4月13日
    35

发表回复

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

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