页面数据列表显示字段
此扩展点用于扩展页面数据列表的显示字段。

定义方式
EntityFieldItem
示例
此示例将添加一个显示页面 slug(别名)的字段。
类型定义
ListedSinglePage
ListedSinglePage 由 @halo-dev/api-client 提供,请直接使用当前依赖中的生成类型。它包含:
page:独立页面资源。owner和contributors:页面所有者与贡献者。stats:访问、评论等统计数据。
此扩展点用于扩展页面数据列表的显示字段。

export default definePlugin({
extensionPoints: {
"single-page:list-item:field:create": (
singlePage: Ref<ListedSinglePage>,
): EntityFieldItem[] => {
return [
{
priority: 0,
position: "start",
component: markRaw(FooComponent),
props: {},
permissions: [],
hidden: false,
},
];
},
},
});export interface EntityFieldItem {
priority: number;
position: "start" | "end";
component: Raw<Component>;
props?: Record\<string, unknown\>;
permissions?: string[];
hidden?: boolean;
}此示例将添加一个显示页面 slug(别名)的字段。
import { definePlugin } from "@halo-dev/ui-shared";
import { markRaw, type Ref } from "vue";
import type { ListedSinglePage } from "@halo-dev/api-client";
import { VEntityField } from "@halo-dev/components";
export default definePlugin({
extensionPoints: {
"single-page:list-item:field:create": (
singlePage: Ref<ListedSinglePage>,
) => {
return [
{
priority: 0,
position: "end",
component: markRaw(VEntityField),
props: {
description: singlePage.value.page.spec.slug,
},
permissions: [],
hidden: false,
},
];
},
},
});ListedSinglePage 由 @halo-dev/api-client 提供,请直接使用当前依赖中的生成类型。它包含:
page:独立页面资源。owner 和 contributors:页面所有者与贡献者。stats:访问、评论等统计数据。