Skip to content

Commit

Permalink
fix(breadcrumb): ensure the breadcrumbs display the icon correctly, fix
Browse files Browse the repository at this point in the history
  • Loading branch information
anncwb committed Mar 27, 2021
1 parent 6bb19fb commit 0b66360
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

- 移除 useFullScreen 函数

### 🐛 Bug Fixes

- 确保面包屑正确的显示图标

## 2.1.1 (2021-03-26)

### ✨ Features
Expand Down
8 changes: 6 additions & 2 deletions src/layouts/default/header/components/Breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div :class="[prefixCls, `${prefixCls}--${theme}`]">
<a-breadcrumb :routes="routes">
<template #itemRender="{ route, routes, paths }">
<Icon :icon="route.meta.icon" v-if="getShowBreadCrumbIcon && route.meta.icon" />
<Icon :icon="getIcon(route)" v-if="getShowBreadCrumbIcon && getIcon(route)" />
<span v-if="!hasRedirect(routes, route)">
{{ t(route.name || route.meta.title) }}
</span>
Expand Down Expand Up @@ -146,7 +146,11 @@
return true;
}
return { routes, t, prefixCls, getShowBreadCrumbIcon, handleClick, hasRedirect };
function getIcon(route) {
return route.icon || route.meta?.icon;
}
return { routes, t, prefixCls, getIcon, getShowBreadCrumbIcon, handleClick, hasRedirect };
},
});
</script>
Expand Down

0 comments on commit 0b66360

Please sign in to comment.