浏览代码

Merge pull request #5874 from wenzhixin/fix/5868

fix/5868
文翼 4 年之前
父节点
当前提交
3605208337
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      src/extensions/cookie/bootstrap-table-cookie.js

+ 4 - 2
src/extensions/cookie/bootstrap-table-cookie.js

@@ -533,7 +533,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
 
     if (columnsCookie) {
       for (const column of this.columns) {
-        column.visible = columnsCookie.filter(columnField => {
+        const filteredColumns = columnsCookie.filter(columnField => {
           if (this.isSelectionColumn(column)) {
             return true
           }
@@ -547,7 +547,9 @@ $.BootstrapTable = class extends $.BootstrapTable {
           }
 
           return columnField === column.field
-        }).length > 0 || !column.switchable
+        })
+
+        column.visible = (filteredColumns.length > 0 || !column.switchable) && column.visible
       }
     }
   }