浏览代码

Fixed locale not changed bug when using refreshOptions method

zhixin 1 年之前
父节点
当前提交
eb229ecced
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      src/bootstrap-table.js

+ 6 - 1
src/bootstrap-table.js

@@ -84,12 +84,17 @@ class BootstrapTable {
         localesToExtend = locales[parts[0]]
         localesToExtend = locales[parts[0]]
       }
       }
 
 
+      this._defaultLocales = this._defaultLocales || {}
       for (const [formatName, func] of Object.entries(localesToExtend)) {
       for (const [formatName, func] of Object.entries(localesToExtend)) {
-        if (this.options[formatName] !== BootstrapTable.DEFAULTS[formatName]) {
+        const defaultLocale = this._defaultLocales.hasOwnProperty(formatName) ?
+          this._defaultLocales[formatName] : BootstrapTable.DEFAULTS[formatName]
+
+        if (this.options[formatName] !== defaultLocale) {
           continue
           continue
         }
         }
 
 
         this.options[formatName] = func
         this.options[formatName] = func
+        this._defaultLocales[formatName] = func
       }
       }
     }
     }
   }
   }