Checkbox
Rules
Basic Example
js
const rule = {
type:"checkbox",
title:"Label",
field:"label",
value:["1","2","3"],
options:[
{value:"1",label:"Easy to Use",disabled:true},
{value:"2",label:"Convenient",disabled:false},
{value:"3",label:"Practical",disabled:false},
{value:"4",label:"Effective",disabled:false},
]
}Props Configuration Examples
Disabled State
js
const rule = {
type:"checkbox",
title:"Permission Settings",
field:"permissions",
value:["1"],
options:[
{value:"1",label:"View",disabled:false},
{value:"2",label:"Edit",disabled:true},
{value:"3",label:"Delete",disabled:true},
],
props: {
disabled: false,
},
}Events Examples
Listen to Selection Changes
js
const rule = {
type:"checkbox",
title:"Product Tags",
field:"tags",
value:["1"],
options:[
{value:"1",label:"Hot Sale"},
{value:"2",label:"New Product"},
{value:"3",label:"Recommended"},
],
on: {
change: (checkedValue) => {
console.log('Selection value changed:', checkedValue);
},
},
}Linkage Update After Selection
js
const rule = [
{
type:"checkbox",
title:"Product Tags",
field:"tags",
value:[],
options:[
{value:"1",label:"Hot Sale"},
{value:"2",label:"New Product"},
{value:"3",label:"Recommended"},
],
inject: true,
on: {
change: ($inject, checkedValue) => {
// Based on the number of selected tags, automatically set product status
if (checkedValue.length >= 2) {
$inject.api.setValue('status', 'active');
} else {
$inject.api.setValue('status', 'inactive');
}
},
},
},
{
type:"input",
title:"Product Status",
field:"status",
props: {
disabled: true,
},
},
]Complete configuration items: Ant-design-vue_Checkbox
value :Array
Options
| Field Name | Description | Field Type | Required | Default Value |
|---|---|---|---|---|
| value | Parameter value | String,Number | true | - |
| label | Field alias | String | true | - |
| disabled | Set to disabled state | Boolean | false | false |
Props
| Parameter | Description | Type | Default |
|---|---|---|---|
| disabled | Entire group disabled | boolean | false |
| name | name attribute for all input[type="checkbox"] under CheckboxGroup | string | - |
| options | Specify options, can customize label through slot="label" slot-scope="option" | string[] | Array<{ label: string value: string disabled?: boolean, indeterminate?: boolean, onChange?: function }> | [] |
Events
| Event Name | Description | Callback Parameters |
|---|---|---|
| change | Callback function when changed | Function(checkedValue) |


