-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patherror.vue
More file actions
38 lines (34 loc) · 829 Bytes
/
error.vue
File metadata and controls
38 lines (34 loc) · 829 Bytes
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
<script lang="tsx" setup>
const props = defineProps({
error: Object
})
function handleError() {
console.error(props.error)
clearError({ redirect: '/' })
}
function btnDom() {
return (
<a-button class="w-[120px]" type="primary" onClick={() => handleError()}>
返回首页
</a-button>
)
}
function emptyDom() {
const has404 = props.error?.statusCode === 404
return (
<a-empty>
<a-space direction="vertical" fill>
{has404 ? '页面不存在' : '应用发生错误异常'}
{btnDom()}
</a-space>
</a-empty>
)
}
function Render() {
return <div class="h-screen w-screen flex items-center justify-center">{emptyDom()}</div>
}
</script>
<template>
<Render />
</template>
<style scoped></style>