Commit 0ad95539123bc5b877722f69625eee9d29d0d770

Authored by Aresn
Committed by GitHub
2 parents 83065209 52e49907

Merge pull request #5230 from bitqiang/2.0

优化 如果数据全部不可以选,表头的选择也禁用。
Showing 1 changed file with 8 additions and 2 deletions   Show diff stats
src/components/table/table-head.vue
... ... @@ -16,7 +16,7 @@
16 16 <span v-if="!column.renderHeader">{{ column.title || '' }}</span>
17 17 <render-header v-else :render="column.renderHeader" :column="column" :index="index"></render-header>
18 18 </template>
19   - <template v-else-if="column.type === 'selection'"><Checkbox :value="isSelectAll" :disabled="!data.length" @on-change="selectAll"></Checkbox></template>
  19 + <template v-else-if="column.type === 'selection'"><Checkbox :value="isSelectAll" :disabled="isSelectDisabled" @on-change="selectAll"></Checkbox></template>
20 20 <template v-else>
21 21 <span v-if="!column.renderHeader" :class="{[prefixCls + '-cell-sort']: column.sortable}" @click="handleSortByHead(getColumn(rowIndex, index)._index)">{{ column.title || '#' }}</span>
22 22 <render-header v-else :render="column.renderHeader" :column="column" :index="index"></render-header>
... ... @@ -61,7 +61,7 @@
61 61 </template>
62 62 </div>
63 63 </th>
64   -
  64 +
65 65 <th v-if="$parent.showVerticalScrollBar && rowIndex===0" :class='scrollBarCellClass()' :rowspan="headRows.length"></th>
66 66 </tr>
67 67 </thead>
... ... @@ -121,6 +121,12 @@
121 121 } else {
122 122 return [this.columns];
123 123 }
  124 + },
  125 + isSelectDisabled () {
  126 + let isSelectDisabled = false;
  127 + if (!this.data.length) isSelectDisabled = true;
  128 + if (!this.data.find(item => !item._disabled)) isSelectDisabled = true;
  129 + return isSelectDisabled;
124 130 }
125 131 },
126 132 methods: {
... ...