fix: when the server component path is wrong, a blank interface is still displayed (#4567)

pull/48/MERGE
Vben 2024-10-05 11:11:30 +08:00 committed by GitHub
parent 0fcc42a2fb
commit 402eaf4275
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 6 deletions

View File

@ -53,13 +53,20 @@ function transformComponent(
component: VNode,
route: RouteLocationNormalizedLoadedGeneric,
) {
//
if (!component) {
console.error(
'Component view not foundplease check the route configuration',
);
return undefined;
}
const routeName = route.name as string;
// name
if (!routeName) {
return component;
}
const componentName = (component.type as any).name;
const componentName = (component?.type as any)?.name;
// name
if (componentName) {

View File

@ -174,12 +174,15 @@ if (enableShortcutKey.value) {
/>
<div class="ml-2 w-full">
<div
v-if="tagText || text || $slots.tagText"
class="text-foreground mb-1 flex items-center text-sm font-medium"
>
{{ text }}
<Badge class="ml-2 text-green-400">
{{ tagText }}
</Badge>
<slot name="tagText">
<Badge v-if="tagText" class="ml-2 text-green-400">
{{ tagText }}
</Badge>
</slot>
</div>
<div class="text-muted-foreground text-xs font-normal">
{{ description }}
@ -208,7 +211,7 @@ if (enableShortcutKey.value) {
{{ altView }} L
</DropdownMenuShortcut>
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuSeparator v-if="preferences.widget.lockScreen" />
<DropdownMenuItem
class="mx-1 flex cursor-pointer items-center rounded-sm py-1 leading-8"
@click="handleLogout"