浏览代码

encode need for no latin symbol

Alexandr Solovyov 7 年之前
父节点
当前提交
321cd7acfb
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/extensions/cookie/bootstrap-table-cookie.js

+ 3 - 3
src/extensions/cookie/bootstrap-table-cookie.js

@@ -63,7 +63,7 @@
       switch (that.options.cookieStorage) {
         case 'cookieStorage':
           document.cookie = [
-            cookieName, '=', cookieValue,
+            cookieName, '=', encodeURIComponent(cookieValue),
             '; expires=' + UtilsCookie.calculateExpiration(that.options.cookieExpire),
             that.options.cookiePath ? '; path=' + that.options.cookiePath : '',
             that.options.cookieDomain ? '; domain=' + that.options.cookieDomain : '',
@@ -97,7 +97,7 @@
         case 'cookieStorage':
           const value = '; ' + document.cookie
           const parts = value.split('; ' + cookieName + '=')
-          return parts.length === 2 ? parts.pop().split(';').shift() : null
+          return parts.length === 2 ? decodeURIComponent(parts.pop().split(';').shift()) : null
         case 'localStorage':
           return localStorage.getItem(cookieName)
         case 'sessionStorage':
@@ -341,7 +341,7 @@
       const target = Array.prototype.slice.apply(arguments)
       super.onSearch(this, target)
 
-      if ($(target[0].currentTarget).parent().hasClass('search')) {
+      if ($(target[0].currentTarget).parent().parent().hasClass('search')) {
         UtilsCookie.setCookie(this, UtilsCookie.cookieIds.searchText, this.searchText)
       }
       UtilsCookie.setCookie(this, UtilsCookie.cookieIds.pageNumber, this.options.pageNumber)