最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue中使用Animate.css的教程詳解

 更新時間:2023年08月23日 09:06:32   作者:會說法語的豬  
Animate.css這個動畫庫,很多的動畫在這個庫里面都定義好了,我們用的時候可以直接使用里面的類名就可以,下面我們就來看看如何在vue項目中使用Animate.css吧

說一下Animate.css這個動畫庫,很多的動畫在這個庫里面都定義好了,我們用的時候可以直接使用里面的類名就可以了,就是直接目標(biāo)元素綁定對應(yīng)的類名就可以實現(xiàn)動畫效果,非常方便,庫其實也相對簡單,使用起來也簡單。這里示例就以v3為例了,v2也是一樣的

github:https://github.com/animate-css/animate.css 

官網(wǎng):https://animate.style/ 

首先安裝

pnpm add animate.css

引入 

main.js 

import 'animate.css'

使用

接下來就可以正常使用了 

注意:在添加類名的時候,里面所有的動畫必須先設(shè)置上 animate__animated ,然后再設(shè)置對應(yīng)動畫的類名,否則是不會生效的,大家簡單看一下源碼就能了解

下面是個示例: 

接下來代碼: 

<template>
  <div class="main">
    <label for=""><span style="fontSize: 13px;margin-right: 5px;">開啟無限輪詢</span></label>
    <input v-model="isInfinite" type="checkbox">
    <div class="animates-container">
      <button v-for="animateName in animateNames1" :key="animateName" @click="setAnimate(animateName)">{{ animateName }}</button>
    </div>
    <div class="animates-container">
      <button v-for="animateName in animateNames2" :key="animateName" @click="setAnimate(animateName)">{{ animateName }}</button>
    </div>
    <div class="animates-container">
      <button v-for="animateName in animateNames3" :key="animateName" @click="setAnimate(animateName)">{{ animateName }}</button>
    </div>
    <div class="animates-container">
      <button v-for="animateName in animateNames4" :key="animateName" @click="setAnimate(animateName)">{{ animateName }}</button>
    </div>
    <div class="animates-container">
      <button v-for="animateName in animateNames5" :key="animateName" @click="setAnimate(animateName)">{{ animateName }}</button>
    </div>
    <div class="animates-container">
      <button v-for="animateName in animateNames6" :key="animateName" @click="setAnimate(animateName)">{{ animateName }}</button>
    </div>
    <div class="animates-container">
      <button v-for="animateName in animateNames7" :key="animateName" @click="setAnimate(animateName)">{{ animateName }}</button>
    </div>
    <div class="animates-container">
      <button v-for="animateName in animateNames8" :key="animateName" @click="setAnimate(animateName)">{{ animateName }}</button>
    </div>
    <div class="animates-container">
      <button v-for="animateName in animateNames9" :key="animateName" @click="setAnimate(animateName)">{{ animateName }}</button>
    </div>
    <div class="animates-container">
      <button v-for="animateName in animateNames10" :key="animateName" @click="setAnimate(animateName)">{{ animateName }}</button>
    </div>
    <div class="testAnimate" :class="[`${animationsClass()}`, { 'animate__infinite': isInfinite }]"></div>
  </div>
</template>
<script setup>
import { ref } from 'vue'
let animateNames1 = [
  'bounce',
  'flash',
  'pulse',
  'rubberBand',
  'shakeX',
  'shakeY',
  'headShake',
  'swing',
  'tada',
  'wobble',
  'jello',
  'heartBeat',
]
let animateNames2 = [
  'backInDown',
  'backInLeft',
  'backInRight',
  'backInUp',
  'backOutDown',
  'backOutLeft',
  'backOutRight',
  'backOutUp'
]
let animateNames3 = [
  'bounceIn',
  'bounceInDown',
  'bounceInLeft',
  'bounceInRight',
  'bounceInUp',
  'bounceOut',
  'bounceOutDown',
  'bounceOutLeft',
  'bounceOutRight',
  'bounceOutUp',
]
let animateNames4 = [
  'fadeIn',
  'fadeInDown',
  'fadeInDownBig',
  'fadeInLeft',
  'fadeInLeftBig',
  'fadeInRight',
  'fadeInRightBig',
  'fadeInUp',
  'fadeInUpBig',
  'fadeInTopLeft',
  'fadeInTopRight',
  'fadeInBottomLeft',
  'fadeInBottomRight',
  'fadeOut',
  'fadeOutDown',
  'fadeOutDownBig',
  'fadeOutLeft',
  'fadeOutLeftBig',
  'fadeOutRight',
  'fadeOutRightBig',
  'fadeOutUp',
  'fadeOutUpBig',
  'fadeOutTopLeft',
  'fadeOutTopRight',
  'fadeOutBottomRight',
  'fadeOutBottomLeft'
]
let animateNames5 = ref([
  'flip',
  'flipInX',
  'flipInY',
  'flipOutX',
  'flipOutY'
])
let animateNames6 = ref([
  'lightSpeedInRight',
  'lightSpeedInLeft',
  'lightSpeedOutRight',
  'lightSpeedOutLeft'
])
let animateNames7 = ref([
  'rotateIn',
  'rotateInDownLeft',
  'rotateInDownRight',
  'rotateInUpLeft',
  'rotateInUpRight',
  'rotateOut',
  'rotateOutDownLeft',
  'rotateOutDownRight',
  'rotateOutUpLeft',
  'rotateOutUpRight'
])
let animateNames8 = ref([
  'hinge',
  'jackInTheBox',
  'rollIn',
  'rollOut'
])
let animateNames9 = ref([
  'zoomIn',
  'zoomInDown',
  'zoomInLeft',
  'zoomInRight',
  'zoomInUp',
  'zoomOut',
  'zoomOutDown',
  'zoomOutLeft',
  'zoomOutRight',
  'zoomOutUp'
])
let animateNames10 = ref([
  'slideInDown',
  'slideInLeft',
  'slideInRight',
  'slideInUp',
  'slideOutDown',
  'slideOutLeft',
  'slideOutRight',
  'slideOutUp'
])
let animates = ref([])
let isInfinite = ref(false)
const setAnimate = animateName => {
  animates.value.shift()
  animates.value.push(animateName)
}
const animationsClass = () => {
  if (animates.value.length) {
    return `animate__animated animate__${animates.value[0]}`
  }
  return ''
}
</script>
<style scoped>
.main {
  width: 100%;
  height: 100%;
  padding: 40px 0 0 50px;
  box-sizing: border-box;
  overflow: hidden;
}
.main button {
  margin-right: 8px;
  cursor: pointer;
}
.animates-container {
  margin: 20px 0;
}
.main .testAnimate {
  width: 300px;
  height: 300px;
  background-color: red;
  margin: 50px 0 0 10px;
  padding: 30px;
  box-sizing: border-box;
}
</style>

到此這篇關(guān)于vue中使用Animate.css的教程詳解的文章就介紹到這了,更多相關(guān)vue Animate.css內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • vue Tab切換以及緩存頁面處理的幾種方式

    vue Tab切換以及緩存頁面處理的幾種方式

    相信tab切換對于大家來說都不算陌生,后臺管理系統(tǒng)中多會用到。如果不知道的話,可以看一下瀏覽器上方的標(biāo)簽頁切換,大概效果就是這樣。
    2021-05-05
  • Vue項目命名規(guī)范指南分享

    Vue項目命名規(guī)范指南分享

    本文提供Vue3+Pinia+VueRouter項目命名規(guī)范,涵蓋組件、路由、狀態(tài)等命名風(fēng)格,推薦使用ESLint和Prettier工具,統(tǒng)一風(fēng)格提升協(xié)作效率
    2025-07-07
  • Vue3使用watch進(jìn)行深度觀察的操作方法

    Vue3使用watch進(jìn)行深度觀察的操作方法

    在 Vue 3 中,一個重要的特性是 watch 選項,它允許開發(fā)者對數(shù)據(jù)變化進(jìn)行觀察,本篇博客將詳細(xì)介紹如何在 Vue 3 中使用 watch 進(jìn)行深度觀察,特別是在使用 setup 語法糖時,需要的朋友可以參考下
    2024-11-11
  • 解決vue語法會有延遲加載顯現(xiàn){{xxx}}的問題

    解決vue語法會有延遲加載顯現(xiàn){{xxx}}的問題

    今天小編就為大家分享一篇解決vue語法會有延遲加載顯現(xiàn){{xxx}}的問題,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-11-11
  • vue組件之間通信實例總結(jié)(點贊功能)

    vue組件之間通信實例總結(jié)(點贊功能)

    這篇文章主要介紹了vue組件之間通信,結(jié)合實例形式分析了vue父子組件、兄弟組件之間通信的原理、實現(xiàn)方法,并給出了一個類似點贊功能的總結(jié)實例,需要的朋友可以參考下
    2018-12-12
  • React/vue開發(fā)報錯TypeError:this.getOptions?is?not?a?function的解決

    React/vue開發(fā)報錯TypeError:this.getOptions?is?not?a?function

    這篇文章主要給大家介紹了關(guān)于React/vue開發(fā)報錯TypeError:this.getOptions?is?not?a?function的解決方法,文中通過實例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2023-07-07
  • vue中實現(xiàn)點擊空白區(qū)域關(guān)閉彈窗的兩種方法

    vue中實現(xiàn)點擊空白區(qū)域關(guān)閉彈窗的兩種方法

    這篇文章主要介紹了vue中實現(xiàn)點擊空白區(qū)域關(guān)閉彈窗的兩種方法,幫助大家更好的理解和使用vue框架,感興趣的朋友可以了解下
    2020-12-12
  • 詳解如何更好的使用module vuex

    詳解如何更好的使用module vuex

    這篇文章主要介紹了詳解如何更好的使用module vuex,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-03-03
  • vue中keep-alive、activated的探討和使用詳解

    vue中keep-alive、activated的探討和使用詳解

    這篇文章主要介紹了vue中keep-alive、activated的探討和使用詳解,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-07-07
  • Vue項目啟動白屏問題的幾種解決辦法

    Vue項目啟動白屏問題的幾種解決辦法

    這篇文章主要給大家介紹了關(guān)于Vue項目啟動白屏問題的幾種解決辦法,Vue項目打包后出現(xiàn)白屏的可能原因有很多,文中通過圖文介紹的非常詳細(xì),需要的朋友可以參考下
    2023-12-12

最新評論

通渭县| 乌拉特前旗| 红原县| 呈贡县| 天气| 琼海市| 石城县| 嘉义市| 天峨县| 胶南市| 泰安市| 阿合奇县| 宣汉县| 满洲里市| 广丰县| 尼勒克县| 河池市| 祁连县| 邯郸县| 芜湖县| 昌平区| 赤峰市| 济阳县| 桃江县| 桦甸市| 城市| 汾阳市| 锡林郭勒盟| 新余市| 临沂市| 顺义区| 甘谷县| 利津县| 霸州市| 澳门| 镇坪县| 宁武县| 柏乡县| 防城港市| 宁都县| 柳江县|