Skip to content

Commit

Permalink
docs(antd/checkbox): add an example of the checkbox change event (#17)
Browse files Browse the repository at this point in the history
Co-authored-by: feixiang.zhang <[email protected]>
  • Loading branch information
fisher-zh and feixiang.zhang authored Nov 9, 2023
1 parent 9f6fe64 commit 8246938
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/demos/checkbox/Schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions docs/demos/checkbox/Schema.zh-CN.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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',
Expand Down

0 comments on commit 8246938

Please sign in to comment.