From 82469383cf06a82845af5fa8fe2cb28bebf8eee2 Mon Sep 17 00:00:00 2001 From: zhangfeixiang Date: Thu, 9 Nov 2023 19:21:12 +0800 Subject: [PATCH] docs(antd/checkbox): add an example of the checkbox change event (#17) Co-authored-by: feixiang.zhang --- docs/demos/checkbox/Schema.tsx | 6 ++++++ docs/demos/checkbox/Schema.zh-CN.tsx | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/docs/demos/checkbox/Schema.tsx b/docs/demos/checkbox/Schema.tsx index be42253..85aa3eb 100644 --- a/docs/demos/checkbox/Schema.tsx +++ b/docs/demos/checkbox/Schema.tsx @@ -2,6 +2,7 @@ import React from 'react' import { Checkbox, FormItem, FormButtonGroup, Submit } from '@formily/antd-v5' import { createForm } from '@formily/core' import { FormProvider, createSchemaField } from '@formily/react' +import type { CheckboxChangeEvent } from 'antd/es/checkbox' const SchemaField = createSchemaField({ components: { @@ -20,6 +21,11 @@ const schema = { title: 'Are you sure', 'x-decorator': 'FormItem', 'x-component': 'Checkbox', + 'x-component-props': { + onInput(e: CheckboxChangeEvent) { + console.log(`checked = ${e.target.checked}`) + }, + }, }, multiple: { type: 'array', diff --git a/docs/demos/checkbox/Schema.zh-CN.tsx b/docs/demos/checkbox/Schema.zh-CN.tsx index 82a97c4..ab5cbf8 100644 --- a/docs/demos/checkbox/Schema.zh-CN.tsx +++ b/docs/demos/checkbox/Schema.zh-CN.tsx @@ -2,6 +2,7 @@ import React from 'react' import { Checkbox, FormItem, FormButtonGroup, Submit } from '@formily/antd-v5' import { createForm } from '@formily/core' import { FormProvider, createSchemaField } from '@formily/react' +import type { CheckboxChangeEvent } from 'antd/es/checkbox' const SchemaField = createSchemaField({ components: { @@ -20,6 +21,11 @@ const schema = { title: '是否确认', 'x-decorator': 'FormItem', 'x-component': 'Checkbox', + 'x-component-props': { + onInput(e: CheckboxChangeEvent) { + console.log(`checked = ${e.target.checked}`) + }, + }, }, multiple: { type: 'array',