vuetify
Version:
Vue.js 2 Semantic Component Framework
61 lines (56 loc) • 1.49 kB
JavaScript
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Tabs computed
*
* @mixin
*/
exports.default = {
computed: {
activeIndex: function activeIndex() {
var _this = this;
return this.tabs.findIndex(function (tab, index) {
var id = tab.action === tab ? index.toString() : tab.action;
return id === _this.lazyValue;
});
},
activeTab: function activeTab() {
if (!this.tabs.length) return undefined;
return this.tabs[this.activeIndex];
},
containerStyles: function containerStyles() {
return this.height ? {
height: parseInt(this.height, 10) + 'px'
} : null;
},
hasArrows: function hasArrows() {
return (this.showArrows || !this.isMobile) && this.isOverflowing;
},
inputValue: {
get: function get() {
return this.lazyValue;
},
set: function set(val) {
// Always use strings
val = val.toString();
this.lazyValue = val;
this.$emit('input', val);
}
},
isMobile: function isMobile() {
return this.$vuetify.breakpoint.width < this.mobileBreakPoint;
},
sliderStyles: function sliderStyles() {
return {
left: this.sliderLeft + 'px',
transition: this.sliderLeft != null ? null : 'none',
width: this.sliderWidth + 'px'
};
},
target: function target() {
return this.activeTab ? this.activeTab.action : null;
}
}
};