Commit 0b66360cc9f60c5064be4c3cae39091541f3be8c
1 parent
6bb19fb2
fix(breadcrumb): ensure the breadcrumbs display the icon correctly, fix #433
Showing
2 changed files
with
10 additions
and
2 deletions
CHANGELOG.zh_CN.md
src/layouts/default/header/components/Breadcrumb.vue
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <div :class="[prefixCls, `${prefixCls}--${theme}`]"> | 2 | <div :class="[prefixCls, `${prefixCls}--${theme}`]"> |
3 | <a-breadcrumb :routes="routes"> | 3 | <a-breadcrumb :routes="routes"> |
4 | <template #itemRender="{ route, routes, paths }"> | 4 | <template #itemRender="{ route, routes, paths }"> |
5 | - <Icon :icon="route.meta.icon" v-if="getShowBreadCrumbIcon && route.meta.icon" /> | 5 | + <Icon :icon="getIcon(route)" v-if="getShowBreadCrumbIcon && getIcon(route)" /> |
6 | <span v-if="!hasRedirect(routes, route)"> | 6 | <span v-if="!hasRedirect(routes, route)"> |
7 | {{ t(route.name || route.meta.title) }} | 7 | {{ t(route.name || route.meta.title) }} |
8 | </span> | 8 | </span> |
@@ -146,7 +146,11 @@ | @@ -146,7 +146,11 @@ | ||
146 | return true; | 146 | return true; |
147 | } | 147 | } |
148 | 148 | ||
149 | - return { routes, t, prefixCls, getShowBreadCrumbIcon, handleClick, hasRedirect }; | 149 | + function getIcon(route) { |
150 | + return route.icon || route.meta?.icon; | ||
151 | + } | ||
152 | + | ||
153 | + return { routes, t, prefixCls, getIcon, getShowBreadCrumbIcon, handleClick, hasRedirect }; | ||
150 | }, | 154 | }, |
151 | }); | 155 | }); |
152 | </script> | 156 | </script> |