update Table #167

update Table
This commit is contained in:
梁灏 2017-01-05 14:10:08 +08:00
parent 3d6fa54b39
commit a404bbaed3
3 changed files with 11 additions and 3 deletions

View file

@ -19,7 +19,7 @@ export default {
width = this.columnsWidth[column._index].width;
}
// when browser has scrollBar,set a width to resolve scroll position bug
if (this.columns.length === index + 1 && top) {
if (this.columns.length === index + 1 && top && this.$parent.bodyHeight !== 0) {
width += this.$parent.scrollBarWidth;
}
// when fixed type,reset first right fixed column's width

View file

@ -1,5 +1,5 @@
<template>
<table cellspacing="0" cellpadding="0" border="0" :style="style">
<table cellspacing="0" cellpadding="0" border="0" :style="styles">
<colgroup>
<col v-for="column in columns" :width="setCellWidth(column, $index, true)">
</colgroup>
@ -75,6 +75,12 @@
}
},
computed: {
styles () {
const style = Object.assign({}, this.style);
const width = this.$parent.bodyHeight === 0 ? parseInt(this.style.width) : parseInt(this.style.width) + this.$parent.scrollBarWidth;
style.width = `${width}px`;
return style;
},
isSelectAll () {
let isSelectAll = true;
if (!this.data.length) isSelectAll = false;

View file

@ -4,7 +4,9 @@
}
</style>
<template>
<i-table width="550" height="200" border :columns="columns2" :data="data4"></i-table>
<i-table border :columns="columns1" :data="data1"></i-table>
<i-table border height="200" :columns="columns1" :data="data2"></i-table>
<!--<i-table width="550" height="200" border :columns="columns2" :data="data4"></i-table>-->
<!--<i-button @click="changeFilter">改变filter</i-button>-->
<!--<span v-if="currentRow !== null">Current Row: {{currentRow.name}}</span>-->
<!--<Switch size="small" @on-change="switchCellEllipsis"></Switch> Ellipsis-->