fix:当传入的 columns 为空时,不绑定拖拽事件
This commit is contained in:
parent
bc94da12e7
commit
acf9eb2ddb
|
@ -552,8 +552,13 @@ var TableHeader = function (_Component) {
|
||||||
TableHeader.prototype.initEvent = function initEvent() {
|
TableHeader.prototype.initEvent = function initEvent() {
|
||||||
var _props = this.props,
|
var _props = this.props,
|
||||||
dragborder = _props.dragborder,
|
dragborder = _props.dragborder,
|
||||||
draggable = _props.draggable;
|
draggable = _props.draggable,
|
||||||
|
rows = _props.rows;
|
||||||
|
// 当传入的 columns 为空时,不绑定拖拽事件
|
||||||
|
|
||||||
|
if (Object.prototype.toString.call(rows) === '[object Array]' && rows.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!this.event) {
|
if (!this.event) {
|
||||||
//避免多次绑定问题。
|
//避免多次绑定问题。
|
||||||
this.event = true;
|
this.event = true;
|
||||||
|
|
|
@ -34271,6 +34271,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
Table.prototype.componentWillUnmount = function componentWillUnmount() {
|
Table.prototype.componentWillUnmount = function componentWillUnmount() {
|
||||||
|
this.contentTable = null;
|
||||||
_utils.EventUtil.removeHandler(this.contentTable, 'keydown', this.onKeyDown);
|
_utils.EventUtil.removeHandler(this.contentTable, 'keydown', this.onKeyDown);
|
||||||
_utils.EventUtil.removeHandler(this.contentTable, 'focus', this.onFocus);
|
_utils.EventUtil.removeHandler(this.contentTable, 'focus', this.onFocus);
|
||||||
if (this.resizeEvent) {
|
if (this.resizeEvent) {
|
||||||
|
@ -37891,6 +37892,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
TableHeader.prototype.componentWillUnmount = function componentWillUnmount() {
|
TableHeader.prototype.componentWillUnmount = function componentWillUnmount() {
|
||||||
|
this.fixedTable = null;
|
||||||
if (!this.table) return;
|
if (!this.table) return;
|
||||||
if (this.props.draggable) {
|
if (this.props.draggable) {
|
||||||
this.removeDragAbleEvent();
|
this.removeDragAbleEvent();
|
||||||
|
@ -37899,6 +37901,7 @@
|
||||||
this.removeDragBorderEvent();
|
this.removeDragBorderEvent();
|
||||||
}
|
}
|
||||||
this.eventListen([{ key: 'mousedown', fun: this.onTrMouseDown }], 'remove', this.table.tr[0]);
|
this.eventListen([{ key: 'mousedown', fun: this.onTrMouseDown }], 'remove', this.table.tr[0]);
|
||||||
|
this.eventListen([{ key: 'mouseup', fun: this.bodyonLineMouseUp }], 'remove', document.body);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37953,8 +37956,13 @@
|
||||||
TableHeader.prototype.initEvent = function initEvent() {
|
TableHeader.prototype.initEvent = function initEvent() {
|
||||||
var _props = this.props,
|
var _props = this.props,
|
||||||
dragborder = _props.dragborder,
|
dragborder = _props.dragborder,
|
||||||
draggable = _props.draggable;
|
draggable = _props.draggable,
|
||||||
|
rows = _props.rows;
|
||||||
|
// 当传入的 columns 为空时,不绑定拖拽事件
|
||||||
|
|
||||||
|
if (Object.prototype.toString.call(rows) === '[object Array]' && rows.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!this.event) {
|
if (!this.event) {
|
||||||
//避免多次绑定问题。
|
//避免多次绑定问题。
|
||||||
this.event = true;
|
this.event = true;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -109,7 +109,11 @@ class TableHeader extends Component {
|
||||||
* 事件初始化
|
* 事件初始化
|
||||||
*/
|
*/
|
||||||
initEvent(){
|
initEvent(){
|
||||||
let {dragborder,draggable} = this.props;
|
let {dragborder,draggable,rows} = this.props;
|
||||||
|
// 当传入的 columns 为空时,不绑定拖拽事件
|
||||||
|
if(Object.prototype.toString.call(rows) === '[object Array]' && rows.length === 0){
|
||||||
|
return;
|
||||||
|
}
|
||||||
if(!this.event){ //避免多次绑定问题。
|
if(!this.event){ //避免多次绑定问题。
|
||||||
this.event = true;
|
this.event = true;
|
||||||
if(dragborder){
|
if(dragborder){
|
||||||
|
|
Loading…
Reference in New Issue