From cf31dc25bdfea2b165fadc2c11c1a5d8b5fef922 Mon Sep 17 00:00:00 2001 From: rdmclin2 Date: Mon, 14 Aug 2023 17:00:09 +0800 Subject: [PATCH] :memo: chore: add utils md --- docs/pro-editor/utils.md | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 docs/pro-editor/utils.md diff --git a/docs/pro-editor/utils.md b/docs/pro-editor/utils.md new file mode 100644 index 00000000..c05ef5ad --- /dev/null +++ b/docs/pro-editor/utils.md @@ -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 + +```