Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

toggleable.js 1.1KB

123456789101112131415161718192021222324252627282930
  1. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  2. import Vue from 'vue';
  3. export function factory() {
  4. var _watch;
  5. var prop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'value';
  6. var event = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'input';
  7. return Vue.extend({
  8. name: 'toggleable',
  9. model: { prop: prop, event: event },
  10. props: _defineProperty({}, prop, { required: false }),
  11. data: function data() {
  12. return {
  13. isActive: !!this[prop]
  14. };
  15. },
  16. watch: (_watch = {}, _defineProperty(_watch, prop, function (val) {
  17. this.isActive = !!val;
  18. }), _defineProperty(_watch, 'isActive', function isActive(val) {
  19. !!val !== this[prop] && this.$emit(event, val);
  20. }), _watch)
  21. });
  22. }
  23. /* eslint-disable-next-line no-redeclare */
  24. var Toggleable = factory();
  25. export default Toggleable;
  26. //# sourceMappingURL=toggleable.js.map