use*_*svm 6 javascript reactjs react-styleguidist
我正在尝试使用自定义组件创建样式指南。我需要能够在彼此之间插入组件,并且不确定如何在.md文件内部进行插入。我有一个清单和清单项目。我想在列表中显示列表项。在styleguidist显示中出现此错误。这是一些很好的例子,但没有一个例子说明我要完成的工作-https: //github.com/styleguidist/react-styleguidist/tree/master/examples/basic/src/components
语法错误:意外的令牌(3:0)1:从'./ListItem'中导入ListItem 2:3:
List.tsx
import React, { Component } from 'react'
import './List.css'
export interface IListProps {
/** Type of button to display */
font: string;
disabled: boolean;
mtmClass: string;
link: boolean;
}
class List extends Component<IListProps> {
render() {
const { children } = this.props
return <ul className={'mtm-list'}>{children}</ul>
}
}
export default List
Run Code Online (Sandbox Code Playgroud)
List.md
```js
import ListItem from './ListItem'
<List>
<ListItem>
Content in a List
</ListItem>
</List>
Run Code Online (Sandbox Code Playgroud)
ListItem.tsx
import React, { Component } from 'react'
import './List.css'
export interface IListItemProps {
/** Type of button to display */
font: string;
disabled: boolean;
mtmClass: string;
link: boolean;
}
class ListItem extends Component<IListItemProps> {
render() {
const { children } = this.props
return <li className={'mtm-list-item'}>{children}</li>
}
}
export default ListItem
Run Code Online (Sandbox Code Playgroud)
我必须将 .md 更改为这种格式并且它起作用了,特别是添加了分号。
```jsx
import React from 'react'
import Button from 'rsg-example/components/Button'
import Placeholder from 'rsg-example/components/Placeholder'
;<Button>
<Placeholder />
</Button>
```
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
139 次 |
| 最近记录: |