mirror of https://github.com/ElemeFE/element
* Tab: Refactor tabs-item's padding with dynamic valuepull/16867/head
parent
6105a75595
commit
27d4e0ac66
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue