输入'{ 描述:字符串; }' 缺少类型 'IOrderFormWithReactProps' 中的以下属性:context、siteUrlts(2769)
Type '{ description: String; }' is missing the following properties from type 'IOrderFormWithReactProps': context, siteUrlts(2769)
我不知道为什么会出现这个错误。它显示 Type '{ description: String; }' 缺少类型 'IOrderFormWithReactProps' 中的以下属性:上下文、siteUrlts(2769)
***OrderFormreactWithWebpart.ts file:***
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import {
IPropertyPaneConfiguration,
PropertyPaneTextField
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart, WebPartContext } from '@microsoft/sp-webpart-base';
import * as strings from 'OrderFormWithReactWebPartStrings';
import OrderFormWithReact from './components/OrderFormWithReact';
import { IOrderFormWithReactProps } from './components/IOrderFormWithReactProps';
import { description } from 'OrderFormWithReactWebPartStrings';
export interface IOrderFormWithReactWebPartProps {
description: String;
context: WebPartContext;
siteUrl: any;
}
export default class OrderFormWithReactWebPart extends BaseClientSideWebPart<IOrderFormWithReactWebPartProps> {
public render(): void {
const element: React.ReactElement<IOrderFormWithReactProps> = React.createElement(
OrderFormWithReact,
{
description: this.properties.description
}
);
ReactDom.render(element, this.domElement);
}
protected onDispose(): void {
ReactDom.unmountComponentAtNode(this.domElement);
}
***IOrderFormWithReactProps.ts file***
import { WebPartContext } from "@microsoft/sp-webpart-base";
export interface IOrderFormWithReactProps {
description: String;
context: WebPartContext;
siteUrl: any;
}
这是道具文件的界面
您的 OrderFormWithReact
需要 description
、context
和 siteUrl
。你只给它 description
.
const element: React.ReactElement<IOrderFormWithReactProps> = React.createElement(
OrderFormWithReact,
{
description: this.properties.description
}
);
试试这个。它只是将 OrderFormWithReactWebPart
的属性传递给 OrderFormWithReact
。 (所以要求OrderFormWithReactWebPart
的属性包括context
和siteUrl
。)
const element: React.ReactElement<IOrderFormWithReactProps> = React.createElement(
OrderFormWithReact,
this.properties
);
我不知道为什么会出现这个错误。它显示 Type '{ description: String; }' 缺少类型 'IOrderFormWithReactProps' 中的以下属性:上下文、siteUrlts(2769)
***OrderFormreactWithWebpart.ts file:***
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import {
IPropertyPaneConfiguration,
PropertyPaneTextField
} from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart, WebPartContext } from '@microsoft/sp-webpart-base';
import * as strings from 'OrderFormWithReactWebPartStrings';
import OrderFormWithReact from './components/OrderFormWithReact';
import { IOrderFormWithReactProps } from './components/IOrderFormWithReactProps';
import { description } from 'OrderFormWithReactWebPartStrings';
export interface IOrderFormWithReactWebPartProps {
description: String;
context: WebPartContext;
siteUrl: any;
}
export default class OrderFormWithReactWebPart extends BaseClientSideWebPart<IOrderFormWithReactWebPartProps> {
public render(): void {
const element: React.ReactElement<IOrderFormWithReactProps> = React.createElement(
OrderFormWithReact,
{
description: this.properties.description
}
);
ReactDom.render(element, this.domElement);
}
protected onDispose(): void {
ReactDom.unmountComponentAtNode(this.domElement);
}
***IOrderFormWithReactProps.ts file***
import { WebPartContext } from "@microsoft/sp-webpart-base";
export interface IOrderFormWithReactProps {
description: String;
context: WebPartContext;
siteUrl: any;
}
这是道具文件的界面
您的 OrderFormWithReact
需要 description
、context
和 siteUrl
。你只给它 description
.
const element: React.ReactElement<IOrderFormWithReactProps> = React.createElement(
OrderFormWithReact,
{
description: this.properties.description
}
);
试试这个。它只是将 OrderFormWithReactWebPart
的属性传递给 OrderFormWithReact
。 (所以要求OrderFormWithReactWebPart
的属性包括context
和siteUrl
。)
const element: React.ReactElement<IOrderFormWithReactProps> = React.createElement(
OrderFormWithReact,
this.properties
);