WelcomeEntryItem.vue
1.64 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!--
* @Date: 2026-01-28 16:57:21
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2026-01-28 16:57:41
* @FilePath: /mlaj/src/components/welcome/WelcomeEntryItem.vue
* @Description: 欢迎页入口项组件
-->
<template>
<div
class="entry-item"
:class="{ 'is-external': entry.isExternal }"
@click="handleClick"
>
<div class="entry-icon-wrapper">
<img
:src="entry.icon"
:alt="entry.title"
class="entry-icon"
/>
</div>
<div class="entry-title">{{ entry.title }}</div>
</div>
</template>
<script setup>
import { defineProps, defineEmits } from 'vue'
const props = defineProps({
entry: {
type: Object,
required: true,
validator: (value) => {
return value.id && value.title && value.icon && value.route
}
}
})
const emit = defineEmits(['click'])
const handleClick = () => {
emit('click', props.entry)
}
</script>
<style lang="less" scoped>
.entry-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s ease;
&:active {
transform: scale(0.95);
}
&.is-external {
// 外部链接的特殊样式(如果需要)
}
.entry-icon-wrapper {
position: relative;
width: 5rem;
height: 5rem;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
.entry-icon {
width: 5rem;
height: 5rem;
object-fit: contain;
}
}
.entry-title {
font-size: 0.95rem;
font-weight: 500;
color: #ffffff;
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
white-space: nowrap;
}
}
</style>