byt-ui 0.0.10 → 0.0.12
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/README.md +2 -2
- package/lib/byt-ui.common.js +29 -50
- package/lib/byt-ui.umd.js +29 -50
- package/lib/byt-ui.umd.min.js +1 -1
- package/package.json +3 -1
- package/packages/common/index.js +6 -3
- package/packages/common/modules/store.js +18 -37
- package/packages/index.js +2 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "byt-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "byt组件库",
|
|
6
6
|
"author": {
|
|
@@ -27,10 +27,12 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/core": "^7.12.16",
|
|
29
29
|
"@babel/eslint-parser": "^7.12.16",
|
|
30
|
+
"@babel/preset-env": "^7.19.4",
|
|
30
31
|
"@vue/cli-plugin-babel": "~5.0.0",
|
|
31
32
|
"@vue/cli-plugin-eslint": "~5.0.0",
|
|
32
33
|
"@vue/cli-service": "~5.0.0",
|
|
33
34
|
"babel-plugin-component": "^1.1.1",
|
|
35
|
+
"babel-preset-env": "^1.7.0",
|
|
34
36
|
"eslint": "^7.32.0",
|
|
35
37
|
"eslint-plugin-vue": "^8.0.3",
|
|
36
38
|
"node-sass": "4.14.1",
|
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-25 09:48:55
|
|
6
6
|
* @LastEditors: 王国火
|
|
7
7
|
*/
|
|
8
8
|
// 动态引入
|
|
@@ -11,7 +11,10 @@ const requireContext = require.context('./modules', true, /.*\.js/)
|
|
|
11
11
|
requireContext.keys().map(key => {
|
|
12
12
|
const reg=/\w+/
|
|
13
13
|
const k=key.match(reg)[0]
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
if(requireContext(key).default){
|
|
15
|
+
conmmon[k]=requireContext(key).default
|
|
16
|
+
}else{
|
|
17
|
+
conmmon=Object.assign(conmmon,requireContext(key))
|
|
18
|
+
}
|
|
16
19
|
})
|
|
17
20
|
export default conmmon
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Description:
|
|
3
|
+
* @Author: 王国火
|
|
4
|
+
* @Date: 2022-10-08 09:10:49
|
|
5
|
+
* @LastEditTime: 2022-10-25 10:30:28
|
|
6
|
+
* @LastEditors: 王国火
|
|
7
|
+
*/
|
|
1
8
|
import { validatenull } from './validate'
|
|
2
9
|
import website from './website'
|
|
3
10
|
//存储前缀 避免与同域的其它项目冲突
|
|
@@ -5,22 +12,14 @@ const keyName = website.key
|
|
|
5
12
|
/**
|
|
6
13
|
* 存储localStorage
|
|
7
14
|
*/
|
|
8
|
-
export const setStore = (
|
|
9
|
-
|
|
10
|
-
name
|
|
11
|
-
} = params
|
|
12
|
-
const {
|
|
13
|
-
content,
|
|
14
|
-
type
|
|
15
|
-
} = params
|
|
16
|
-
name = keyName + name
|
|
15
|
+
export const setStore = (key,value,type=0) => {
|
|
16
|
+
const name = `${keyName}-${key}`
|
|
17
17
|
const obj = {
|
|
18
|
-
dataType: typeof (
|
|
19
|
-
content:
|
|
18
|
+
dataType: typeof (value),
|
|
19
|
+
content: value,
|
|
20
20
|
type: type,
|
|
21
21
|
datetime: new Date().getTime()
|
|
22
22
|
}
|
|
23
|
-
|
|
24
23
|
if (type) {
|
|
25
24
|
window.sessionStorage.setItem(name, JSON.stringify(obj))
|
|
26
25
|
} else {
|
|
@@ -31,18 +30,10 @@ export const setStore = (params = {}) => {
|
|
|
31
30
|
* 获取localStorage
|
|
32
31
|
*/
|
|
33
32
|
|
|
34
|
-
export const getStore = (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} = params
|
|
38
|
-
const {
|
|
39
|
-
debug
|
|
40
|
-
} = params
|
|
41
|
-
name = keyName + name
|
|
42
|
-
let obj = {}
|
|
33
|
+
export const getStore = (key,debug = false) => {
|
|
34
|
+
const name = `${keyName}-${key}`
|
|
35
|
+
let obj = window.sessionStorage.getItem(name)||window.localStorage.getItem(name)
|
|
43
36
|
let content
|
|
44
|
-
obj = window.sessionStorage.getItem(name)
|
|
45
|
-
if (validatenull(obj)) obj = window.localStorage.getItem(name)
|
|
46
37
|
if (validatenull(obj)) return
|
|
47
38
|
try {
|
|
48
39
|
obj = JSON.parse(obj)
|
|
@@ -66,14 +57,8 @@ export const getStore = (params = {}) => {
|
|
|
66
57
|
/**
|
|
67
58
|
* 删除localStorage
|
|
68
59
|
*/
|
|
69
|
-
export const removeStore = (
|
|
70
|
-
|
|
71
|
-
name
|
|
72
|
-
} = params
|
|
73
|
-
const {
|
|
74
|
-
type
|
|
75
|
-
} = params
|
|
76
|
-
name = keyName + name
|
|
60
|
+
export const removeStore = (key,type=0) => {
|
|
61
|
+
const name = `${keyName}-${key}`
|
|
77
62
|
if (type) {
|
|
78
63
|
window.sessionStorage.removeItem(name)
|
|
79
64
|
} else {
|
|
@@ -84,11 +69,8 @@ export const removeStore = (params = {}) => {
|
|
|
84
69
|
/**
|
|
85
70
|
* 获取全部localStorage
|
|
86
71
|
*/
|
|
87
|
-
export const getAllStore = (
|
|
72
|
+
export const getAllStore = (type=0) => {
|
|
88
73
|
const list = []
|
|
89
|
-
const {
|
|
90
|
-
type
|
|
91
|
-
} = params
|
|
92
74
|
if (type) {
|
|
93
75
|
for (let i = 0; i <= window.sessionStorage.length; i++) {
|
|
94
76
|
list.push({
|
|
@@ -115,8 +97,7 @@ export const getAllStore = (params = {}) => {
|
|
|
115
97
|
/**
|
|
116
98
|
* 清空全部localStorage
|
|
117
99
|
*/
|
|
118
|
-
export const clearStore = (
|
|
119
|
-
const { type } = params
|
|
100
|
+
export const clearStore = (type=0) => {
|
|
120
101
|
if (type) {
|
|
121
102
|
window.sessionStorage.clear()
|
|
122
103
|
} else {
|
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-25 09:47:57
|
|
6
6
|
* @LastEditors: 王国火
|
|
7
7
|
*/
|
|
8
8
|
import Vue from 'vue'
|
|
@@ -44,8 +44,4 @@ export default{
|
|
|
44
44
|
...Common
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export const
|
|
48
|
-
export const store=Common.store
|
|
49
|
-
export const validate=Common.validate
|
|
50
|
-
export const website=Common.website
|
|
51
|
-
|
|
47
|
+
export const utils=Common
|