Skip to content

Commit

Permalink
feat(MenuItem): app API routerLink
Browse files Browse the repository at this point in the history
  • Loading branch information
boogie-ben committed Apr 20, 2024
1 parent 34f8ee7 commit f9d4ce1
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 0 deletions.
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
1 change: 1 addition & 0 deletions packages/products/tdesign-vue-next/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-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

0 comments on commit f9d4ce1

Please sign in to comment.