我最近偶然发现了一个应该很简单的分享点问题,我无法让它发挥作用:(。
在这里的代码中我有一个简单的搜索框没有什么特别之处
import * as React from 'react';
import { SearchBox } from 'office-ui-fabric-react/lib/SearchBox';
export class Searchbox extends React.Component<any, any> {
public render() {
return (
<SearchBox/>
);
}
}
在搜索框下,我想根据https://sharepoint.github.io/sp-dev-fx-property-controls/controls/PropertyFieldPeoplePicker/
添加一个人员选择器(与搜索框无关)这基本上意味着:添加这几行锥体
import { PropertyFieldPeoplePicker, PrincipalType } from '@pnp/spfx-property-controls/lib/PropertyFieldPeoplePicker';
import { IPropertyFieldGroupOrPerson } from "@pnp/spfx-property-controls/lib/PropertyFieldPeoplePicker";
export interface IPropertyControlsTestWebPartProps {
people: IPropertyFieldGroupOrPerson[];
}
根据以上链接,我必须使用此功能,才能使用人员选择器。
PropertyFieldPeoplePicker('people', {
label: 'PropertyFieldPeoplePicker',
initialData: this.properties.people,
allowDuplicate: false,
principalType: [PrincipalType.Users, PrincipalType.SharePoint,
PrincipalType.Security],
onPropertyChange: this.onPropertyPaneFieldChanged,
context: this.context,
properties: this.properties,
onGetErrorMessage: null,
deferredValidationTime: 0,
key: 'peopleFieldId'
})
但无论我做什么,我都无法在搜索框下面添加人物选择器
任何人都可以告诉我它是如何完成的吗? 非常感谢你!
我已经完成了入门部分,但我只是无法让人员选择器选项卡出现,我甚至无法编译:/