gtsoft-snail-job-admin/src/components/common/exception-base.vue

43 lines
904 B
Vue
Raw Normal View History

2024-03-08 17:59:45 +08:00
<script lang="ts" setup>
import { computed } from 'vue';
import { $t } from '@/locales';
defineOptions({ name: 'ExceptionBase' });
type ExceptionType = '403' | '404' | '500';
interface Props {
/**
* Exception type
*
* - 403: no permission
* - 404: not found
* - 500: service error
*/
type: ExceptionType;
}
const props = defineProps<Props>();
const iconMap: Record<ExceptionType, string> = {
'403': 'no-permission',
'404': 'not-found',
'500': 'service-error'
};
const icon = computed(() => iconMap[props.type]);
</script>
<template>
2024-03-21 10:57:53 +08:00
<div class="size-full min-h-520px flex-vertical-center gap-24px overflow-hidden">
2024-03-08 17:59:45 +08:00
<div class="flex text-400px text-primary">
<SvgIcon :local-icon="icon" />
</div>
<RouterLink to="/">
2024-03-21 10:57:53 +08:00
<NButton type="primary">{{ $t('common.backToHome') }}</NButton>
2024-03-08 17:59:45 +08:00
</RouterLink>
</div>
</template>
<style scoped></style>