line_push/node_modules/vuetify/lib/mixins/toggleable/index.js
2022-07-21 03:28:35 +00:00

37 lines
627 B
JavaScript

import Vue from 'vue';
export function factory(prop = 'value', event = 'input') {
return Vue.extend({
name: 'toggleable',
model: {
prop,
event
},
props: {
[prop]: {
required: false
}
},
data() {
return {
isActive: !!this[prop]
};
},
watch: {
[prop](val) {
this.isActive = !!val;
},
isActive(val) {
!!val !== this[prop] && this.$emit(event, val);
}
}
});
}
/* eslint-disable-next-line no-redeclare */
const Toggleable = factory();
export default Toggleable;
//# sourceMappingURL=index.js.map