vxe-table
Version:
一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟滚动、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、虚拟列表、模态窗口、自定义模板、渲染器、贼灵活的配置项、扩展接口等...
42 lines (40 loc) • 997 B
JavaScript
import GlobalConfig from '../../conf'
export default {
name: 'VxeCheckboxGroup',
props: {
value: Array,
disabled: Boolean,
size: { type: String, default: () => GlobalConfig.checkbox.size || GlobalConfig.size }
},
provide () {
return {
$xecheckboxgroup: this
}
},
computed: {
vSize () {
return this.size || this.$parent.size || this.$parent.vSize
}
},
render (h) {
return h('div', {
class: 'vxe-checkbox-group'
}, this.$slots.default)
},
methods: {
handleChecked (params) {
const { checked, label } = params
const checklist = this.value || []
const checkIndex = checklist.indexOf(label)
if (checked) {
if (checkIndex === -1) {
checklist.push(label)
}
} else {
checklist.splice(checkIndex, 1)
}
this.$emit('input', checklist)
this.$emit('change', Object.assign({ checklist }, params))
}
}
}