publish 0.9.9-rc-2
fixed Table autowidth
This commit is contained in:
parent
872c1354b9
commit
5e7a3b293b
7 changed files with 35 additions and 259 deletions
|
@ -10,6 +10,9 @@ export default {
|
|||
},
|
||||
isPopperShow (column) {
|
||||
return column.filters && ((!this.fixed && !column.fixed) || (this.fixed === 'left' && column.fixed === 'left') || (this.fixed === 'right' && column.fixed === 'right'));
|
||||
},
|
||||
setCellWidth (index) {
|
||||
return this.column[index].width ? this.column.width : this.columnsWidth[index];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<table cellspacing="0" cellpadding="0" border="0" :style="style">
|
||||
<colgroup>
|
||||
<col v-for="column in columns" :width="setCellWidth(column, $index)">
|
||||
<col v-for="item in setCellWidth" :width="setCellWidth($index)">
|
||||
</colgroup>
|
||||
<tbody :class="[prefixCls + '-tbody']">
|
||||
<tr
|
||||
|
@ -37,6 +37,7 @@
|
|||
columns: Array,
|
||||
data: Array, // rebuildData
|
||||
objData: Object,
|
||||
columnsWidth: Array,
|
||||
fixed: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
|
@ -56,9 +57,6 @@
|
|||
rowChecked (_index) {
|
||||
return this.objData[_index] && this.objData[_index]._isChecked;
|
||||
},
|
||||
setCellWidth (column, index) {
|
||||
return this.$parent.setCellWidth(column, index);
|
||||
},
|
||||
rowClsName (_index) {
|
||||
return this.$parent.rowClassName(this.objData[_index], _index);
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<table cellspacing="0" cellpadding="0" border="0" :style="style">
|
||||
<colgroup>
|
||||
<col v-for="column in columns" :width="setCellWidth(column, $index)">
|
||||
<col v-for="item in setCellWidth" :width="setCellWidth($index)">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -69,6 +69,7 @@
|
|||
columns: Array,
|
||||
objData: Object,
|
||||
data: Array, // rebuildData
|
||||
columnsWidth: Array,
|
||||
fixed: {
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
|
@ -97,9 +98,6 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
setCellWidth (column, index) {
|
||||
return this.$parent.setCellWidth(column, index);
|
||||
},
|
||||
renderHeader (column, $index) {
|
||||
if ('renderHeader' in this.columns[$index]) {
|
||||
return this.columns[$index].renderHeader(column, $index);
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
:style="tableStyle"
|
||||
:columns="cloneColumns"
|
||||
:obj-data="objData"
|
||||
:columns-width.sync="columnsWidth"
|
||||
:data="rebuildData"></table-head>
|
||||
</div>
|
||||
<div :class="[prefixCls + '-body']" :style="bodyStyle" v-el:body @scroll="handleBodyScroll">
|
||||
|
@ -17,6 +18,7 @@
|
|||
:style="tableStyle"
|
||||
:columns="cloneColumns"
|
||||
:data="rebuildData"
|
||||
:columns-width.sync="columnsWidth"
|
||||
:obj-data="objData"></table-body>
|
||||
</div>
|
||||
<div :class="[prefixCls + '-fixed']" :style="fixedTableStyle">
|
||||
|
@ -27,6 +29,7 @@
|
|||
:style="fixedTableStyle"
|
||||
:columns="leftFixedColumns"
|
||||
:obj-data="objData"
|
||||
:columns-width.sync="columnsWidth"
|
||||
:data="rebuildData"></table-head>
|
||||
</div>
|
||||
<div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" v-el:fixed-body>
|
||||
|
@ -36,6 +39,7 @@
|
|||
:style="fixedTableStyle"
|
||||
:columns="leftFixedColumns"
|
||||
:data="rebuildData"
|
||||
:columns-width.sync="columnsWidth"
|
||||
:obj-data="objData"></table-body>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -47,6 +51,7 @@
|
|||
:style="fixedRightTableStyle"
|
||||
:columns="rightFixedColumns"
|
||||
:obj-data="objData"
|
||||
:columns-width.sync="columnsWidth"
|
||||
:data="rebuildData"></table-head>
|
||||
</div>
|
||||
<div :class="[prefixCls + '-fixed-body']" :style="fixedBodyStyle" v-el:fixed-right-body>
|
||||
|
@ -56,6 +61,7 @@
|
|||
:style="fixedRightTableStyle"
|
||||
:columns="rightFixedColumns"
|
||||
:data="rebuildData"
|
||||
:columns-width.sync="columnsWidth"
|
||||
:obj-data="objData"></table-body>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -247,9 +253,6 @@
|
|||
});
|
||||
});
|
||||
},
|
||||
setCellWidth (column, index) {
|
||||
return column.width ? column.width : this.columnsWidth[index];
|
||||
},
|
||||
handleMouseIn (_index) {
|
||||
if (this.objData[_index]._isHover) return;
|
||||
this.objData[_index]._isHover = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue