feat: add number animate when posts's status has changed (#244)

zio/stable
Alex 2022-11-30 14:21:11 +08:00 committed by GitHub
parent 9e053492b5
commit 4a96d2b45a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View File

@ -0,0 +1,19 @@
<script setup lang="ts">
defineProps<{
increased: boolean
}>()
</script>
<template>
<div overflow-hidden h="1.25rem">
<div
transition="duration-300 transform"
:style="{
transform: increased ? 'translateY(-50%)' : 'translateY(0%)',
}"
>
<slot />
<slot name="next" />
</div>
</div>
</template>

View File

@ -55,6 +55,11 @@ useCommand({
</div> </div>
</CommonTooltip> </CommonTooltip>
<span v-if="text" :class="active ? [color] : 'text-secondary-light'" text-sm>{{ text }}</span> <CommonAnimateNumber :increased="active">
<span display-block text-secondary-light text-sm>{{ text }}</span>
<template #next>
<span display-block :class="[color]" text-sm>{{ text }}</span>
</template>
</CommonAnimateNumber>
</component> </component>
</template> </template>