You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

60 lines
1.2 KiB

<template>
<div class="error-page">
<div class="error-card">
<div class="error-code">{{ statusCode }}</div>
<div class="error-message">{{ statusMessage }}</div>
<BoButton type="primary" @click="handleHome">返回首页</BoButton>
</div>
</div>
</template>
<script setup lang="ts">
import { BoButton } from 'bolt-ui'
const props = defineProps<{
statusCode: number
statusMessage?: string
}>()
const statusMessage = computed(() => {
if (props.statusMessage) return props.statusMessage
if (props.statusCode === 404) return '页面不存在'
if (props.statusCode >= 500) return '服务器开小差了'
return '出错了'
})
function handleHome() {
clearError({ redirect: '/' })
}
</script>
<style scoped>
.error-page {
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background-color: var(--color-canvas);
padding: 2rem;
}
.error-card {
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
gap: 1.5rem;
}
.error-code {
font-family: var(--font-display);
font-size: 5rem;
color: var(--color-primary);
line-height: 1;
}
.error-message {
font-size: 1.125rem;
color: var(--color-body);
}
</style>