/** * * @title 简单表格、两种tip、选中行背景色、文字过长 * 【一种是bee-popover实现、一种是标签本身的tooltip】 * @description */ import React, { Component } from "react"; import Popover from 'bee-popover'; import Button from "bee-button"; import Table from "../../src"; function getTitleTip(text){ return(

{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 , className:"rowClassName", render(text, record, index) { return(
{text}
); }}, { title: "操作", dataIndex: "d", key: "d", render(text, record, index) { return (
{ alert('这是第'+index+'列,内容为:'+text); }} style={{ position: 'absolute', top: 5, left: 0 }} > 一些操作
); } } ]; const data = [ { a: "令狐冲", b: "男", c: 41, d: "操作", key: "1" }, { a: "杨过叔叔的女儿黄蓉", b: "男", c: 67, d: "操作", key: "2" }, { a: "郭靖", b: "男", c: 25, d: "操作", key: "3" } ]; class Demo1 extends Component { constructor(props){ super(props); this.state = { data: data, factoryValue: 0, selectedRow: new Array(data.length)//状态同步 } } render() { return ( { 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 =>
标题: 这是一个标题
} footer={currentData =>
表尾: 我是小尾巴
} /> ); } } export default Demo1;