404.vue
2.8 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<template>
<div class="error-page">
<div class="error-content">
<div class="error-image">
<img src="/404.svg" alt="404" />
</div>
<div class="error-info">
<h1 class="error-code">404</h1>
<h2 class="error-title">页面不存在</h2>
<p class="error-description">
抱歉,您访问的页面不存在或已被删除。
</p>
<div class="error-actions">
<el-button type="primary" @click="goHome">
<el-icon><House /></el-icon>
返回首页
</el-button>
<el-button @click="goBack">
<el-icon><ArrowLeft /></el-icon>
返回上页
</el-button>
</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { useRouter } from 'vue-router'
const router = useRouter()
// 返回首页
const goHome = () => {
router.push('/')
}
// 返回上一页
const goBack = () => {
router.go(-1)
}
</script>
<style lang="scss" scoped>
.error-page {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
background-color: var(--el-bg-color-page);
.error-content {
text-align: center;
max-width: 600px;
padding: 40px 20px;
.error-image {
margin-bottom: 40px;
img {
width: 300px;
height: 300px;
max-width: 100%;
}
}
.error-info {
.error-code {
font-size: 72px;
font-weight: 700;
color: var(--el-color-primary);
margin: 0 0 16px 0;
line-height: 1;
}
.error-title {
font-size: 32px;
font-weight: 600;
color: var(--el-text-color-primary);
margin: 0 0 16px 0;
}
.error-description {
font-size: 16px;
color: var(--el-text-color-secondary);
margin: 0 0 32px 0;
line-height: 1.6;
}
.error-actions {
display: flex;
gap: 16px;
justify-content: center;
.el-button {
padding: 12px 24px;
font-size: 16px;
}
}
}
}
}
// 响应式设计
@media (max-width: 768px) {
.error-page {
.error-content {
padding: 20px;
.error-image {
margin-bottom: 20px;
img {
width: 200px;
height: 200px;
}
}
.error-info {
.error-code {
font-size: 48px;
}
.error-title {
font-size: 24px;
}
.error-description {
font-size: 14px;
}
.error-actions {
flex-direction: column;
align-items: center;
.el-button {
width: 200px;
}
}
}
}
}
}
</style>