UNPKG

ivue-material-plus

Version:

A high quality UI components Library with Vue.js

48 lines (45 loc) 1.28 kB
import { computed } from 'vue'; var tabsComputed = (props, data) => { const hasArrows = computed(() => { return props.showArrows && data.isOverflowing; }); const containerStyles = computed(() => { const height = props.height; const regexp = new RegExp(/[a-zA-Z]/g); const isUnit = regexp.test(`${height}`); return { height: !isUnit ? `${height}px` : height, transform: `translate3d(-${data.scrollOffset}px, 0,0)` }; }); const noFindActiveTab = computed(() => { return data.tabs.findIndex((tab, index) => { return tab.tabName === props.modelValue || index === props.modelValue; }); }); const activeIndex = computed(() => { return data.tabs.findIndex((tab, index) => { if (!props.modelValue) { return index === 0; } if (noFindActiveTab.value === -1) { return index === 0; } return tab.tabName === props.modelValue || index === props.modelValue; }); }); const activeTab = computed(() => { if (!data.tabs.length) { return void 0; } return data.tabs[activeIndex.value]; }); return { hasArrows, activeTab, activeIndex, containerStyles }; }; export { tabsComputed as default }; //# sourceMappingURL=tabs-computed.mjs.map