fix:表头错位问题

This commit is contained in:
yangchch6 2019-08-08 11:02:41 +08:00
parent 4b4bdcd588
commit cc103f4e69
6 changed files with 4 additions and 10 deletions

View File

@ -330,7 +330,6 @@ var Table = function (_Component) {
} }
// 是否传入 scroll中的y属性如果传入判断是否是整数如果是则进行比较 。bodyTable 的clientHeight进行判断 // 是否传入 scroll中的y属性如果传入判断是否是整数如果是则进行比较 。bodyTable 的clientHeight进行判断
this.isShowScrollY(); this.isShowScrollY();
this.scrollbarWidth = (0, _utils.measureScrollbar)();
}; };
Table.prototype.componentWillUnmount = function componentWillUnmount() { Table.prototype.componentWillUnmount = function componentWillUnmount() {

View File

@ -47,8 +47,7 @@ function measureScrollbar() {
if (typeof document === 'undefined' || typeof window === 'undefined') { if (typeof document === 'undefined' || typeof window === 'undefined') {
return 0; return 0;
} }
var tableDom = document.querySelector('.u-table'); var currentDom = document.body;
var currentDom = tableDom ? tableDom : document.body;
if (scrollbarSize) { if (scrollbarSize) {
return scrollbarSize; return scrollbarSize;

4
dist/demo.js vendored
View File

@ -34182,7 +34182,6 @@
} }
// 是否传入 scroll中的y属性如果传入判断是否是整数如果是则进行比较 。bodyTable 的clientHeight进行判断 // 是否传入 scroll中的y属性如果传入判断是否是整数如果是则进行比较 。bodyTable 的clientHeight进行判断
this.isShowScrollY(); this.isShowScrollY();
this.scrollbarWidth = (0, _utils.measureScrollbar)();
}; };
Table.prototype.componentWillUnmount = function componentWillUnmount() { Table.prototype.componentWillUnmount = function componentWillUnmount() {
@ -37223,8 +37222,7 @@
if (typeof document === 'undefined' || typeof window === 'undefined') { if (typeof document === 'undefined' || typeof window === 'undefined') {
return 0; return 0;
} }
var tableDom = document.querySelector('.u-table'); var currentDom = document.body;
var currentDom = tableDom ? tableDom : document.body;
if (scrollbarSize) { if (scrollbarSize) {
return scrollbarSize; return scrollbarSize;

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -221,7 +221,6 @@ class Table extends Component {
} }
// 是否传入 scroll中的y属性如果传入判断是否是整数如果是则进行比较 。bodyTable 的clientHeight进行判断 // 是否传入 scroll中的y属性如果传入判断是否是整数如果是则进行比较 。bodyTable 的clientHeight进行判断
this.isShowScrollY(); this.isShowScrollY();
this.scrollbarWidth = measureScrollbar();
} }
componentWillUnmount() { componentWillUnmount() {

View File

@ -17,8 +17,7 @@ export function measureScrollbar(direction = 'vertical') {
if (typeof document === 'undefined' || typeof window === 'undefined') { if (typeof document === 'undefined' || typeof window === 'undefined') {
return 0; return 0;
} }
const tableDom =document.querySelector('.u-table'); let currentDom = document.body;
let currentDom = tableDom?tableDom:document.body;
if (scrollbarSize) { if (scrollbarSize) {
return scrollbarSize; return scrollbarSize;