扩展人员选取器以包括标签、输入框和按钮等表单项

Extending People Picker to include form items like labels, input boxes and buttons

我终于可以使用人员选择器来更新 SharePoint 列表了。

如何扩展它以使用标签、按钮和输入框等表单元素?

我看到了这段代码,但它在 this.props.data.Name 下划线并带有一条消息:

property data does not exist on type 'readonly'.

它还强调 onChange 表示它不存在于只读类型上。

    private _onChange = (e: React.KeyboardEvent) => {
       const name = this.props.data.Name;
       const value = (e.target as HTMLInputElement).value;
       this.props.onChange(name, value);
    }   

这是我的 class 的开始,包括构造函数。我担心如果我向界面添加更多属性,我可能会停止人员选择器的工作。

     export default class PnPPeoplePicker extends React.Component<IPnPPeoplePickerProps, IPnPPeoplePickerState> {  
       constructor(props: IPnPPeoplePickerProps, state: IPnPPeoplePickerState) 
       {
         super(props);

         this.state = {
           addUsers: []
         };
       }

您可以参考这里的解决方案:

SPFx React Form with People Picker/Taxonomy Picker using PnP Js & React Controls