Browse Source

Fixed locale not changed bug when using refreshOptions method

zhixin 1 year ago
parent
commit
eb229ecced
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/bootstrap-table.js

+ 6 - 1
src/bootstrap-table.js

@@ -84,12 +84,17 @@ class BootstrapTable {
         localesToExtend = locales[parts[0]]
       }
 
+      this._defaultLocales = this._defaultLocales || {}
       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
         }
 
         this.options[formatName] = func
+        this._defaultLocales[formatName] = func
       }
     }
   }