Эх сурвалжийг харах

Table: add disabled state to multiple selection header checkbox (#9543)

杨奕 7 жил өмнө
parent
commit
ba284c72d7

+ 1 - 0
packages/table/src/table-column.js

@@ -34,6 +34,7 @@ const forced = {
   selection: {
     renderHeader: function(h, { store }) {
       return <el-checkbox
+        disabled={ store.states.data && store.states.data.length === 0 }
         indeterminate={ store.states.selection.length > 0 && !this.isAllSelected }
         nativeOn-click={ this.toggleAllSelection }
         value={ this.isAllSelected } />;

+ 1 - 0
packages/table/src/table-store.js

@@ -298,6 +298,7 @@ TableStore.prototype.mutations = {
 
   toggleAllSelection: debounce(10, function(states) {
     const data = states.data || [];
+    if (data.length === 0) return;
     const value = !states.isAllSelected;
     const selection = this.states.selection;
     let selectionChanged = false;