我们有 svg 图标作为组件,所以文件夹结构有点像
components
/ -- icons
-- Readme.md
/-- Check
-- Check.tsx
-- index.ts
/-- Cross
-- Cross.tsx
-- index.ts
/-- Cloud
-- Cloud.tsx
-- index.ts
显然我们不希望每个图标都有一个部分,我们希望有一个单独的部分来显示所有用法。所以我创建了这样的部分:
sections: [
{
name: 'Cards',
components: [
// ... other components,
]
},
{
name: 'Icons',
components: [
'components/icons/Check',
'components/icons/Cross',
'components/icons/Cloud',
],
content: path.resolve(__dirname, 'src', 'components', 'icon', 'readme.md')
},
],
但是文档显示
ReferenceError: Check is not defined
如果我Readme.md
在每个图标文件夹下添加一个,它会起作用,但这不是我想要的。
任何想法?