Vue antdv复选框限制选择数量,默认禁用复选框






computed: {
    onSelectionChange() {
        let _this = this
        return {
            selectedRowKeys: _this.checkIdList,
            onchange(selectedRowKeys, selectedRows) {
                
                if (selectedRowKeys.length > 10) {
                    _this.$message.error('每次操作最多只能选择10条数据')
                    return
                }
                
                _this.checkIdList = []
                if(selectedRows.length > 0) {
                   selectedRows.forEach(s => {
                        _this.checkIdList .push(s.id)
                    })
                 }
                _this.selectedRows = selectedRows
            },
            
            getCheckboxProps: record => ({
                props: {
                    disabled: record.name !== '小红'
                 }
            })
        }
    }
}

你可能感兴趣的:(Vue antdv复选框限制选择数量,默认禁用复选框)