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

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