From cfa6ae4165f4cb065aa52c4f656256a3408c50c8 Mon Sep 17 00:00:00 2001 From: wanghaoo Date: Tue, 22 Jan 2019 11:05:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/demolist/Demo30.js | 138 ++++++++++++++++------------------------ 1 file changed, 56 insertions(+), 82 deletions(-) diff --git a/demo/demolist/Demo30.js b/demo/demolist/Demo30.js index e1235e1..47c2017 100644 --- a/demo/demolist/Demo30.js +++ b/demo/demolist/Demo30.js @@ -10,7 +10,57 @@ import Tooltip from "bee-tooltip"; import Table from "../../src"; import BigData from "../../src/lib/bigData"; const BigDataTable = BigData(Table); - +const columns = [ + { + title:'序号', + dataIndex:'index', + width:'50', + render:(text,record,index)=>{ + return index + }, + fixed:'left' + }, + { + title: "用户名", dataIndex: "a", key: "a", width: 580, className: "rowClassName", + render: (text, record, index) => { + return ( + + {text} + + ); + } + }, + { id: "123", title: "性别", dataIndex: "b", key: "b", width: 80}, + { title: "年龄", dataIndex: "c", key: "c", width: 200 }, + { + title: "操作", + dataIndex: "d", + key: "d", + fixed:'right', + render(text, record, index) { + return ( +
+ { + alert('这是第' + index + '列,内容为:' + text); + }} + > + 一些操作 + +
+ ); + } + } +]; const data = [ ...new Array(10000) ].map((e, i) => { const rs = { a: i + 'a', b: i + 'b', c: i + 'c', d: i + 'd', key: i }; @@ -22,106 +72,30 @@ const data = [ ...new Array(10000) ].map((e, i) => { class Demo30 extends Component { - + constructor(props) { super(props); - const _this = this; this.state = { data: data, - selectedRowIndex: 0, - currentIndex:-1 + selectedRowIndex: 0 } - this.columns = [ - { - title:'序号', - dataIndex:'index', - width:'50', - render:(text,record,index)=>{ - return index - }, - fixed:'left' - }, - { - title: "用户名", dataIndex: "a", key: "a", width: 580, className: "rowClassName", - render: (text, record, index) => { - return ( - - {text} - - ); - } - }, - { id: "123", title: "性别", dataIndex: "b", key: "b", width: 80}, - { title: "年龄", dataIndex: "c", key: "c", width: 200 }, - { - title: "操作", - dataIndex: "d", - key: "d", - fixed:'right', - render(text, record, index) { - - return ( -
- { - alert(record.key+'这是第' + index + '列,内容为:' + text); - }} - > - {record.key+'这是第' + index} - - -
- ); - } - } - ]; } - - add=()=>{ - let {currentIndex} = this.state; - let data = this.state.data; - const key = data.length; - - data.push({a: key + 'a', b: key + 'b', c: key + 'c', d: key + 'd', key: key}); - currentIndex = data.length - this.setState({data,currentIndex}); - } - del=(record,index)=>(record,index)=>{ - - let data = this.state.data; - data.splice(index,1); - this.setState(data); - } render() { - const {currentIndex} = this.state; return ( -
- { console.log('currentIndex--'+index); }} /> -
+ ); } } -export default Demo30; +export default Demo30; \ No newline at end of file