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


相关推荐

  • pytest的使用_新代子程序重复调用

    pytest的使用_新代子程序重复调用Pytest执行用例规则Pytest在命令行中支持多种方式来运行和选择测试用例1.对某个目录下所有的用例pytest2.对模块中进行测试pytesttest_mod.py3.对文件夹进行

    2022年7月31日
    6
  • 微微一笑很倾城(2)「建议收藏」

    微微一笑很倾城(2)「建议收藏」微微一笑很倾城正文第30章  组队前,雷神妮妮想死。  组队后,看到队伍里那一排ID,雷神妮妮瞬间回光返照HP全满了。  就像老话说的那样,一个妮妮被雷劈了,千万个妮妮在电闪雷鸣中站起来了!一切为了八卦!握拳!  电脑前的雷神妮妮死死的盯着屏幕,小眼放出百万瓦特的邪光,左手牢牢的按着截图键,心里不停的默念:来吧!来点火花吧!  可惜,时间一分一秒过去了,她期待的火花却一直没有…

    2022年5月5日
    132
  • ms17010漏洞复现-2003

    ms17010漏洞复现-2003先使用Smbtouch模块检测一下是否有漏洞。然后使用Doublepulsar写一个shellcode到本地。生成成功后的截图:再使用EternalRomance植入Doublepulsar后门。成功的截图: PS:仿佛是由于之前已经上传过bin的缘故,第二次测试的时候失败了。但是不影响后续操作。都成功了以后该我们的Doublepulsar来反弹shell了。…

    2022年6月8日
    55
  • 用myeclipse制作doc的时候出现以下代码:

    用myeclipse制作doc的时候出现以下代码:

    2021年5月24日
    149
  • commons-beanutils_Bean @session

    commons-beanutils_Bean @sessionBeanUtils介绍       所谓BeanUtils为何要开发呢,每个工程师或许在写JavaBean的时候,都会乖乖地去写getters和setters,就是getXXX()及setXXX()methods,但是当你的object是动态产生的,也许是用档案,也许是其它原因,那你该如何去存取数据呢!!几个例子你可能会用到BeanUtils,当…

    2022年9月4日
    2
  • 201621123069 《Java程序设计》第5周学习总结

    201621123069 《Java程序设计》第5周学习总结

    2022年3月7日
    34

发表回复

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

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