All checks were successful
Build and Deploy Front / deploy (push) Successful in 4m8s
Co-authored-by: Cursor <cursoragent@cursor.com>
113 lines
2.0 KiB
Vue
113 lines
2.0 KiB
Vue
<template>
|
||
<div class="app-mascot-state" :class="[`is-${mode}`, { 'is-compact': compact }]">
|
||
<img
|
||
class="app-mascot-state__img"
|
||
:class="{ 'is-bounce': mode === 'loading' }"
|
||
:src="appMascotUrl"
|
||
alt=""
|
||
decoding="async"
|
||
draggable="false"
|
||
/>
|
||
<p v-if="description" class="app-mascot-state__desc">{{ description }}</p>
|
||
<div v-if="$slots.default" class="app-mascot-state__extra">
|
||
<slot />
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script lang="ts" setup>
|
||
import { appMascotUrl } from '@/utils/brandLogo'
|
||
|
||
withDefaults(
|
||
defineProps<{
|
||
/** empty:无数据;loading:加载中 */
|
||
mode?: 'empty' | 'loading'
|
||
description?: string
|
||
compact?: boolean
|
||
}>(),
|
||
{
|
||
mode: 'empty',
|
||
description: '',
|
||
compact: false,
|
||
},
|
||
)
|
||
</script>
|
||
|
||
<style scoped lang="less">
|
||
.app-mascot-state {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
gap: 10px;
|
||
padding: 24px 16px;
|
||
text-align: center;
|
||
user-select: none;
|
||
|
||
&.is-compact {
|
||
padding: 8px 6px;
|
||
gap: 4px;
|
||
|
||
.app-mascot-state__img {
|
||
width: 56px;
|
||
height: auto;
|
||
}
|
||
}
|
||
|
||
&.is-empty .app-mascot-state__img {
|
||
width: 44px;
|
||
filter: grayscale(1) brightness(1.08) contrast(0.92);
|
||
opacity: 0.78;
|
||
}
|
||
|
||
&.is-empty.is-compact .app-mascot-state__img {
|
||
width: 28px;
|
||
}
|
||
}
|
||
|
||
.app-mascot-state__img {
|
||
display: block;
|
||
width: 88px;
|
||
height: auto;
|
||
object-fit: contain;
|
||
pointer-events: none;
|
||
|
||
&.is-bounce {
|
||
animation: app-mascot-bounce 1.4s ease-in-out infinite;
|
||
}
|
||
}
|
||
|
||
.app-mascot-state__desc {
|
||
margin: 0;
|
||
max-width: 320px;
|
||
font-size: 13px;
|
||
line-height: 1.5;
|
||
color: var(--color-text-3, #86909c);
|
||
}
|
||
|
||
.app-mascot-state__extra {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: center;
|
||
justify-content: center;
|
||
gap: 8px;
|
||
margin-top: 4px;
|
||
}
|
||
|
||
@keyframes app-mascot-bounce {
|
||
0%,
|
||
100% {
|
||
transform: translateY(0);
|
||
}
|
||
50% {
|
||
transform: translateY(-6px);
|
||
}
|
||
}
|
||
|
||
@media (prefers-reduced-motion: reduce) {
|
||
.app-mascot-state__img.is-bounce {
|
||
animation: none;
|
||
}
|
||
}
|
||
</style>
|