Files
syops/frontend/src/shared/components/AsyncChunkLoadError.vue
T

32 lines
954 B
Vue

<script setup lang="ts">
/**
* shared/components/AsyncChunkLoadError.vue
* 用途:懒加载分包在一次自动刷新后仍失败时的兜底提示。
* 依赖:vue-i18n common.chunkLoad。
* 逻辑:由 defineRecoverableAsyncComponent 作为 errorComponent 挂上;按钮整页刷新。
*/
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
/**
* 用户手动刷新,重新拉取 index.html 与最新 hash 分包。
*/
function refreshPage(): void {
window.location.reload();
}
</script>
<template>
<section class="flex min-h-0 flex-1 flex-col items-center justify-center gap-3 px-6 py-10 text-center">
<p class="text-sm text-muted">{{ t('common.chunkLoad.failed') }}</p>
<button
type="button"
class="rounded-md bg-brand-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-brand-700"
@click="refreshPage"
>
{{ t('common.chunkLoad.refresh') }}
</button>
</section>
</template>