Ant Design Vue Checkbox多选框属性事件列表

Ant Design Vue Checkbox多选框属性事件列表

Checkbox 属性

属性名称描述类型默认值
autoFocus自动获取焦点booleanfalse
checked是否选中booleanfalse
defaultChecked初始是否选中booleanfalse
disabled是否禁用booleanfalse
indeterminate设置 indeterminate 状态,只负责样式控制booleanfalse

Checkbox事件

事件名称描述回调参数
change当选中或取消选中时的事件Function(e)

Checkbox Group多选框组属性

属性名称描述类型默认值
defaultValue默认选中项string[][]
disabled是否禁用复选框组booleanfalse
name复选框组下所有 input[type="checkbox"] 的 name 
版本1.5.0+
string-
options指定可选项,可以通过 slot="label" slot-scope="option"
定制label
详情请点击查看
string[]或者
[{ label: string,
value: string ,
disabled?: boolean,
indeterminate?: boolean,
onChange?: function }]
[]
value指定选中的选项string[][]

Checkbox Group多选框组事件

事件名称描述回调参数
change当选中或取消选中时的事件Function(e)

Checkbox 方法

事件名称描述
blur()移除焦点 
focus()获取焦点

<!--focus()方法例子-->
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>focus方法例子</title>
    <script src="https://www.itxst.com/package/vue/vue.min.js"></script>
    <script src="https://www.itxst.com/package/ant-design-vue/antd.min.js"></script>
    <link href="https://www.itxst.com/package/ant-design-vue/antd.min.css" rel="stylesheet" />
    <style>
        body {
            padding-top: 10px
        }
    </style>
</head>
<body>
    <div id="app">
        <a-button type="primary" @click="jd">获取焦点</a-button>
        <br />
        <a-checkbox ref="ck" @change="onChange">多选框</a-checkbox>
    </div>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
            },
            methods: {
                onChange(e) {
                    alert(e.target.checked)
                },
                //调用focus()方法 *************************
                jd() {
                    this.$refs.ck.focus();
                }
            },
        });
    </script>
</body>
</html>