@iswangh/element-plus-kit 0.1.0 → 0.1.1
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 +41 -14
- package/dist/resolver.js +3 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -41,7 +41,8 @@ import { createApp } from 'vue'
|
|
|
41
41
|
import ElementPlus from 'element-plus'
|
|
42
42
|
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
|
43
43
|
import ElementPlusKit from '@iswangh/element-plus-kit'
|
|
44
|
-
import '
|
|
44
|
+
import App from './App.vue'
|
|
45
|
+
// 注意:WForm 组件已按需导入了所有内部使用的 Element Plus 组件样式,无需导入全局样式
|
|
45
46
|
|
|
46
47
|
const app = createApp(App)
|
|
47
48
|
|
|
@@ -99,9 +100,11 @@ import App from './App.vue'
|
|
|
99
100
|
```typescript
|
|
100
101
|
import { createApp } from 'vue'
|
|
101
102
|
import ElementPlusKit from '@iswangh/element-plus-kit'
|
|
103
|
+
import App from './App.vue'
|
|
102
104
|
|
|
103
105
|
const app = createApp(App)
|
|
104
106
|
app.use(ElementPlusKit)
|
|
107
|
+
app.mount('#app')
|
|
105
108
|
```
|
|
106
109
|
|
|
107
110
|
```vue
|
|
@@ -114,8 +117,9 @@ app.use(ElementPlusKit)
|
|
|
114
117
|
|
|
115
118
|
```vue
|
|
116
119
|
<script setup lang="ts">
|
|
120
|
+
import { ref } from 'vue'
|
|
117
121
|
import { WForm } from '@iswangh/element-plus-kit'
|
|
118
|
-
import type { FormItems } from '@iswangh/element-plus-kit
|
|
122
|
+
import type { FormItems } from '@iswangh/element-plus-kit'
|
|
119
123
|
|
|
120
124
|
const formItems: FormItems = [
|
|
121
125
|
{
|
|
@@ -154,22 +158,26 @@ import vue from '@vitejs/plugin-vue'
|
|
|
154
158
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
155
159
|
import Components from 'unplugin-vue-components/vite'
|
|
156
160
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
157
|
-
import { ElementPlusKitResolver
|
|
161
|
+
import { ElementPlusKitResolver } from '@iswangh/element-plus-kit/resolver'
|
|
158
162
|
|
|
159
163
|
export default defineConfig({
|
|
160
164
|
plugins: [
|
|
161
165
|
vue(),
|
|
162
166
|
AutoImport({
|
|
163
167
|
resolvers: [
|
|
168
|
+
// ElementPlusResolver 默认 importStyle 为 'css',会自动导入模板中直接使用的 Element Plus 组件样式
|
|
169
|
+
// 注意:WForm 组件内部使用的 Element Plus 组件样式已在组件包内按需导入,无需额外配置
|
|
164
170
|
ElementPlusResolver(),
|
|
165
|
-
|
|
171
|
+
ElementPlusKitResolver(), // ElementPlusKitResolver 同时支持 AutoImport 和 Components
|
|
166
172
|
],
|
|
167
173
|
imports: ['vue'],
|
|
168
174
|
}),
|
|
169
175
|
Components({
|
|
170
176
|
resolvers: [
|
|
177
|
+
// ElementPlusResolver 默认 importStyle 为 'css',会自动导入模板中直接使用的 Element Plus 组件样式
|
|
178
|
+
// 注意:WForm 组件内部使用的 Element Plus 组件样式已在组件包内按需导入,无需额外配置
|
|
171
179
|
ElementPlusResolver(),
|
|
172
|
-
ElementPlusKitResolver(),
|
|
180
|
+
ElementPlusKitResolver(), // ElementPlusKitResolver 同时支持 AutoImport 和 Components
|
|
173
181
|
],
|
|
174
182
|
}),
|
|
175
183
|
],
|
|
@@ -181,7 +189,7 @@ export default defineConfig({
|
|
|
181
189
|
```vue
|
|
182
190
|
<script setup lang="ts">
|
|
183
191
|
// 无需手动导入,组件会自动导入
|
|
184
|
-
import type { FormItems } from '@iswangh/element-plus-kit
|
|
192
|
+
import type { FormItems } from '@iswangh/element-plus-kit'
|
|
185
193
|
|
|
186
194
|
const formItems: FormItems = [
|
|
187
195
|
{
|
|
@@ -216,7 +224,9 @@ const form = ref({
|
|
|
216
224
|
|
|
217
225
|
### ElementPlusKitResolver
|
|
218
226
|
|
|
219
|
-
|
|
227
|
+
统一解析器,同时支持 `unplugin-vue-components` 和 `unplugin-auto-import`。
|
|
228
|
+
|
|
229
|
+
**用于组件自动导入**(`unplugin-vue-components`):
|
|
220
230
|
|
|
221
231
|
```typescript
|
|
222
232
|
import { ElementPlusKitResolver } from '@iswangh/element-plus-kit/resolver'
|
|
@@ -229,21 +239,35 @@ Components({
|
|
|
229
239
|
})
|
|
230
240
|
```
|
|
231
241
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
用于 `unplugin-auto-import` 的 API 自动导入。
|
|
242
|
+
**用于 API 自动导入**(`unplugin-auto-import`):
|
|
235
243
|
|
|
236
244
|
```typescript
|
|
237
|
-
import {
|
|
245
|
+
import { ElementPlusKitResolver } from '@iswangh/element-plus-kit/resolver'
|
|
238
246
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
239
247
|
|
|
240
248
|
AutoImport({
|
|
241
249
|
resolvers: [
|
|
242
|
-
|
|
250
|
+
ElementPlusKitResolver(), // 同一个解析器可以同时用于两种插件
|
|
243
251
|
],
|
|
244
252
|
})
|
|
245
253
|
```
|
|
246
254
|
|
|
255
|
+
**同时使用**(推荐):
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
import { ElementPlusKitResolver } from '@iswangh/element-plus-kit/resolver'
|
|
259
|
+
import AutoImport from 'unplugin-auto-import/vite'
|
|
260
|
+
import Components from 'unplugin-vue-components/vite'
|
|
261
|
+
|
|
262
|
+
AutoImport({
|
|
263
|
+
resolvers: [ElementPlusKitResolver()],
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
Components({
|
|
267
|
+
resolvers: [ElementPlusKitResolver()],
|
|
268
|
+
})
|
|
269
|
+
```
|
|
270
|
+
|
|
247
271
|
## 📖 API 文档
|
|
248
272
|
|
|
249
273
|
### 全局安装函数
|
|
@@ -283,8 +307,9 @@ import type {
|
|
|
283
307
|
|
|
284
308
|
```vue
|
|
285
309
|
<script setup lang="ts">
|
|
310
|
+
import { ref } from 'vue'
|
|
286
311
|
import { WForm } from '@iswangh/element-plus-kit'
|
|
287
|
-
import type { FormItems } from '@iswangh/element-plus-kit
|
|
312
|
+
import type { FormItems } from '@iswangh/element-plus-kit'
|
|
288
313
|
|
|
289
314
|
const formItems: FormItems = [
|
|
290
315
|
{
|
|
@@ -324,8 +349,9 @@ const form = ref({
|
|
|
324
349
|
|
|
325
350
|
```vue
|
|
326
351
|
<script setup lang="ts">
|
|
352
|
+
import { ref } from 'vue'
|
|
327
353
|
import { WForm } from '@iswangh/element-plus-kit'
|
|
328
|
-
import type { FormItems, ActionConfig } from '@iswangh/element-plus-kit
|
|
354
|
+
import type { FormItems, ActionConfig } from '@iswangh/element-plus-kit'
|
|
329
355
|
|
|
330
356
|
const formItems: FormItems = [
|
|
331
357
|
{
|
|
@@ -360,6 +386,7 @@ const form = ref({
|
|
|
360
386
|
- [Form 组件文档](../form/README.md)
|
|
361
387
|
- [核心工具包文档](../core/README.md)
|
|
362
388
|
- [Element Plus 文档](https://element-plus.org/zh-CN/)
|
|
389
|
+
- [Gitee 仓库](https://gitee.com/iswangh/element-plus-kit)
|
|
363
390
|
- [GitHub 仓库](https://github.com/iswangh/element-plus-kit)
|
|
364
391
|
|
|
365
392
|
## 📄 许可证
|
package/dist/resolver.js
CHANGED
|
@@ -18,6 +18,9 @@ function c() {
|
|
|
18
18
|
return {
|
|
19
19
|
name: o,
|
|
20
20
|
from: `@iswangh/${e}`,
|
|
21
|
+
// sideEffects 配置:确保样式文件在 Tree Shaking 时不被移除
|
|
22
|
+
// 注意:packages/form/src/index.ts 中已按需导入了所有 Element Plus 组件样式,
|
|
23
|
+
// 当组件被导入时,样式会自动被导入,无需额外配置
|
|
21
24
|
sideEffects: `@iswangh/${e}/style.css`
|
|
22
25
|
};
|
|
23
26
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iswangh/element-plus-kit",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
5
|
-
"description": "Element Plus Kit -
|
|
4
|
+
"version": "0.1.1",
|
|
5
|
+
"description": "Element Plus Kit - 基于 Element Plus 的 Vue 3 组件集合",
|
|
6
6
|
"author": "iswangh",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://
|
|
10
|
+
"url": "https://gitee.com/iswangh/element-plus-kit.git"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
13
|
"vue",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"vue": "^3.5.23"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@iswangh/element-plus-kit-form": "0.1.
|
|
42
|
+
"@iswangh/element-plus-kit-form": "0.1.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@vitejs/plugin-vue": "^6.0.1",
|