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(breadcrumb): set the default opening method of navigation #4916

Merged
merged 2 commits into from
Jan 11, 2025
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
6 changes: 3 additions & 3 deletions src/breadcrumb/breadcrumb-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ export default defineComponent({
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);
} else {
window.location.href = props.href;
}
};
const bindEvent = (e: MouseEvent) => {
Expand Down
4 changes: 2 additions & 2 deletions src/breadcrumb/breadcrumb.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ theme | String | light | 组件风格。可选项:light | N
content | String / Slot / Function | - | 子元素。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
default | String / Slot / Function | - | 子元素,同 content。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
disabled | Boolean | - | 是否禁用当前项点击 | N
href | String | - | 跳转链接 | N
href | String | - | 跳转链接,不能与 to 共用 | N
icon | Slot / Function | - | 面板屑项内的前置图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
maxWidth | String | undefined | 最大宽度,超出后会以省略号形式呈现。优先级高于 Breadcrumb 中的 maxItemWidth | N
replace | Boolean | false | 路由跳转是否采用覆盖的方式(覆盖后将没有浏览器历史记录) | N
router | Object | - | 路由对象。如果项目存在 Router,则默认使用 Router。TS 类型:`any` | N
target | String | _self | 链接或路由跳转方式。可选项:_blank/_self/_parent/_top | N
to | String / Object | - | 路由跳转目标,当且仅当 Router 存在时,该 API 有效。TS 类型:`string \| Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`。[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/breadcrumb/type.ts) | N
to | String / Object | - | 路由跳转目标,当且仅当 Router 存在时,该 API 有效。不能与 href 共用。TS 类型:`string \| Route` `interface Route { path?: string; name?: string; hash?: string; query?: RouteData; params?: RouteData }` `type RouteData = { [key: string]: string \| string[] }`。[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/breadcrumb/type.ts) | N
onClick | Function | | TS 类型:`(e: MouseEvent) => void`<br/>点击时触发 | N

### BreadcrumbItem Events
Expand Down
Loading