diff --git a/docs/developer-guide/plugin/api-reference/ui/extension-points/uc-user-profile-tabs-create.md b/docs/developer-guide/plugin/api-reference/ui/extension-points/uc-user-profile-tabs-create.md new file mode 100644 index 0000000..36dc0c9 --- /dev/null +++ b/docs/developer-guide/plugin/api-reference/ui/extension-points/uc-user-profile-tabs-create.md @@ -0,0 +1,41 @@ +--- +title: 个人资料选项卡 +description: 扩展个人中心的个人资料选项卡 - uc:user:profile:tabs:create +--- + +此扩展点用于扩展个人中心的个人资料选项卡。 + +![个人资料选项卡](/img/developer-guide/plugin/api-reference/ui/extension-points/uc-user-profile-tabs-create.png) + +## 定义方式 + +```ts +export default definePlugin({ + extensionPoints: { + "uc:user:profile:tabs:create": (): UserProfileTab[] | Promise => { + return [ + { + id: "foo", + label: "foo", + component: markRaw(FooComponent), + priority: 20, + }, + ]; + }, + }, +}); +``` + +```ts title="UserProfileTab" +export interface UserProfileTab { + id: string; // 选项卡 ID + label: string; // 选项卡标题 + component: Raw; // 选项卡面板组件 + priority: number; // 排序优先级 +} +``` + +其中,`component` 组件有以下实现要求: + +1. 组件包含以下 props: + 1. `user:DetailedUser`:当前用户信息。 diff --git a/docs/developer-guide/plugin/api-reference/ui/extension-points/user-detail-tabs-create.md b/docs/developer-guide/plugin/api-reference/ui/extension-points/user-detail-tabs-create.md new file mode 100644 index 0000000..68e8316 --- /dev/null +++ b/docs/developer-guide/plugin/api-reference/ui/extension-points/user-detail-tabs-create.md @@ -0,0 +1,41 @@ +--- +title: 用户详情选项卡 +description: 扩展用户详情选项卡 - user:detail:tabs:create +--- + +此扩展点用于扩展用户详情页面的选项卡。 + +![用户详情选项卡](/img/developer-guide/plugin/api-reference/ui/extension-points/user-detail-tabs-create.png) + +## 定义方式 + +```ts +export default definePlugin({ + extensionPoints: { + "user:detail:tabs:create": (): UserTab[] | Promise => { + return [ + { + id: "foo", + label: "foo", + component: markRaw(FooComponent), + priority: 20, + }, + ]; + }, + }, +}); +``` + +```ts title="UserTab" +export interface UserTab { + id: string; // 选项卡 ID + label: string; // 选项卡标题 + component: Raw; // 选项卡面板组件 + priority: number; // 排序优先级 +} +``` + +其中,`component` 组件有以下实现要求: + +1. 组件包含以下 props: + 1. `user:DetailedUser`:当前用户信息。 diff --git a/sidebars.js b/sidebars.js index 1be18fb..18d3ad4 100644 --- a/sidebars.js +++ b/sidebars.js @@ -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/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/user-detail-tabs-create", + "developer-guide/plugin/api-reference/ui/extension-points/uc-user-profile-tabs-create", ], }, { diff --git a/static/img/developer-guide/plugin/api-reference/ui/extension-points/uc-user-profile-tabs-create.png b/static/img/developer-guide/plugin/api-reference/ui/extension-points/uc-user-profile-tabs-create.png new file mode 100644 index 0000000..40b90b2 Binary files /dev/null and b/static/img/developer-guide/plugin/api-reference/ui/extension-points/uc-user-profile-tabs-create.png differ diff --git a/static/img/developer-guide/plugin/api-reference/ui/extension-points/user-detail-tabs-create.png b/static/img/developer-guide/plugin/api-reference/ui/extension-points/user-detail-tabs-create.png new file mode 100644 index 0000000..2e30888 Binary files /dev/null and b/static/img/developer-guide/plugin/api-reference/ui/extension-points/user-detail-tabs-create.png differ