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

feat(MenuItem): API: routerLink #164

Merged
merged 1 commit into from
Apr 20, 2024
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
Binary file modified db/TDesign.db
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export default {
router: {
type: Object as PropType<TdMenuItemProps['router']>,
},
/** 当且仅当 Router 存在时,该 API 有效。开启菜单项内容渲染为与router-link行为一致的`<a />`标签。 */
routerLink: Boolean,
/** 链接或路由跳转方式 */
target: {
type: String as PropType<TdMenuItemProps['target']>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ href | String | - | \- | N
icon | Slot / Function | - | Typescript:`TNode`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
replace | Boolean | false | \- | N
router | Object | - | Typescript:`Record<string, any>` | N
routerLink | Boolean | - | `1.3.11`。This API is valid if and only if the Router exists. Enable menu item content to be rendered as an `<a />` consistent with router-link behavior. | N
target | String | _self | options: _blank/_self/_parent/_top | N
to | String / Object | - | Typescript:`MenuRoute` `interface MenuRoute { path?: string; name?: string; hash?: string; query?: MenuQueryData; params?: MenuQueryData }` `type MenuQueryData = { [key: string]: string \| string[] }`[see more ts definition](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/menu/type.ts) | N
value | String / Number | - | Typescript:`MenuValue` | N
Expand Down
1 change: 1 addition & 0 deletions packages/products/tdesign-vue-next/src/menu/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ href | String | - | 跳转链接 | N
icon | Slot / Function | - | 图标。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N
replace | Boolean | false | 路由跳转是否采用覆盖的方式(覆盖后将没有浏览器历史记录) | N
router | Object | - | 路由对象。如果项目存在 Router,则默认使用 Router。。TS 类型:`Record<string, any>` | N
routerLink | Boolean | - | `1.3.11`。当且仅当 Router 存在时,该 API 有效。开启菜单项内容渲染为与router-link行为一致的`<a />`标签。 | N
target | String | _self | 链接或路由跳转方式。可选项:_blank/_self/_parent/_top | N
to | String / Object | - | 路由跳转目标,当且仅当 Router 存在时,该 API 有效。TS 类型:`MenuRoute` `interface MenuRoute { path?: string; name?: string; hash?: string; query?: MenuQueryData; params?: MenuQueryData }` `type MenuQueryData = { [key: string]: string \| string[] }`。[详细类型定义](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/menu/type.ts) | N
value | String / Number | - | 菜单项唯一标识。TS 类型:`MenuValue` | N
Expand Down
4 changes: 4 additions & 0 deletions packages/products/tdesign-vue-next/src/menu/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ export interface TdMenuItemProps {
* 路由对象。如果项目存在 Router,则默认使用 Router。
*/
router?: Record<string, any>;
/**
* 当且仅当 Router 存在时,该 API 有效。开启菜单项内容渲染为与router-link行为一致的`<a />`标签。
*/
routerLink?: boolean;
/**
* 链接或路由跳转方式
* @default _self
Expand Down
2 changes: 2 additions & 0 deletions packages/products/tdesign-vue/src/menu/menu-item-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export default {
router: {
type: Object as PropType<TdMenuItemProps['router']>,
},
/** 当且仅当 Router 存在时,该 API 有效。开启菜单项内容渲染为与router-link行为一致的`<a />`标签。 */
routerLink: Boolean,
/** 链接或路由跳转方式 */
target: {
type: String as PropType<TdMenuItemProps['target']>,
Expand Down
1 change: 1 addition & 0 deletions packages/products/tdesign-vue/src/menu/menu.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ href | String | - | \- | N
icon | Slot / Function | - | Typescript:`TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
replace | Boolean | false | \- | N
router | Object | - | Typescript:`Record<string, any>` | N
routerLink | Boolean | - | `1.5.0`。This API is valid if and only if the Router exists. Enable menu item content to be rendered as an `<a />` consistent with router-link behavior. | N
target | String | _self | options: _blank/_self/_parent/_top | N
to | String / Object | - | Typescript:`MenuRoute` `interface MenuRoute { path?: string; name?: string; hash?: string; query?: MenuQueryData; params?: MenuQueryData }` `type MenuQueryData = { [key: string]: string \| string[] }`。[see more ts definition](https://github.com/Tencent/tdesign-vue/tree/develop/src/menu/type.ts) | N
value | String / Number | - | Typescript:`MenuValue` | N
Expand Down
1 change: 1 addition & 0 deletions packages/products/tdesign-vue/src/menu/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ href | String | - | 跳转链接 | N
icon | Slot / Function | - | 图标。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-vue/blob/develop/src/common.ts) | N
replace | Boolean | false | 路由跳转是否采用覆盖的方式(覆盖后将没有浏览器历史记录) | N
router | Object | - | 路由对象。如果项目存在 Router,则默认使用 Router。。TS 类型:`Record<string, any>` | N
routerLink | Boolean | - | `1.5.0`。当且仅当 Router 存在时,该 API 有效。开启菜单项内容渲染为与router-link行为一致的`<a />`标签。 | N
target | String | _self | 链接或路由跳转方式。可选项:_blank/_self/_parent/_top | N
to | String / Object | - | 路由跳转目标,当且仅当 Router 存在时,该 API 有效。TS 类型:`MenuRoute` `interface MenuRoute { path?: string; name?: string; hash?: string; query?: MenuQueryData; params?: MenuQueryData }` `type MenuQueryData = { [key: string]: string \| string[] }`[详细类型定义](https://github.com/Tencent/tdesign-vue/tree/develop/src/menu/type.ts) | N
value | String / Number | - | 菜单项唯一标识。TS 类型:`MenuValue` | N
Expand Down
4 changes: 4 additions & 0 deletions packages/products/tdesign-vue/src/menu/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ export interface TdMenuItemProps {
* 路由对象。如果项目存在 Router,则默认使用 Router。
*/
router?: Record<string, any>;
/**
* 当且仅当 Router 存在时,该 API 有效。开启菜单项内容渲染为与router-link行为一致的`<a />`标签。
*/
routerLink?: boolean;
/**
* 链接或路由跳转方式
* @default _self
Expand Down
37 changes: 37 additions & 0 deletions packages/scripts/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -71173,6 +71173,43 @@
"Object"
]
},
{
"id": 1713607606,
"platform_framework": [
"1"
],
"component": "MenuItem",
"field_category": 1,
"field_name": "routerLink",
"field_type": [
"4"
],
"field_default_value": "",
"field_enum": "",
"field_desc_zh": "当且仅当 Router 存在时,该 API 有效。开启菜单项内容渲染为与router-link行为一致的`<a />`标签。",
"field_desc_en": "This API is valid if and only if the Router exists. Enable menu item content to be rendered as an `<a />` consistent with router-link behavior.",
"field_required": 0,
"event_input": "",
"create_time": "2024-04-20 10:06:46",
"update_time": "2024-04-20 10:06:46",
"event_output": null,
"custom_field_type": null,
"syntactic_sugar": null,
"readonly": 1,
"html_attribute": 0,
"trigger_elements": "",
"deprecated": 0,
"version": "{ \"Vue(PC)\": \"1.5.0\", \"VueNext(PC)\": \"1.3.11\" }",
"test_description": null,
"support_default_value": 0,
"field_category_text": "Props",
"platform_framework_text": [
"Vue(PC)"
],
"field_type_text": [
"Boolean"
]
},
{
"id": 854,
"platform_framework": [
Expand Down
Loading