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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.factory = factory;
  6. var _vue = require('vue');
  7. var _vue2 = _interopRequireDefault(_vue);
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. 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; }
  10. function factory() {
  11. var _watch;
  12. var prop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'value';
  13. var event = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'input';
  14. return _vue2.default.extend({
  15. name: 'toggleable',
  16. model: { prop: prop, event: event },
  17. props: _defineProperty({}, prop, { required: false }),
  18. data: function data() {
  19. return {
  20. isActive: !!this[prop]
  21. };
  22. },
  23. watch: (_watch = {}, _defineProperty(_watch, prop, function (val) {
  24. this.isActive = !!val;
  25. }), _defineProperty(_watch, 'isActive', function isActive(val) {
  26. !!val !== this[prop] && this.$emit(event, val);
  27. }), _watch)
  28. });
  29. }
  30. /* eslint-disable-next-line no-redeclare */
  31. var Toggleable = factory();
  32. exports.default = Toggleable;
  33. //# sourceMappingURL=toggleable.js.map