.Net Core 2.0 中的 SwashBuckle UI 显示错误

问题描述

我刚刚安装了 Swashbuckle.AspNetCore 5.6.3 并在需要的地方进行了所有配置。

当我运行调试器并通过浏览器获取 localhost:65183/swagger/index.html 时,它在控制台中显示以下错误

未捕获的类型错误:无法读取未定义的属性“forEach” 在 window.onload (index.html:51) window.onload @ index.html:51 加载(异步) (匿名)@index.html:46

我有以下文件夹结构。这是我在 Visual Studio 中的项目的屏幕截图。

Project Structure

解决方法

我想出了问题。我错过了配置中的一行。

这一行

type BoxProps = { boxProp: boolean }

const Box = styled('div')<BoxProps>

const MyBox: React.FC<BoxProps> = ({ boxProp }) => {
  return (
    <Box boxProp={boxProp} />
  )
}