bee-table7/demo/demolist/Demo0406.js

38 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2019-09-06 14:47:42 +08:00
/**
*
* @title 自定义整行和整列样式表格
2019-09-09 11:01:06 +08:00
* @parent 列渲染 Custom Render
2019-09-06 14:47:42 +08:00
* @description 某行或某列的样式严格按照react的样式书写规则即对象内每一个属性的键为小写驼峰式值为字符串此demo展示自定义整行或整列的背景色和字体内容颜色
2019-09-09 11:01:06 +08:00
* demo0406
2019-09-06 14:47:42 +08:00
*/
import React, { Component } from "react";
import Table from "../../src";
const columns = [
{ title: "员工编号", dataIndex: "a", key: "a", width: 150 },
{ title: "员工姓名", dataIndex: "b", key: "b", width:100},
2019-09-09 11:01:06 +08:00
{ title: "性别", dataIndex: "c", key: "c", width: 100,style: {backgroundColor:'#e3f2fd',color:'#505F79'}},
2019-09-06 14:47:42 +08:00
{ title: "部门", dataIndex: "d", key: "d", width: 100 },
{ title: "职级", dataIndex: "e", key: "e", width: 100 }
];
const data = [
2019-09-09 11:01:06 +08:00
{ a: "ASVAL_20190328", b: "小张", c: "男", d: "财务二科", e: "M1", key: "1" ,style:{backgroundColor:'#ffebee',color:'#000'}},
2019-09-06 14:47:42 +08:00
{ a: "ASVAL_20190320", b: "小明", c: "男", d: "财务一科", e: "T1", key: "2" },
{ a: "ASVAL_20190312", b: "小红", c: "女", d: "财务一科", e: "T2", key: "3" }
];
2019-09-09 11:01:06 +08:00
class Demo0406 extends Component {
2019-09-06 14:47:42 +08:00
render() {
return (
<Table
columns={columns}
data={data}
showRowNum={true}
/>
);
}
}
2019-09-09 11:01:06 +08:00
export default Demo0406