mirror of
https://github.com/halo-dev/docs.git
synced 2025-10-20 17:54:01 +00:00
docs: add documentation for user tab (#340)
为用户资料选项卡和个人中心的资料选项卡扩展点添加文档。 Ref https://github.com/halo-dev/halo/pull/5763 /kind documentation ```release-note None ```
This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
title: 个人资料选项卡
|
||||||
|
description: 扩展个人中心的个人资料选项卡 - uc:user:profile:tabs:create
|
||||||
|
---
|
||||||
|
|
||||||
|
此扩展点用于扩展个人中心的个人资料选项卡。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 定义方式
|
||||||
|
|
||||||
|
```ts
|
||||||
|
export default definePlugin({
|
||||||
|
extensionPoints: {
|
||||||
|
"uc:user:profile:tabs:create": (): UserProfileTab[] | Promise<UserProfileTab[]> => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: "foo",
|
||||||
|
label: "foo",
|
||||||
|
component: markRaw(FooComponent),
|
||||||
|
priority: 20,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
```ts title="UserProfileTab"
|
||||||
|
export interface UserProfileTab {
|
||||||
|
id: string; // 选项卡 ID
|
||||||
|
label: string; // 选项卡标题
|
||||||
|
component: Raw<Component>; // 选项卡面板组件
|
||||||
|
priority: number; // 排序优先级
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
其中,`component` 组件有以下实现要求:
|
||||||
|
|
||||||
|
1. 组件包含以下 props:
|
||||||
|
1. `user:DetailedUser`:当前用户信息。
|
@@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
title: 用户详情选项卡
|
||||||
|
description: 扩展用户详情选项卡 - user:detail:tabs:create
|
||||||
|
---
|
||||||
|
|
||||||
|
此扩展点用于扩展用户详情页面的选项卡。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## 定义方式
|
||||||
|
|
||||||
|
```ts
|
||||||
|
export default definePlugin({
|
||||||
|
extensionPoints: {
|
||||||
|
"user:detail:tabs:create": (): UserTab[] | Promise<UserTab[]> => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: "foo",
|
||||||
|
label: "foo",
|
||||||
|
component: markRaw(FooComponent),
|
||||||
|
priority: 20,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
```ts title="UserTab"
|
||||||
|
export interface UserTab {
|
||||||
|
id: string; // 选项卡 ID
|
||||||
|
label: string; // 选项卡标题
|
||||||
|
component: Raw<Component>; // 选项卡面板组件
|
||||||
|
priority: number; // 排序优先级
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
其中,`component` 组件有以下实现要求:
|
||||||
|
|
||||||
|
1. 组件包含以下 props:
|
||||||
|
1. `user:DetailedUser`:当前用户信息。
|
@@ -224,6 +224,8 @@ module.exports = {
|
|||||||
"developer-guide/plugin/api-reference/ui/extension-points/theme-list-item-operation-create",
|
"developer-guide/plugin/api-reference/ui/extension-points/theme-list-item-operation-create",
|
||||||
"developer-guide/plugin/api-reference/ui/extension-points/plugin-list-item-field-create",
|
"developer-guide/plugin/api-reference/ui/extension-points/plugin-list-item-field-create",
|
||||||
"developer-guide/plugin/api-reference/ui/extension-points/post-list-item-field-create",
|
"developer-guide/plugin/api-reference/ui/extension-points/post-list-item-field-create",
|
||||||
|
"developer-guide/plugin/api-reference/ui/extension-points/user-detail-tabs-create",
|
||||||
|
"developer-guide/plugin/api-reference/ui/extension-points/uc-user-profile-tabs-create",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
Binary file not shown.
After Width: | Height: | Size: 76 KiB |
Reference in New Issue
Block a user