반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- node
- MAC
- 개발
- ReactNative
- xcode
- linux
- VirtualBox
- Chrome
- Android
- vsCode
- jest
- unittest
- 오블완
- IOS
- TensorFlow
- qunit
- build
- centos
- react
- localserver
- androidstudio
- 맥
- 리눅스
- 센토스
- 네트워크
- PYTHON
- 티스토리챌린지
- webpack
- MachineLearning
Archives
- Today
- Total
로메오의 블로그
[Vue + typescript] 숫자 tween 본문
반응형
$ npm install gsap
AnimationTween.vue
<template>
<span>{{ displayValue }}</span>
</template>
<script lang="ts">
import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
import gsap from 'gsap'
@Component
export default class AnimationTween extends Vue {
@Prop({ required: true, default: 0 }) value?: number;
displayValue = 0
tweenValue = 0
mounted () {
this.displayValue = this.value || 0
this.tweenValue = this.value || 0
}
@Watch('value')
tween () {
gsap.to(this, {
tweenValue: this.value,
onUpdate: () => {
this.displayValue = Math.ceil(this.tweenValue || 0)
}
})
}
}
</script>
Hello.vue
<template>
<div>
<animation-tween :value="firstNumber"></animation-tween>
<input type="text" v-model="firstNumber">
</div>
</template>
<script lang="ts">
import { Vue, Component } from 'vue-property-decorator'
import AnimationTween from '@/components/AnimationTween.vue'
@Component({
components: {
AnimationTween
}
})
export default class Hello extends Vue {
}
</script>
반응형
'Frontend > Vue' 카테고리의 다른 글
[Vue + typescript] text editor 사용하기 - TOAST UI Editor for Vue (0) | 2022.06.16 |
---|---|
[Vue + typescript] text editor 사용하기 - tiptap (0) | 2022.06.16 |
[Vue + typescript] transition (0) | 2022.05.04 |
[Vue + typescript] dynamic Component 생성하기 (0) | 2022.05.04 |
[VUE + TYPESCRIPT] font-awesome 설치 (0) | 2022.04.28 |
Comments