update Table

update Table
This commit is contained in:
梁灏 2017-01-12 16:21:38 +08:00
parent 012cbf285f
commit 891700ae0c
4 changed files with 91 additions and 51 deletions

View file

@ -1,6 +1,6 @@
export default {
methods: {
alignCls (column, type, row = {}) {
alignCls (column, row = {}) {
let cellClassName = '';
if (row.cellClassName && column.key && row.cellClassName[column.key]) {
cellClassName = row.cellClassName[column.key];
@ -8,7 +8,7 @@ export default {
return [
{
[`${cellClassName}`]: cellClassName, // cell className
[`${column.className}`]: column.className && type === 'body', // column className
[`${column.className}`]: column.className, // column className
[`${this.prefixCls}-column-${column.align}`]: column.align,
[`${this.prefixCls}-hidden`]: (this.fixed === 'left' && column.fixed !== 'left') || (this.fixed === 'right' && column.fixed !== 'right') || (!this.fixed && column.fixed && (column.fixed === 'left' || column.fixed === 'right'))
}

View file

@ -11,7 +11,7 @@
@mouseleave.stop="handleMouseOut(row._index)"
@click.stop="clickCurrentRow(row._index)"
@dblclick.stop="dblclickCurrentRow(row._index)">
<td v-for="column in columns" :class="alignCls(column, 'body', row)">
<td v-for="column in columns" :class="alignCls(column, row)">
<Cell
:fixed="fixed"
:prefix-cls="prefixCls"

View file

@ -5,7 +5,7 @@
</colgroup>
<thead>
<tr>
<th v-for="(index, column) in columns" :class="alignCls(column, 'head')">
<th v-for="(index, column) in columns" :class="alignCls(column)">
<div :class="cellClasses(column)">
<template v-if="column.type === 'selection'"><Checkbox :checked="isSelectAll" @on-change="selectAll"></Checkbox></template>
<template v-else>