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


相关推荐

  • 2021.12goland激活码-激活码分享「建议收藏」

    (2021.12goland激活码)2021最新分享一个能用的的激活码出来,希望能帮到需要激活的朋友。目前这个是能用的,但是用的人多了之后也会失效,会不定时更新的,大家持续关注此网站~IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html…

    2022年3月30日
    88
  • Python将冰冰的第一条vlog并进行数据分析「建议收藏」

    Python将冰冰的第一条vlog并进行数据分析「建议收藏」Python爬取冰冰第一条B站视频的千条评论,绘制词云图,看看大家说了什么吧文章目录数据分析数据预处理数据描述删除空值删除空值可视化点赞TOP20等级分布性别分布绘制词云图数据收集数据分析importpandasaspddata=pd.read_excel(r”bingbing.xlsx”)data.head()用户性别等级评论点赞.

    2022年4月29日
    63
  • pytest skipif_白盒测试用例

    pytest skipif_白盒测试用例前言pytest.mark.skip可以标记无法在某些平台上运行的测试功能,或者您希望失败的测试功能Skip和xfail:处理那些不会成功的测试用例你可以对那些在某些特定平台上不能运行的测试用

    2022年7月28日
    2
  • django restful API 代码自动生成_restful接口设计规范

    django restful API 代码自动生成_restful接口设计规范restful接口规范什么是接口规范?接口规范就是为了采用不同的后台语言,也能使用同样的接口获取到同样的数据。如何写接口:接口规范是规范化书写接口的,写接口要写url、响应数据​注:如果将请求参

    2022年7月29日
    6
  • [弗曼学习法] Study for learning methods

    [弗曼学习法] Study for learning methods第一步 -选择一个你想要理解的概念    选择一个你想要理解的概念, 然后拿出一张白纸, 把这个概念写在白纸的最上边.第二步-设想一种场景,你正要向别人传授这个概念    在白纸上写下你对这个概念的解释, 就好像你正在教导一位新接触这个概念的学生一样. 当你这样做的时候, 你会更清楚地意识到关于这个概念你理解了多少, 以及是否还存在理解不清的地方.第三步-如果你感觉卡壳了…

    2022年6月12日
    45
  • Linux netstat命令详解

    Linux netstat命令详解简介Netstat命令用于显示各种网络相关信息,如网络连接,路由表,接口状态(InterfaceStatistics),masquerade连接,多播成员(MulticastMemberships)等等。输出信息含义执行netstat后,其输出结果为ActiveInternetconnections(w/oservers)ProtoRecv-QSend-QLocalAddressForeignAddressStatetcp02210.34.6.

    2022年5月30日
    32

发表回复

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

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