固定表头th 限制最大宽度

This commit is contained in:
yangchch6 2020-01-07 20:35:04 +08:00
parent f3383c0675
commit b6201d7319
7 changed files with 12 additions and 15 deletions

View File

@ -502,7 +502,7 @@ var TableHeader = function (_Component) {
da.onClick ? thDefaultObj.onClick = function (e) { da.onClick ? thDefaultObj.onClick = function (e) {
da.onClick(da, e); da.onClick(da, e);
} : ""; } : "";
return _react2["default"].createElement("th", _extends({}, thDefaultObj, keyTemp, { "data-th-fixed": da.fixed })); return _react2["default"].createElement("th", _extends({}, thDefaultObj, keyTemp, { "data-th-fixed": da.fixed, style: { maxWidth: da.width } }));
} }
}) })
); );

View File

@ -17,7 +17,7 @@ const columns = [
title: "序号", title: "序号",
dataIndex: "index", dataIndex: "index",
key: "index", key: "index",
width: 80, width: 85,
fixed: 'left', fixed: 'left',
render(text, record, index){return index + 1} render(text, record, index){return index + 1}
}, },
@ -25,7 +25,7 @@ const columns = [
title: "订单编号", title: "订单编号",
dataIndex: "orderCode", dataIndex: "orderCode",
key: "orderCode", key: "orderCode",
width: 100, width: 120,
fixed: 'left', fixed: 'left',
}, },
{ {

View File

@ -2,11 +2,10 @@
* *
* @title 拖拽改变列宽度 * @title 拖拽改变列宽度
* @parent 列操作-拖拽 Drag * @parent 列操作-拖拽 Drag
* @description onDropBorder方法为调整列宽后触发的回调函数不支持tree结构的表头合并表头的table * @description onDropBorder方法为调整列宽后触发的回调函数不支持tree结构的表头
* demo1002 * demo1002
*/ */
import React, { Component } from 'react'; import React, { Component } from 'react';
import {Icon} from "tinper-bee";
import Table from '../../src'; import Table from '../../src';
import dragColumn from '../../src/lib/dragColumn'; import dragColumn from '../../src/lib/dragColumn';

File diff suppressed because one or more lines are too long

12
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -816,7 +816,7 @@ class TableHeader extends Component {
className:`${thClassName} ${fixedStyle}`, className:`${thClassName} ${fixedStyle}`,
}; };
da.onClick ?thDefaultObj.onClick = (e)=>{da.onClick(da, e)}:""; da.onClick ?thDefaultObj.onClick = (e)=>{da.onClick(da, e)}:"";
return (<th {...thDefaultObj} {...keyTemp} data-th-fixed={da.fixed} />) return (<th {...thDefaultObj} {...keyTemp} data-th-fixed={da.fixed} style={{maxWidth: da.width}}/>)
} }
})} })}
</tr> </tr>