From 806825e38be9d44ed265041ec334b34a06939d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E6=A3=9A?= <849005670@qq.com> Date: Fri, 10 Dec 2021 14:39:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/gird/main.css | 6 +++++ src/components/gird/main.js | 50 +++++++++++++++++++++++------------- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/components/gird/main.css b/src/components/gird/main.css index a9b16488..9cca838d 100644 --- a/src/components/gird/main.css +++ b/src/components/gird/main.css @@ -61,6 +61,12 @@ display: flex; } +.tr.active{ + + background-color: #ebf2f7 !important; + +} + .tfoot { width: 100%; height: auto; diff --git a/src/components/gird/main.js b/src/components/gird/main.js index 072ee9b1..edf6346e 100644 --- a/src/components/gird/main.js +++ b/src/components/gird/main.js @@ -118,6 +118,7 @@ export default class menu extends React.Component { ], emptyText: "抱歉,暂无相关数据记录", dataCount:23, + curIndex:0, } @@ -162,22 +163,27 @@ export default class menu extends React.Component { scrollFunc = function (e) { - e = e || window.event; - if (e.wheelDelta) { //判断浏览器IE,谷歌滑轮事件 - if (e.wheelDelta > 0) { //当滑轮向上滚动时 - - } - if (e.wheelDelta < 0) { //当滑轮向下滚动时 - - } - } else if (e.detail) { //Firefox滑轮事件 - if (e.detail> 0) { //当滑轮向下滚动时 - - } - if (e.detail< 0) { //当滑轮向上滚动时 - - } - } + + // let grid = document.getElementById("grid"); + // console.log("当前表格") + // console.log(grid.offsetWidth) + + // e = e || window.event; + // if (e.wheelDelta) { //判断浏览器IE,谷歌滑轮事件 + // if (e.wheelDelta > 0) { //当滑轮向上滚动时 + // grid.scrollTo(grid.offsetWidth,0) + // } + // if (e.wheelDelta < 0) { //当滑轮向下滚动时 + // grid.scrollTo(0,0) + // } + // } else if (e.detail) { //Firefox滑轮事件 + // if (e.detail> 0) { //当滑轮向下滚动时 + // grid.scrollTo(grid.offsetWidth,0) + // } + // if (e.detail< 0) { //当滑轮向上滚动时 + // grid.scrollTo(0,0) + // } + // } } @@ -185,6 +191,9 @@ export default class menu extends React.Component { componentDidMount() { const dom = ReactDom.findDOMNode(this); + console.log("表格") + + if(dom.attachEvent){ dom.attachEvent('onmousewheel',this.scrollFunc); @@ -374,6 +383,11 @@ export default class menu extends React.Component { return selectList } + rowItemClick(index){ + console.log(index) + + this.setState({curIndex:index}) + } render() { @@ -388,7 +402,7 @@ export default class menu extends React.Component { - return (
+ return (
{ this.props.isMultiple ? ( < div className = "th-td" style = { @@ -470,7 +484,7 @@ export default class menu extends React.Component { this.state.emptyText } < /div>): ( this.state.tableData.map((item, index) => { - return (
{this.rowItemClick(index)}} style = { { "background": index % 2 == 0 ? this.props.spliteColor : "#ffffff"