正如标题所述,我试图在我的PropertyFieldCollectionData属性窗格中使用SPFx。但是当我运行代码并试图在人中搜索时,什么也没有出现,甚至连我自己也没有。
不知道这是否有帮助,但这也是进口品
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import {
IPropertyPaneConfiguration,
IPropertyPaneDropdownOption,
PropertyPaneTextField
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart, WebPartContext } from '@microsoft/sp-webpart-base';
import * as strings from 'FaqProjectWebPartStrings';
import FaqProject from './components/FaqProject';
import { IFaqProjectProps } from './components/FaqProject';
import { PropertyFieldListPicker, PropertyFieldListPickerOrderBy } from '@pnp/spfx-property-controls/lib/PropertyFieldListPicker';
import { IPropertyFieldGroupOrPerson, PropertyFieldDropdownWithCallout, PropertyFieldPeoplePicker } from '@pnp/spfx-property-controls';
import { CalloutTriggers } from '@pnp/spfx-property-controls/lib/PropertyFieldHeader';
import { PropertyFieldToggleWithCallout } from '@pnp/spfx-property-controls/lib/PropertyFieldToggleWithCallout';
import { PropertyFieldCollectionData, CustomCollectionFieldType } from '@pnp/spfx-property-controls/lib/PropertyFieldCollectionData';
import { PeoplePicker, PrincipalType } from '@pnp/spfx-controls-react/lib/PeoplePicker';我的FaqProjectWebPart.ts中的示例代码
PropertyFieldCollectionData("collectionData", {
key: "collectionData",
label: "Collection data",
panelHeader: "Collection data panel header",
manageBtnLabel: "Manage collection data",
value: this.properties.collectionData,
fields: [
{
id: "Title",
title: "Name",
type: CustomCollectionFieldType.string,
required: true
},
{
id: "Group",
title: "Choose a group",
type: CustomCollectionFieldType.custom,
onCustomRender: (field, value, onUpdate, item, itemId, onError) => {
return (
React.createElement(PeoplePicker, {
context: this.context as any ,
personSelectionLimit: 1,
showtooltip: true,
key: itemId,
defaultSelectedUsers: [item.customFieldId],
onChange: (items: any[]) => {
console.log("Items", items);
item.customFieldId = items[0].secondaryText;
onUpdate(field.id, items[0].secondaryText);
},
showHiddenInUI: false,
principalTypes: [PrincipalType.User]
})
)
},
},
],
disabled: false
}),道具
export interface IFaqProjectWebPartProps {
description: string;
faqListId: string;
categoryListId: string;
subCategoryListId: string;
panelViewToggle: boolean;
people: IPropertyFieldGroupOrPerson[];
collectionData: any[];
}发布于 2022-09-29 10:31:27
在库(在3.11中修复)的3.10版本中似乎有一个错误导致了这种行为。为了解决这个问题,可以回滚到3.9
https://stackoverflow.com/questions/73880650
复制相似问题