yw-common-list
Version:
基于vxe-table封装的自定义可配置表格
49 lines (45 loc) • 898 B
JavaScript
import { createOption, destroyOption, assemOption } from './util'
const props = {
label: { type: [String, Number, Boolean], default: '' },
visible: { type: Boolean, default: null },
className: [String, Function],
disabled: Boolean
}
const watch = {}
Object.keys(props).forEach(name => {
watch[name] = function (value) {
this.optionConfig.update(name, value)
}
})
export default {
name: 'VxeOptgroup',
props,
provide () {
return {
$xeoptgroup: this
}
},
inject: {
$xeselect: {
default: null
}
},
computed: {
vSize () {
return this.size || this.$parent.size || this.$parent.vSize
}
},
watch,
mounted () {
assemOption(this)
},
created () {
this.optionConfig = createOption(this.$xeselect, this)
},
destroyed () {
destroyOption(this)
},
render (h) {
return h('div', this.$slots.default)
}
}