Skip to content

Commit bbf1cc8

Browse files
committed
fix: breadcrumb.item click not work, close #4845
1 parent 215a4d5 commit bbf1cc8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

components/breadcrumb/BreadcrumbItem.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default defineComponent({
2020
props: breadcrumbItemProps,
2121
emits: ['click'],
2222
slots: ['separator', 'overlay'],
23-
setup(props, { slots }) {
23+
setup(props, { slots, emit }) {
2424
const { prefixCls } = useConfigInject('breadcrumb', props);
2525
/**
2626
* if overlay is have
@@ -41,11 +41,14 @@ export default defineComponent({
4141
return breadcrumbItem;
4242
};
4343

44+
const handleClick = (e: MouseEvent) => {
45+
emit('click', e);
46+
};
47+
4448
return () => {
4549
const separator = getPropsSlot(slots, props, 'separator') ?? '/';
4650
const children = getPropsSlot(slots, props);
4751
let link: JSX.Element;
48-
4952
if (props.href !== undefined) {
5053
link = <a class={`${prefixCls.value}-link`}>{children}</a>;
5154
} else {
@@ -55,7 +58,7 @@ export default defineComponent({
5558
link = renderBreadcrumbNode(link, prefixCls.value);
5659
if (children) {
5760
return (
58-
<span>
61+
<span onClick={handleClick}>
5962
{link}
6063
{separator && <span class={`${prefixCls.value}-separator`}>{separator}</span>}
6164
</span>

0 commit comments

Comments
 (0)