byt-ui 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: 王国火
|
|
4
4
|
* @Date: 2022-10-18 12:37:03
|
|
5
|
-
* @LastEditTime: 2022-10-
|
|
5
|
+
* @LastEditTime: 2022-10-27 10:48:12
|
|
6
6
|
* @LastEditors: 王国火
|
|
7
7
|
*/
|
|
8
8
|
import Cookie from 'js-cookie'
|
|
9
9
|
import website from './website'
|
|
10
10
|
export const getCookie = (key, context) => {
|
|
11
|
-
const searchKey = `${website.key}
|
|
11
|
+
const searchKey = `${website.key}-${key}`
|
|
12
12
|
if (context && context.req) {
|
|
13
13
|
if (context.req.headers.cookie) {
|
|
14
14
|
const arr = context.req.headers.cookie.split(';')
|
|
@@ -25,7 +25,7 @@ export const getCookie = (key, context) => {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export const setCookie = (key, value, expires = 7, path = '/') => {
|
|
28
|
-
return Cookie.set(`${website.key}
|
|
28
|
+
return Cookie.set(`${website.key}-${key}`, value, { expires, path })
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export const removeCookie = (key, path = '/') => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: 王国火
|
|
4
4
|
* @Date: 2022-10-08 09:10:49
|
|
5
|
-
* @LastEditTime: 2022-10-25
|
|
5
|
+
* @LastEditTime: 2022-10-25 11:03:35
|
|
6
6
|
* @LastEditors: 王国火
|
|
7
7
|
*/
|
|
8
8
|
import { validatenull } from './validate'
|
|
@@ -34,7 +34,7 @@ export const getStore = (key,debug = false) => {
|
|
|
34
34
|
const name = `${keyName}-${key}`
|
|
35
35
|
let obj = window.sessionStorage.getItem(name)||window.localStorage.getItem(name)
|
|
36
36
|
let content
|
|
37
|
-
if (validatenull(obj)) return
|
|
37
|
+
if (validatenull(obj)) return null
|
|
38
38
|
try {
|
|
39
39
|
obj = JSON.parse(obj)
|
|
40
40
|
} catch (e) {
|
|
@@ -57,13 +57,10 @@ export const getStore = (key,debug = false) => {
|
|
|
57
57
|
/**
|
|
58
58
|
* 删除localStorage
|
|
59
59
|
*/
|
|
60
|
-
export const removeStore = (key
|
|
60
|
+
export const removeStore = (key) => {
|
|
61
61
|
const name = `${keyName}-${key}`
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} else {
|
|
65
|
-
window.localStorage.removeItem(name)
|
|
66
|
-
}
|
|
62
|
+
window.sessionStorage.removeItem(name)
|
|
63
|
+
window.localStorage.removeItem(name)
|
|
67
64
|
}
|
|
68
65
|
|
|
69
66
|
/**
|