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.

VSnackbar.js 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. require('../../../src/stylus/components/_snackbars.styl');
  6. var _colorable = require('../../mixins/colorable');
  7. var _colorable2 = _interopRequireDefault(_colorable);
  8. var _toggleable = require('../../mixins/toggleable');
  9. var _toggleable2 = _interopRequireDefault(_toggleable);
  10. var _positionable = require('../../mixins/positionable');
  11. var _mixins = require('../../util/mixins');
  12. var _mixins2 = _interopRequireDefault(_mixins);
  13. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14. exports.default = (0, _mixins2.default)(_colorable2.default, _toggleable2.default, (0, _positionable.factory)(['absolute', 'top', 'bottom', 'left', 'right'])
  15. /* @vue/component */
  16. ).extend({
  17. name: 'v-snackbar',
  18. props: {
  19. autoHeight: Boolean,
  20. multiLine: Boolean,
  21. // TODO: change this to closeDelay to match other API in delayable.js
  22. timeout: {
  23. type: Number,
  24. default: 6000
  25. },
  26. vertical: Boolean
  27. },
  28. data: function data() {
  29. return {
  30. activeTimeout: -1
  31. };
  32. },
  33. computed: {
  34. classes: function classes() {
  35. return {
  36. 'v-snack--active': this.isActive,
  37. 'v-snack--absolute': this.absolute,
  38. 'v-snack--auto-height': this.autoHeight,
  39. 'v-snack--bottom': this.bottom || !this.top,
  40. 'v-snack--left': this.left,
  41. 'v-snack--multi-line': this.multiLine && !this.vertical,
  42. 'v-snack--right': this.right,
  43. 'v-snack--top': this.top,
  44. 'v-snack--vertical': this.vertical
  45. };
  46. }
  47. },
  48. watch: {
  49. isActive: function isActive() {
  50. this.setTimeout();
  51. }
  52. },
  53. mounted: function mounted() {
  54. this.setTimeout();
  55. },
  56. methods: {
  57. setTimeout: function setTimeout() {
  58. var _this = this;
  59. window.clearTimeout(this.activeTimeout);
  60. if (this.isActive && this.timeout) {
  61. this.activeTimeout = window.setTimeout(function () {
  62. _this.isActive = false;
  63. }, this.timeout);
  64. }
  65. }
  66. },
  67. render: function render(h) {
  68. return h('transition', {
  69. attrs: { name: 'v-snack-transition' }
  70. }, this.isActive && [h('div', {
  71. staticClass: 'v-snack',
  72. class: this.classes,
  73. on: this.$listeners
  74. }, [h('div', this.setBackgroundColor(this.color, {
  75. staticClass: 'v-snack__wrapper'
  76. }), [h('div', {
  77. staticClass: 'v-snack__content'
  78. }, this.$slots.default)])])]);
  79. }
  80. });
  81. //# sourceMappingURL=VSnackbar.js.map