This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/vuetify/lib/components/VTabs/VTab.js
2019-08-11 20:48:02 +02:00

82 lines
No EOL
1.9 KiB
JavaScript

// Mixins
import { factory as GroupableFactory } from '../../mixins/groupable';
import Routable from '../../mixins/routable';
import Themeable from '../../mixins/themeable'; // Utilities
import { keyCodes } from './../../util/helpers';
import mixins from '../../util/mixins';
const baseMixins = mixins(Routable, // Must be after routable
// to overwrite activeClass
GroupableFactory('tabsBar'), Themeable);
export default baseMixins.extend().extend().extend({
name: 'v-tab',
props: {
ripple: {
type: [Boolean, Object],
default: true
}
},
data: () => ({
proxyClass: 'v-tab--active'
}),
computed: {
classes() {
return {
'v-tab': true,
...Routable.options.computed.classes.call(this),
'v-tab--disabled': this.disabled,
...this.groupClasses
};
},
value() {
let to = this.to || this.href || '';
if (this.$router && this.to === Object(this.to)) {
const resolve = this.$router.resolve(this.to, this.$route, this.append);
to = resolve.href;
}
return to.replace('#', '');
}
},
mounted() {
this.onRouteChange();
},
methods: {
click(e) {
// If user provides an
// actual link, do not
// prevent default
if (this.href && this.href.indexOf('#') > -1) e.preventDefault();
if (e.detail) this.$el.blur();
this.$emit('click', e);
this.to || this.toggle();
}
},
render(h) {
const {
tag,
data
} = this.generateRouteLink();
data.attrs = { ...data.attrs,
'aria-selected': String(this.isActive),
role: 'tab',
tabindex: 0
};
data.on = { ...data.on,
keydown: e => {
if (e.keyCode === keyCodes.enter) this.click(e);
this.$emit('keydown', e);
}
};
return h(tag, data, this.$slots.default);
}
});
//# sourceMappingURL=VTab.js.map