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.

routable.js 3.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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; };
  6. var _vue = require('vue');
  7. var _vue2 = _interopRequireDefault(_vue);
  8. var _ripple = require('../directives/ripple');
  9. var _ripple2 = _interopRequireDefault(_ripple);
  10. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11. 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; }
  12. exports.default = _vue2.default.extend({
  13. name: 'routable',
  14. directives: {
  15. Ripple: _ripple2.default
  16. },
  17. props: {
  18. activeClass: String,
  19. append: Boolean,
  20. disabled: Boolean,
  21. exact: {
  22. type: Boolean,
  23. default: undefined
  24. },
  25. exactActiveClass: String,
  26. href: [String, Object],
  27. to: [String, Object],
  28. nuxt: Boolean,
  29. replace: Boolean,
  30. ripple: [Boolean, Object],
  31. tag: String,
  32. target: String
  33. },
  34. computed: {
  35. computedRipple: function computedRipple() {
  36. return this.ripple && !this.disabled ? this.ripple : false;
  37. }
  38. },
  39. methods: {
  40. click: function click(e) {
  41. this.$emit('click', e);
  42. },
  43. generateRouteLink: function generateRouteLink(classes) {
  44. var exact = this.exact;
  45. var tag = void 0;
  46. var data = _defineProperty({
  47. attrs: { disabled: this.disabled },
  48. class: classes,
  49. props: {},
  50. directives: [{
  51. name: 'ripple',
  52. value: this.computedRipple
  53. }]
  54. }, this.to ? 'nativeOn' : 'on', _extends({}, this.$listeners, {
  55. click: this.click
  56. }));
  57. if (typeof this.exact === 'undefined') {
  58. exact = this.to === '/' || this.to === Object(this.to) && this.to.path === '/';
  59. }
  60. if (this.to) {
  61. // Add a special activeClass hook
  62. // for component level styles
  63. var activeClass = this.activeClass;
  64. var exactActiveClass = this.exactActiveClass || activeClass;
  65. // TODO: apply only in VListTile
  66. if (this.proxyClass) {
  67. activeClass += ' ' + this.proxyClass;
  68. exactActiveClass += ' ' + this.proxyClass;
  69. }
  70. tag = this.nuxt ? 'nuxt-link' : 'router-link';
  71. Object.assign(data.props, {
  72. to: this.to,
  73. exact: exact,
  74. activeClass: activeClass,
  75. exactActiveClass: exactActiveClass,
  76. append: this.append,
  77. replace: this.replace
  78. });
  79. } else {
  80. tag = this.href && 'a' || this.tag || 'a';
  81. if (tag === 'a' && this.href) data.attrs.href = this.href;
  82. }
  83. if (this.target) data.attrs.target = this.target;
  84. return { tag: tag, data: data };
  85. }
  86. }
  87. });
  88. //# sourceMappingURL=routable.js.map