Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions packages/effects/layouts/src/basic/content/content.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,20 @@ function transformComponent(
component: VNode,
route: RouteLocationNormalizedLoadedGeneric,
) {
// 组件视图未找到,如果有设置后备视图,则返回后备视图,如果没有,则抛出错误
if (!component) {
console.error(
'Component view not found,please 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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"
Expand Down