1

我们正在使用 SharePoint 框架扩展:命令集将自定义命令添加到上下文菜单和工具栏。

添加命令没有问题,而我们遇到了如何向自定义命令添加工具提示的问题。

1. 我们的 .manifest.json 文件内容是这样的:

 {
      "$schema": "https://dev.office.com/json-schemas/spfx/command-set-extension-manifest.schema.json",
      "id": "...",
      "alias": "DocumentLibraryCommandSet",
      "componentType": "Extension",
      "extensionType": "ListViewCommandSet",
      "requiresCustomScript": false,
      "items": {
        "SomeId": {
          "title": {
            "default": "some name"
          },
          "iconImageUrl": "...",
          "type": "command"
        },
    }
}

2. 我们添加了扩展“BaseListViewCommandSet”并覆盖的类:onInit、onListViewUpdated、onExecute。

export default class xxxtLibraryCommandSet extends BaseListViewCommandSet<xxx> {

    @override
    public onInit(): Promise<void> {
        return xxx;
    }

    @override
    public onListViewUpdated()
       xxx
    }

    @override
    public onExecute(xxx): void {
       xxx
    }

3. 班级

  • “BaseListViewCommandSet”扩展“BaseExtension”,有“上下文:ListViewCommandSetContext”
  • “ListViewCommandSetContext”具有“清单:ICommandSetExtensionManifest”
  • 这里是 'ICommandDefinition' 类型的 'items' 类型的项目:{ [itemId: string]: ICommandDefinition; };

而“ICommandDefinition”只有 4 个字段

(我无法在此处添加,例如描述或工具提示)

export interface ICommandDefinition {
    title: ILocalizedString;
    type: 'command';
    ariaLabel?: ILocalizedString;
    iconImageUrl?: string;
}

有人可以提示如何向自定义命令添加工具提示吗?

4

0 回答 0