728x90
1. 설치
yarn add vue-lottie@0.2.1
2. 컴포넌트 작성
<template>
<lottie
:width="270"
:height="230"
:options="tearlottieOptions"
class="schedule-lottie"
@animCreated="handleAnimation"
/>
</template>
<script>
import Lottie from 'vue-lottie/src/lottie.vue';
import * as tearChildsLottie from 'assets/img/tear-child-lottie.json';
import * as noTearChildsLottie from 'assets/img/no-tear-child-lottie.json';
export default {
name: '오예~',
components: {
Lottie,
},
data() {
return {
tearlottieOptions: {
animationData: tearChildsLottie.default,
loop: false,
},
noTearlottieOptions: {
animationData: noTearChildsLottie.default,
loop: false,
},
}
},
methods: {
handleAnimation(anim) {
this.anim = anim;
},
}
}
728x90
'Nuxtjs' 카테고리의 다른 글
[Nuxtjs] @vue/unit-tests 환경 만들기 (1) | 2022.07.13 |
---|---|
[Tiptap + Nuxtjs] 에디터 구현하기 (0) | 2022.07.13 |
[Nuxtjs] 뒤로가기 기능 구현 방법 (0) | 2022.06.23 |
[Nuxt.js] 무한 스크롤 구현한 사례 (0) | 2022.06.01 |
[nuxtjs] $auth auth._token_expiration.local (0) | 2022.05.18 |
댓글