byt-ui 0.0.8 → 0.0.9
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/lib/byt-ui.common.js +199 -3
- package/lib/byt-ui.umd.js +199 -3
- package/lib/byt-ui.umd.min.js +3 -1
- package/package.json +2 -2
- package/packages/common/index.js +2 -1
- package/packages/common/modules/cookie.js +33 -0
- package/packages/index.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "byt-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "byt组件库",
|
|
6
6
|
"author": {
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
},
|
|
17
17
|
"main": "lib/byt-ui.umd.min.js",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"byt-ui": "^0.0.7",
|
|
20
19
|
"core-js": "^3.8.3",
|
|
21
20
|
"element-ui": "^2.15.10",
|
|
21
|
+
"js-cookie": "^3.0.1",
|
|
22
22
|
"moment": "^2.29.4",
|
|
23
23
|
"vue": "^2.6.14",
|
|
24
24
|
"vxe-table": "^3.6.6",
|
package/packages/common/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: 王国火
|
|
4
4
|
* @Date: 2022-09-19 10:17:14
|
|
5
|
-
* @LastEditTime: 2022-10-
|
|
5
|
+
* @LastEditTime: 2022-10-17 11:11:54
|
|
6
6
|
* @LastEditors: 王国火
|
|
7
7
|
*/
|
|
8
8
|
// 动态引入
|
|
@@ -12,5 +12,6 @@ requireContext.keys().map(key => {
|
|
|
12
12
|
const reg=/\w+/
|
|
13
13
|
const k=key.match(reg)[0]
|
|
14
14
|
conmmon[k]=requireContext(key).default||requireContext(key)
|
|
15
|
+
//conmmon=Object.assign(conmmon,requireContext(key).default||requireContext(key))
|
|
15
16
|
})
|
|
16
17
|
export default conmmon
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Description:
|
|
3
|
+
* @Author: 王国火
|
|
4
|
+
* @Date: 2022-10-18 12:37:03
|
|
5
|
+
* @LastEditTime: 2022-10-18 12:37:56
|
|
6
|
+
* @LastEditors: 王国火
|
|
7
|
+
*/
|
|
8
|
+
import Cookie from 'js-cookie'
|
|
9
|
+
import website from './website'
|
|
10
|
+
export const getCookie = (key, context) => {
|
|
11
|
+
const searchKey = `${website.key}_${key}`
|
|
12
|
+
if (context && context.req) {
|
|
13
|
+
if (context.req.headers.cookie) {
|
|
14
|
+
const arr = context.req.headers.cookie.split(';')
|
|
15
|
+
const cookie = arr.find((item) => {
|
|
16
|
+
return (item.split('=')[0]).trim() === searchKey
|
|
17
|
+
})
|
|
18
|
+
return cookie ? cookie.split('=')[1] : ''
|
|
19
|
+
} else {
|
|
20
|
+
return ''
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
return Cookie.get(searchKey) ? Cookie.get(searchKey) : ''
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const setCookie = (key, value, expires = 7, path = '/') => {
|
|
28
|
+
return Cookie.set(`${website.key}_${key}`, value, { expires, path })
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const removeCookie = (key, path = '/') => {
|
|
32
|
+
return Cookie.remove(key, { path })
|
|
33
|
+
}
|
package/packages/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: 王国火
|
|
4
4
|
* @Date: 2022-09-15 17:02:55
|
|
5
|
-
* @LastEditTime: 2022-10-
|
|
5
|
+
* @LastEditTime: 2022-10-18 12:39:29
|
|
6
6
|
* @LastEditors: 王国火
|
|
7
7
|
*/
|
|
8
8
|
import Vue from 'vue'
|
|
@@ -44,6 +44,7 @@ export default{
|
|
|
44
44
|
...Common
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
export const cookie=Common.cookie
|
|
47
48
|
export const store=Common.store
|
|
48
49
|
export const validate=Common.validate
|
|
49
50
|
export const website=Common.website
|