vuetify
Version:
Vue Material Component Framework
55 lines (45 loc) • 1.09 kB
JavaScript
// Mixins
import { inject as RegistrableInject } from '../registrable';
export function factory(namespace, child, parent) {
return RegistrableInject(namespace, child, parent).extend({
name: 'groupable',
props: {
activeClass: {
type: String,
default() {
if (!this[namespace]) return undefined;
return this[namespace].activeClass;
}
},
disabled: Boolean
},
data() {
return {
isActive: false
};
},
computed: {
groupClasses() {
if (!this.activeClass) return {};
return {
[this.activeClass]: this.isActive
};
}
},
created() {
this[namespace] && this[namespace].register(this);
},
beforeDestroy() {
this[namespace] && this[namespace].unregister(this);
},
methods: {
toggle() {
this.$emit('change');
}
}
});
}
/* eslint-disable-next-line @typescript-eslint/no-redeclare */
const Groupable = factory('itemGroup');
export default Groupable;
//# sourceMappingURL=index.js.map