【问题标题】:How to use fallbackDetails in SPFx react如何在 SPFx 反应中使用 fallbackDetails
【发布时间】:2021-06-08 23:16:30
【问题描述】:

我正在使用@microsoft/mgt-react": "^2.1.0",我在文档中看到了“fallbackDetails”,但没有示例如何使用它。

我试过了:

    return (<td title={uName} >
     <Person personQuery={email} showPresence={true} view={PersonViewType.oneline} 
      **fallbackDetails={fallback } //Here Tslint Error**
      personCardInteraction={PersonCardInteraction.hover} />
      </td>
    );

问题是:

fallbackDetails: IDynamicPerson; personCardInteraction: PersonCardInteraction.hover; }' is not assignable to type 'IntrinsicAttributes & PersonProps & { children?: ReactNode; }'.
  Property 'fallbackDetails' does not exist on type 'IntrinsicAttributes & PersonProps & { children?: ReactNode; }'.ts(2322)

谁能提供一个 TypeScript 可以接受的例子? 或者我需要获取一个 Types.d.ts

提前致谢

【问题讨论】:

    标签: typescript-typings microsoft-graph-toolkit


    【解决方案1】:

    我收到了来自 mgt 的消息。 格式应为: fallbackDetails={{"displayName":"test displayName" , mail:"someone@contoso.com"}}

    抱怨是因为我有第二个电子邮件地址:“someone@contoso.com”

    现在一切都很好。 谢谢大家

    【讨论】:

      【解决方案2】:

      我会重新检查任何其他 mgt-* 包,以确保它们也已升级,以及您提供给它的后备对象。

      最基本的反应示例如下所示:

              <Person
                personQuery={'me'}
                fallbackDetails={{"displayName":"test displayName"}}
                line2clicked={() => console.log('line1 clicked')}
                line1Property="displayName"
                line2Property="mail"
                view={PersonViewType.twolines}
              />
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2022-10-05
        • 2021-04-06
        • 2019-12-19
        • 2021-06-10
        • 2018-10-25
        • 2021-12-20
        • 2021-08-11
        相关资源
        最近更新 更多