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.

VTab.js 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; // Mixins
  6. // Utilities
  7. var _groupable = require('../../mixins/groupable');
  8. var _routable = require('../../mixins/routable');
  9. var _routable2 = _interopRequireDefault(_routable);
  10. var _themeable = require('../../mixins/themeable');
  11. var _themeable2 = _interopRequireDefault(_themeable);
  12. var _helpers = require('../../util/helpers');
  13. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14. /* @vue/component */
  15. exports.default = {
  16. name: 'v-tab',
  17. mixins: [_routable2.default,
  18. // Must be after routable
  19. // to overwrite activeClass
  20. (0, _groupable.factory)('tabGroup'), _themeable2.default],
  21. props: {
  22. ripple: {
  23. type: [Boolean, Object],
  24. default: true
  25. }
  26. },
  27. computed: {
  28. classes: function classes() {
  29. return _extends({
  30. 'v-tabs__item': true,
  31. 'v-tabs__item--disabled': this.disabled
  32. }, this.groupClasses);
  33. },
  34. value: function value() {
  35. var to = this.to || this.href || '';
  36. if (this.$router && this.to === Object(this.to)) {
  37. var resolve = this.$router.resolve(this.to, this.$route, this.append);
  38. to = resolve.href;
  39. }
  40. return to.replace('#', '');
  41. }
  42. },
  43. watch: {
  44. $route: 'onRouteChange'
  45. },
  46. mounted: function mounted() {
  47. this.onRouteChange();
  48. },
  49. methods: {
  50. click: function click(e) {
  51. // If user provides an
  52. // actual link, do not
  53. // prevent default
  54. if (this.href && this.href.indexOf('#') > -1) e.preventDefault();
  55. this.$emit('click', e);
  56. this.to || this.toggle();
  57. },
  58. onRouteChange: function onRouteChange() {
  59. var _this = this;
  60. if (!this.to || !this.$refs.link) return;
  61. var path = '_vnode.data.class.' + this.activeClass;
  62. this.$nextTick(function () {
  63. if ((0, _helpers.getObjectValueByPath)(_this.$refs.link, path)) {
  64. _this.toggle();
  65. }
  66. });
  67. }
  68. },
  69. render: function render(h) {
  70. var link = this.generateRouteLink(this.classes);
  71. var data = link.data;
  72. // If disabled, use div as anchor tags do not support
  73. // being disabled
  74. var tag = this.disabled ? 'div' : link.tag;
  75. data.ref = 'link';
  76. return h('div', {
  77. staticClass: 'v-tabs__div'
  78. }, [h(tag, data, this.$slots.default)]);
  79. }
  80. };
  81. //# sourceMappingURL=VTab.js.map