Commit c92fde6798248bdc201163c116575929541cc0cb

Authored by bitqiang
1 parent fd317949

优化 如果数据全部不可以选,表头的选择也禁用。

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: {
... ...