【问题标题】:Unable to load component properly from @fluentui/react-northstar@0.48.0 in a spfx webpart无法从 spfx webpart 中的 @fluentui/react-northstar@0.48.0 正确加载组件
【发布时间】:2020-12-10 22:03:48
【问题描述】:

我正在使用@fluentui/react-northstar 轮播组件link。它似乎解决了我的问题,但是在将它加载到 spfx 时,它没有采用任何默认的 css 等。我的 webpart 只是以垂直方式显示图像,而不是显示正确的轮​​播。请找到我的代码here

我也尝试过 react-material carousel,但为此我也面临同样的问题。

【问题讨论】:

  • 您好实际上不需要代码,我只是使用在@fluentui/react-northstar npm 中预构建的 Web 部件

标签: reactjs sharepoint carousel spfx fluent-ui


【解决方案1】:

我基于 spfx/react 创建了 'hello word' webpart 并插入了提到的组件,它在这里运行良好:

这是我的测试演示:

BR


//////////----更新---/////////////////


基于文档中的示例,我添加了如下缩略图功能:

我认为它运作良好,就像示例显示的那样。可以试试吗?

【讨论】:

  • 您好,感谢您的回复。但这不能满足我的要求。我需要轮播和缩略图(例如:fluentsite.z22.web.core.windows.net/components/carousel/...)。我同样无法做到。我能够在没有缩略图的情况下找到 Carousel 的解决方案,但遗憾的是这不是必需的。当我打开导航并全部打开缩略图时,它会奇怪地工作。我还检查了您的代码,如果我们这样做,它也可以正常工作。
  • 我是这样做的:<Carousel ariaRoleDescription="carousel" ariaLabel="Portrait collection" thumbnails navigation={{ 'aria-label': 'people portraits', items: carouselItems.map((item, index) => ({ key: index, 'aria-controls': item.id, 'aria-label': item['aria-label'], content: item.thumbnail, })), }} items={carouselItems} getItemPositionText={(index: number, size: number) => ${index + 1} of ${size}} />
  • --update-- 嘿,它解决了问题,问题是我不知道我必须使用 。非常感谢你帮助我成长。我阅读了 Providerhere 的文档。但没有找到 teamTheme 作为道具。你在哪里找到了teamTheme和所有东西?这还提供了哪些其他类型的主题解决方案?再次感谢。 @Baker_Kong_MSFT 我还尝试了其他 npm carousel(反应材料轮播)包,如果使用它,我们应该在那里传递什么?我也遇到了同样的问题
猜你喜欢
  • 1970-01-01
  • 2022-08-09
  • 1970-01-01
  • 2022-06-24
  • 2021-04-20
  • 2021-03-31
  • 2022-11-23
  • 2021-03-03
  • 2022-11-10
相关资源
最近更新 更多