-
https://codesandbox.io/s/elastic-bartik-z3njw?file=/App.tsx import React from "react";
import {
Upload,
FormItem,
FormLayout,
FormButtonGroup,
Submit
} from "@formily/antd";
import { createForm } from "@formily/core";
import { FormProvider, createSchemaField } from "@formily/react";
import { Button } from "antd";
import { UploadOutlined } from "@ant-design/icons";
const UploadButton = (props) => {
return <Button icon={<UploadOutlined />}>上传图片</Button>;
};
const SchemaField = createSchemaField({
components: {
Upload,
FormItem
}
});
const form = createForm();
const schema = {
type: "object",
properties: {
upload: {
type: "array",
title: "上传",
required: true,
"x-decorator": "FormItem",
"x-component": "Upload",
"x-content": UploadButton
}
}
};
export default () => (
<FormProvider form={form}>
<FormLayout labelCol={6} wrapperCol={10}>
<SchemaField schema={schema} />
<FormButtonGroup.FormItem>
<Submit onSubmit={console.log}>提交</Submit>
</FormButtonGroup.FormItem>
</FormLayout>
</FormProvider>
); 在存在x-component的情况下,x-content是不是应该识别为component的子节点? |
Beta Was this translation helpful? Give feedback.
Answered by
janryWang
Jul 6, 2021
Replies: 1 comment
-
麻烦提个issue吧,这个是个Bug |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
janryWang
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
麻烦提个issue吧,这个是个Bug