Skip to content

Commit

Permalink
📝 chore: add utils md
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmclin2 committed Aug 14, 2023
1 parent 72e0af8 commit cf31dc2
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions docs/pro-editor/utils.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: C2D2C 辅助函数
group:
title: 工具类库
order: 99
---

# generateJSXCode

该方法用于将组件属性配置拼接生成 jsx 代码。

```jsx | pure
import { generateJSXCode } from '@ant-design/pro-editor';

const config = {
children: '默认按钮',
target: '_blank',
type: 'default',
htmlType: 'button',
danger: false,
icon: '',
size: 'middle',
loading: true,
disabled: false,
ghost: false,
block: false,
};

const code = generateJSXCode('Button', config);
```

结果为:

```jsx | pure
<Button
target="_blank"
type="default"
htmlType="button"
danger={false}
size="middle"
loading
disabled={false}
ghost={false}
block={false}
>
默认按钮
</Button>
```

0 comments on commit cf31dc2

Please sign in to comment.