Commit 27d4e0ac authored by 咸fish's avatar 咸fish Committed by Geass

Tab: fix tabs-item's padding cause active-bar's width and transform err( … #15355) (#16520)

* Tab: Refactor tabs-item's padding with dynamic value
parent 6105a755
......@@ -32,16 +32,17 @@
return true;
} else {
tabSize = $el[`client${firstUpperCase(sizeName)}`];
const tabStyles = window.getComputedStyle($el);
if (sizeName === 'width' && this.tabs.length > 1) {
tabSize -= (index === 0 || index === this.tabs.length - 1) ? 20 : 40;
tabSize -= parseFloat(tabStyles.paddingLeft) + parseFloat(tabStyles.paddingRight);
}
if (sizeName === 'width') {
offset += parseFloat(tabStyles.paddingLeft);
}
return false;
}
});
if (sizeName === 'width' && offset !== 0) {
offset += 20;
}
const transform = `translate${firstUpperCase(sizeDir)}(${offset}px)`;
style[sizeName] = tabSize + 'px';
style.transform = transform;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment