新增文字过长、选中行样式示例

This commit is contained in:
jonyshi 2018-05-02 10:14:32 +08:00
parent bac10e9356
commit fbaa78026c
3 changed files with 60 additions and 5 deletions

View File

@ -16,3 +16,7 @@
//引入日期控件样式文件
@import "../node_modules/bee-datepicker/src/datepicker.scss";
.selected{
background: rgb(227,242,253);
}

View File

@ -1,8 +1,7 @@
/**
*
* @title 简单表格以及两种tip
* 一种是bee-popover实现
* 一种是标签本身的tooltip
* @title 简单表格两种tip选中行背景色文字过长
* 一种是bee-popover实现一种是标签本身的tooltip
* @description
*/
@ -21,7 +20,7 @@ function getTitleTip(text){
const columns = [
{ id: "123", title: "性别", dataIndex: "b", key: "b", width: 100 },
{ title: "年龄", dataIndex: "c", key: "c", width: 200 },
{ title: "用户名", dataIndex: "a", key: "a", width:80 ,
{ title: "用户名", dataIndex: "a", key: "a", width:80 , className:"rowClassName",
render(text, record, index) {
return(<div style={{position: 'relative'}}>
<Popover
@ -77,11 +76,36 @@ const data = [
];
class Demo1 extends Component {
constructor(props){
super(props);
this.state = {
data: data,
factoryValue: 0,
selectedRow: new Array(data.length)//状态同步
}
}
render() {
return (
<Table
columns={columns}
data={data}
rowClassName={(record,index,indent)=>{
if (this.state.selectedRow[index]) {
return 'selected';
} else {
return '';
}
}}
onRowClick={(record,index,indent)=>{
let selectedRow = new Array(this.state.data.length);
selectedRow[index] = true;
this.setState({
factoryValue: record,
selectedRow: selectedRow
});
}}
title={currentData => <div>标题: 这是一个标题</div>}
footer={currentData => <div>表尾: 我是小尾巴</div>}
/>

View File

@ -95,8 +95,35 @@ const data4 = [
}
];
class Demo4 extends Component {
constructor(props){
super(props);
this.state = {
data: data4,
factoryValue: 0,
selectedRow: new Array(data4.length)//状态同步
}
}
render() {
return <Table columns={columns4} data={data4} />;
return <Table
rowClassName={(record,index,indent)=>{
if (this.state.selectedRow[index]) {
return 'selected';
} else {
return '';
}
}}
onRowClick={(record,index,indent)=>{
let selectedRow = new Array(this.state.data.length);
selectedRow[index] = true;
this.setState({
factoryValue: record,
selectedRow: selectedRow
});
}}
columns={columns4} data={data4} />;
}
}