[Vue] 🎷 Lottie μ‚¬μš©λ²•

TATAΒ·2023λ…„ 12μ›” 2일
0

Vue

λͺ©λ‘ 보기
2/2

β–· Lottie

JSON ν˜•μ‹μœΌλ‘œ μ• λ‹ˆλ©”μ΄μ…˜μ„ μ €μž₯ν•˜μ—¬ 비ꡐ적 파일 크기가 μž‘μ€ Lottie.
Lottieμ—μ„œ μ›ν•˜λŠ” νŒŒμΌμ„ λ‹€μš΄λ‘œλ“œ λ°›μ•„ μ‚¬μš©ν•  수 μžˆλ‹€.
λ°›μ•„μ˜¨ Lottie νŒŒμΌμ„ 미리 ν”Œλ ˆμ΄ν•΄ λ³Ό 수 μžˆλŠ” κ³³


🎷 μ„€μΉ˜

# μ„€μΉ˜
npm install vue3-lottie@latest --save
# yarn add vue3-lottie@latest
# pnpm add vue3-lottie@latest

🎷 Vue3μ—μ„œ Lottie μ„€μ •ν•˜κΈ°

Usage with Vue 3
Usage with Nuxt 3

/* main.js */
import { createApp } from 'vue'
import Vue3Lottie from 'vue3-lottie'

createApp(App)
  .use(Vue3Lottie, { name: 'LottieAnimation' })
  .mount('#app')
/* components.d.ts */
declare module '@vue/runtime-core' {
  export interface GlobalComponents {
    LottieAnimation: typeof import('vue3-lottie')['Vue3Lottie']
  }
}

🎷 Lottie μ‚¬μš©ν•˜κΈ°

<script setup lang="ts">
import Lottie from 'vue-lottie';
import listLoadingJson from 'src/assets/json/list_loading.json';
</script>

<template>
<Vue3Lottie
  :animationData="listLoadingJson"
  :height="200"
  :width="200"
/>
</template>



πŸ‘‰ vue3 Lottie
πŸ‘‰ lottie-web으둜 Lottie에 λ‹€μ–‘ν•œ μ˜΅μ…˜ μΆ”κ°€ν•˜κΈ°

profile
🌿 https://www.tatahyeonv.com

0개의 λŒ“κΈ€