fix(bee-table): ie11下removeEventListener报错bug

This commit is contained in:
liushaozhen 2019-05-15 15:29:19 +08:00
parent 42fac60c77
commit 59d03c3e54
9 changed files with 109 additions and 107 deletions

View File

@ -191,7 +191,7 @@
.u-table th ::last-child { .u-table th ::last-child {
overflow: hidden; } overflow: hidden; }
.u-table td { .u-table td {
border-bottom: 1px solid rgb(193, 199, 208); border-bottom: 1px solid rgb(233,233,233);
line-height: 1.33; } line-height: 1.33; }
.u-table td a { .u-table td a {
color: #2196F3; } color: #2196F3; }
@ -242,7 +242,7 @@
.u-table-scroll { .u-table-scroll {
overflow: auto; } overflow: auto; }
.u-table-bordered table { .u-table-bordered table {
border: 1px solid rgb(193, 199, 208); border: 1px solid rgb(233,233,233);
box-sizing: border-box; box-sizing: border-box;
table-layout: fixed; } table-layout: fixed; }
.u-table-bordered .u-table-header > table { .u-table-bordered .u-table-header > table {
@ -250,18 +250,18 @@
.u-table-bordered .u-table-header ~ .u-table-body table, .u-table-bordered .u-table-header ~ .u-table-body-outer table { .u-table-bordered .u-table-header ~ .u-table-body table, .u-table-bordered .u-table-header ~ .u-table-body-outer table {
border-top: 0px; } border-top: 0px; }
.u-table-bordered th { .u-table-bordered th {
border-bottom: 1px solid rgb(193, 199, 208); border-bottom: 1px solid rgb(233,233,233);
box-sizing: border-box; } box-sizing: border-box; }
.u-table-bordered th, .u-table-bordered th,
.u-table-bordered td { .u-table-bordered td {
border-right: 1px solid rgb(193, 199, 208); border-right: 1px solid rgb(233,233,233);
box-sizing: border-box; } box-sizing: border-box; }
.u-table-drag-border tr th.th-can-not-drag { .u-table-drag-border tr th.th-can-not-drag {
overflow: hidden; } overflow: hidden; }
.u-table-header { .u-table-header {
overflow: hidden; overflow: hidden;
background: rgb(241, 242, 245); background: rgb(247,247,247);
color: rgb(33, 33, 33); } color: rgb(102, 102, 102); }
.u-table.fixed-height td { .u-table.fixed-height td {
padding: 0px 8px; } padding: 0px 8px; }
.u-table-fixed-header .u-table-body { .u-table-fixed-header .u-table-body {
@ -282,12 +282,12 @@
box-sizing: border-box; } box-sizing: border-box; }
.u-table-title { .u-table-title {
padding: 12px 8px; padding: 12px 8px;
border-top: 1px solid rgb(193, 199, 208); } border-top: 1px solid rgb(233,233,233); }
.u-table-content { .u-table-content {
position: relative; } position: relative; }
.u-table-footer { .u-table-footer {
padding: 12px 8px; padding: 12px 8px;
border-bottom: 1px solid rgb(193, 199, 208); } border-bottom: 1px solid rgb(233,233,233); }
.u-table-footer .u-table-scroll { .u-table-footer .u-table-scroll {
overflow-x: hidden; } overflow-x: hidden; }
.u-table-footer .u-table { .u-table-footer .u-table {
@ -295,7 +295,7 @@
.u-table-placeholder { .u-table-placeholder {
padding: 12px 8px; padding: 12px 8px;
background: #fff; background: #fff;
border-bottom: 1px solid rgb(193, 199, 208); border-bottom: 1px solid rgb(233,233,233);
text-align: center; text-align: center;
position: relative; } position: relative; }
.u-table-placeholder .table-nodata { .u-table-placeholder .table-nodata {
@ -398,8 +398,8 @@
.u-table-thead .filter-wrap .filter-btns { .u-table-thead .filter-wrap .filter-btns {
min-width: 58px; } min-width: 58px; }
.u-table-thead th { .u-table-thead th {
background: rgb(241, 242, 245); background: rgb(247,247,247);
color: rgb(33, 33, 33); color: rgb(102, 102, 102);
background-clip: padding-box; background-clip: padding-box;
-moz-user-select: -moz-none; -moz-user-select: -moz-none;
-khtml-user-select: none; -khtml-user-select: none;
@ -500,7 +500,7 @@
right: 0px; right: 0px;
top: 1px; top: 1px;
z-index: 2; z-index: 2;
background: rgb(241, 242, 245); background: rgb(247,247,247);
text-align: center; text-align: center;
cursor: pointer; } cursor: pointer; }
.u-table-filter-column-filter-icon i.uf { .u-table-filter-column-filter-icon i.uf {
@ -578,7 +578,7 @@
.u-table.bordered th, .u-table.bordered th,
.u-table.bordered td { .u-table.bordered td {
border: 1px solid rgb(193, 199, 208); } border: 1px solid rgb(233,233,233); }
.move-enter, .move-enter,
.move-appear { .move-appear {

View File

@ -230,11 +230,12 @@ function addHandler(element, type, handler) {
} }
function removeHandler(element, type, handler) { function removeHandler(element, type, handler) {
if (element.removeEventListener) { if (element && element.removeEventListener) {
//element&& ie11报错兼容
element.removeEventListener(type, handler, false); element.removeEventListener(type, handler, false);
} else if (element.detachEvent) { } else if (element && element.detachEvent) {
element.detachEvent("on" + type, handler); element.detachEvent("on" + type, handler);
} else { } else if (element) {
element["on" + type] = null; element["on" + type] = null;
} }
} }
@ -278,11 +279,12 @@ var EventUtil = exports.EventUtil = {
}, },
removeHandler: function removeHandler(element, type, handler) { removeHandler: function removeHandler(element, type, handler) {
if (element.removeEventListener) { //element&& ie11报错兼容
if (element && element.removeEventListener) {
element.removeEventListener(type, handler, false); element.removeEventListener(type, handler, false);
} else if (element.detachEvent) { } else if (element && element.detachEvent) {
element.detachEvent('on' + type, handler); element.detachEvent('on' + type, handler);
} else { } else if (element) {
element['on' + type] = null; element['on' + type] = null;
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "bee-table", "name": "bee-table",
"version": "2.0.18", "version": "2.0.19",
"description": "Table ui component for react", "description": "Table ui component for react",
"keywords": [ "keywords": [
"react", "react",

View File

@ -205,11 +205,11 @@ export function getColChildrenLength(columns,chilrenLen){
} }
function removeHandler(element, type, handler){ function removeHandler(element, type, handler){
if (element.removeEventListener){ if (element&&element.removeEventListener){//element&& ie11报错兼容
element.removeEventListener(type, handler, false); element.removeEventListener(type, handler, false);
} else if (element.detachEvent){ } else if (element&&element.detachEvent){
element.detachEvent("on" + type, handler); element.detachEvent("on" + type, handler);
} else { } else if(element) {
element["on" + type] = null; element["on" + type] = null;
} }
} }
@ -255,15 +255,15 @@ export const EventUtil = {
} }
}, },
removeHandler: function(element,type,handler) { removeHandler: function(element,type,handler) {//element&& ie11报错兼容
if (element.removeEventListener) if (element&&element.removeEventListener)
{ {
element.removeEventListener(type,handler,false); element.removeEventListener(type,handler,false);
} }
else if(element.detachEvent) { else if(element&&element.detachEvent) {
element.detachEvent('on' +type,handler); element.detachEvent('on' +type,handler);
} }
else { else if(element){
element['on'+type] = null; element['on'+type] = null;
} }
} }