@hzw-tech/utils 0.0.3 → 0.0.5

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/dist/vite.js CHANGED
@@ -29,8 +29,8 @@ function autoImport(options) {
29
29
  dtsMode: 'overwrite',
30
30
  }
31
31
 
32
- if (!isPublish && !optDefault.imports.includes('@hzw-techils')) {
33
- optDefault.imports.push({ '@hzw-techils': ['utils', 'css', 'bem'] })
32
+ if (!isPublish && !optDefault.imports.includes('@hzw-tech/utils')) {
33
+ optDefault.imports.push({ '@hzw-tech/utils': ['utils', 'css', 'bem'] })
34
34
  }
35
35
  const opt = Object.assign({}, optDefault, options)
36
36
  return AutoImportVite(opt)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hzw-tech/utils",
3
3
  "type": "module",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "description": "通用前端工具包,包含请求,正则校验,全局ts声明等",
6
6
  "author": "hzw-tech",
7
7
  "license": "MIT",
package/readme.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # @hzw-tech/utils
2
2
 
3
- 简称ftw,ts前端工具包,包含常用css类以及ts工具方法等。
3
+ hzw,ts前端工具包,包含常用css类以及ts工具方法等。
4
+
5
+ > [!WARNING]
6
+ > sass使用了最新版本语法,引入时使用@use 替换原先的@import
4
7
 
5
8
  ## 1.安装
6
9
 
@@ -10,7 +13,14 @@ pnpm i @hzw-tech/utils
10
13
  yarn add @hzw-tech/utils
11
14
  ```
12
15
 
13
- ## 2.使用
16
+ ## 2.特性
17
+
18
+ 1. 通用的工具方法,校验方法,bem,请求方法,支持配置
19
+ 2. 通用的scss样式,mixin,变量等,支持自定义
20
+ 3. 统一的eslint风格配置
21
+ 4. 全局导入vue,pinia,request,utils,validators等常用方法
22
+
23
+ ## 3.使用
14
24
 
15
25
  ### vue项目使用
16
26
 
@@ -55,7 +65,7 @@ app.use(hzwUtils, { storage: { prefix: 'hzw' } })
55
65
 
56
66
  ### vite配置
57
67
 
58
- 在vite中配置autoImport后,会将ftw的相关方法注入到ts和vue文件中
68
+ 在vite中配置autoImport后,会将相关方法注入到ts和vue文件中
59
69
 
60
70
  ```ts
61
71
  import vite from '@hzw-tech/utils/dist/vite'
@@ -74,7 +84,41 @@ export default defineConfig({
74
84
  })
75
85
  ```
76
86
 
77
- ### 主题修改,自定义scss变量
87
+ ## 4.自定义配置
88
+
89
+ 1. 工具整体配置:
90
+
91
+ ```ts
92
+ app.use(hzwUtils, {
93
+ aes: {
94
+ encryptKey: string;
95
+ };
96
+ appVersion: number;
97
+ storage: {
98
+ needAes?: boolean;
99
+ prefix?: string;
100
+ };
101
+ })
102
+ ```
103
+
104
+ 2. 请求配置
105
+
106
+ ---
107
+
108
+ 默认请求配置:
109
+
110
+ request.setConfig({
111
+ loading: true,
112
+ baseURL: '/cgi',
113
+ });
114
+
115
+ 新增请求类:
116
+
117
+ const requestAdmin=new ApiRequest({baseURL: '/admin'});
118
+
119
+ ---
120
+
121
+ 3. 样式配置,自定义scss变量
78
122
 
79
123
  1.新建一个scss文件,比如src/styles/index.scss,内容如下:
80
124
 
@@ -104,7 +148,7 @@ export default defineConfig({
104
148
  }
105
149
  ```
106
150
 
107
- ## 3.工具列表
151
+ ## 5.工具列表
108
152
 
109
153
  [bem](./dist/ts/bem.d.ts)
110
154
  [reg](./dist/ts/reg.d.ts)