亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

 更新時(shí)間:2023年08月23日 09:06:32   作者:會(huì)說(shuō)法語(yǔ)的豬  
Animate.css這個(gè)動(dòng)畫(huà)庫(kù),很多的動(dòng)畫(huà)在這個(gè)庫(kù)里面都定義好了,我們用的時(shí)候可以直接使用里面的類(lèi)名就可以,下面我們就來(lái)看看如何在vue項(xiàng)目中使用Animate.css吧

說(shuō)一下Animate.css這個(gè)動(dòng)畫(huà)庫(kù),很多的動(dòng)畫(huà)在這個(gè)庫(kù)里面都定義好了,我們用的時(shí)候可以直接使用里面的類(lèi)名就可以了,就是直接目標(biāo)元素綁定對(duì)應(yīng)的類(lèi)名就可以實(shí)現(xiàn)動(dòng)畫(huà)效果,非常方便,庫(kù)其實(shí)也相對(duì)簡(jiǎn)單,使用起來(lái)也簡(jiǎ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'

使用

接下來(lái)就可以正常使用了 

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

下面是個(gè)示例: 

接下來(lái)代碼: 

<template>
  <div class="main">
    <label for=""><span style="fontSize: 13px;margin-right: 5px;">開(kāi)啟無(wú)限輪詢</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)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • element-ui中el-row中設(shè)置:gutter間隔不生效問(wèn)題

    element-ui中el-row中設(shè)置:gutter間隔不生效問(wèn)題

    這篇文章主要介紹了element-ui中el-row中設(shè)置:gutter間隔不生效問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-08-08
  • vue如何實(shí)時(shí)往數(shù)組里追加數(shù)據(jù)

    vue如何實(shí)時(shí)往數(shù)組里追加數(shù)據(jù)

    這篇文章主要介紹了vue如何實(shí)時(shí)往數(shù)組里追加數(shù)據(jù),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-04-04
  • Vue.js 中制作自定義選擇組件的代碼附演示demo

    Vue.js 中制作自定義選擇組件的代碼附演示demo

    這篇文章主要介紹了Vue.js 中制作自定義選擇組件的代碼附演示demo,通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-02-02
  • Vue組件化開(kāi)發(fā)思考

    Vue組件化開(kāi)發(fā)思考

    這篇文章主要介紹了Vue組件化開(kāi)發(fā)的思考以及相關(guān)的原理介紹,如果你對(duì)此有興趣,可以學(xué)習(xí)參考下。
    2018-02-02
  • 在vant中使用時(shí)間選擇器和popup彈出層的操作

    在vant中使用時(shí)間選擇器和popup彈出層的操作

    這篇文章主要介紹了在vant中使用時(shí)間選擇器和popup彈出層的操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-11-11
  • 使用WebStorm用Debug模式調(diào)試Vue等前端項(xiàng)目的步驟

    使用WebStorm用Debug模式調(diào)試Vue等前端項(xiàng)目的步驟

    WebStorm提供了更簡(jiǎn)單的前端調(diào)試方法,記錄一下WebStorm調(diào)試步驟啟動(dòng)前端項(xiàng)目,這篇文章主要介紹了使用WebStorm用Debug模式調(diào)試Vue等前端項(xiàng)目的步驟,文中通過(guò)圖文介紹的非常詳細(xì),需要的朋友可以參考下
    2024-11-11
  • 一步步講解Vue如何啟動(dòng)項(xiàng)目

    一步步講解Vue如何啟動(dòng)項(xiàng)目

    這篇文章主要給大家介紹了關(guān)于Vue如何啟動(dòng)項(xiàng)目的相關(guān)資料,還介紹了解決vue啟動(dòng)項(xiàng)目時(shí)間很長(zhǎng)問(wèn)題的相關(guān)方法,文中通過(guò)圖文介紹的非常詳細(xì),需要的朋友可以參考下
    2023-02-02
  • 程序員應(yīng)該知道的vuex冷門(mén)小技巧(超好用)

    程序員應(yīng)該知道的vuex冷門(mén)小技巧(超好用)

    Vue基本用法很容易上手,但是有很多優(yōu)化的寫(xiě)法你就不一定知道了,下面這篇文章主要給大家介紹了關(guān)于程序員應(yīng)該知道的vuex冷門(mén)小技巧的相關(guān)資料,需要的朋友可以參考下
    2022-05-05
  • vue usePop彈窗控制器的實(shí)現(xiàn)

    vue usePop彈窗控制器的實(shí)現(xiàn)

    本文主要介紹了vue usePop彈窗控制器的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2023-04-04
  • 詳解vue之自行實(shí)現(xiàn)派發(fā)與廣播(dispatch與broadcast)

    詳解vue之自行實(shí)現(xiàn)派發(fā)與廣播(dispatch與broadcast)

    這篇文章主要介紹了詳解vue之自行實(shí)現(xiàn)派發(fā)與廣播(dispatch與broadcast),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-01-01

最新評(píng)論