我已经制作了一些自定义命令集,这些命令集正在命令栏中显示。我希望这些命令仅在文档集中显示,而不在其他任何地方显示。
我确实遵循了官方的Microsoft来构建命令集。 https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/building-simple-cmdset-with-dialog-api
答案 0 :(得分:0)
我回答了here
@override
public onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void {
const compareOneCommand: Command = this.tryGetCommand('COMMAND_1');
if (compareOneCommand) {
// This command should be hidden unless exactly one row is selected.
compareOneCommand.visible = this.context.pageContext.list.title === 'MyList3';
}
}