[Vue] ๐ŸŽท Lottie ์‚ฌ์šฉ๋ฒ•

TATAยท2023๋…„ 12์›” 2์ผ
0

Vue

๋ชฉ๋ก ๋ณด๊ธฐ
3/3

โ–ท 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
๐Ÿพ

0๊ฐœ์˜ ๋Œ“๊ธ€