Skip to content

Commit

Permalink
fix(BreadcrumbItem): target equals Invalid when '_blank' (#3637)
Browse files Browse the repository at this point in the history
  • Loading branch information
selicens authored Nov 26, 2023
1 parent 3d0eb1c commit ae1afdb
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/breadcrumb/breadcrumb-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,24 @@ export default defineComponent({
<ChevronRightIcon {...{ color: 'rgba(0,0,0,.3)' }} />
);
const { proxy } = getCurrentInstance();

const handleClick = () => {
if (props.href) {
window.location.href = props.href;
}
const router = props.router || proxy.$router;
if (props.to && router) {
props.replace ? router.replace(props.to) : router.push(props.to);
}
};
const bindEvent = (e: MouseEvent) => {
if (!props.disabled) {
e.preventDefault();
if (props.href) {
window.location.href = props.href;
}
const router = props.router || proxy.$router;
if (props.to && router) {
props.replace ? router.replace(props.to) : router.push(props.to);
if (!props.disabled)
if (props.target === '_blank') {
props.href ? window.open(props.href) : window.open(props.to as string);
} else {
e.preventDefault();
handleClick();
}
}
};

return () => {
Expand Down

0 comments on commit ae1afdb

Please sign in to comment.