ep-craft 0.1.42 → 0.2.0
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-ai/components/affix.json +152 -0
- package/dist-ai/components/affix.md +73 -0
- package/dist-ai/components/alert.json +186 -0
- package/dist-ai/components/alert.md +89 -0
- package/dist-ai/components/anchor-link.json +102 -0
- package/dist-ai/components/anchor-link.md +67 -0
- package/dist-ai/components/anchor.json +179 -0
- package/dist-ai/components/anchor.md +87 -0
- package/dist-ai/components/aside.json +87 -0
- package/dist-ai/components/aside.md +63 -0
- package/dist-ai/components/autocomplete.json +613 -0
- package/dist-ai/components/autocomplete.md +140 -0
- package/dist-ai/components/avatar.json +163 -0
- package/dist-ai/components/avatar.md +83 -0
- package/dist-ai/components/backtop.json +118 -0
- package/dist-ai/components/backtop.md +66 -0
- package/dist-ai/components/badge.json +186 -0
- package/dist-ai/components/badge.md +85 -0
- package/dist-ai/components/breadcrumb-item.json +97 -0
- package/dist-ai/components/breadcrumb-item.md +65 -0
- package/dist-ai/components/breadcrumb.json +100 -0
- package/dist-ai/components/breadcrumb.md +68 -0
- package/dist-ai/components/button-group.json +123 -0
- package/dist-ai/components/button-group.md +65 -0
- package/dist-ai/components/button.json +349 -0
- package/dist-ai/components/button.md +124 -0
- package/dist-ai/components/calendar.json +148 -0
- package/dist-ai/components/calendar.md +74 -0
- package/dist-ai/components/card.json +168 -0
- package/dist-ai/components/card.md +87 -0
- package/dist-ai/components/carousel-item.json +99 -0
- package/dist-ai/components/carousel-item.md +68 -0
- package/dist-ai/components/carousel.json +245 -0
- package/dist-ai/components/carousel.md +97 -0
- package/dist-ai/components/cascader-panel.json +242 -0
- package/dist-ai/components/cascader-panel.md +108 -0
- package/dist-ai/components/cascader.json +531 -0
- package/dist-ai/components/cascader.md +146 -0
- package/dist-ai/components/check-tag.json +133 -0
- package/dist-ai/components/check-tag.md +72 -0
- package/dist-ai/components/checkbox-button.json +279 -0
- package/dist-ai/components/checkbox-button.md +94 -0
- package/dist-ai/components/checkbox-group.json +236 -0
- package/dist-ai/components/checkbox-group.md +90 -0
- package/dist-ai/components/checkbox.json +278 -0
- package/dist-ai/components/checkbox.md +91 -0
- package/dist-ai/components/col.json +168 -0
- package/dist-ai/components/col.md +72 -0
- package/dist-ai/components/collapse-item.json +133 -0
- package/dist-ai/components/collapse-item.md +75 -0
- package/dist-ai/components/collapse-transition.json +75 -0
- package/dist-ai/components/collapse-transition.md +59 -0
- package/dist-ai/components/collapse.json +129 -0
- package/dist-ai/components/collapse.md +76 -0
- package/dist-ai/components/color-picker.json +280 -0
- package/dist-ai/components/color-picker.md +85 -0
- package/dist-ai/components/config-provider.json +222 -0
- package/dist-ai/components/config-provider.md +76 -0
- package/dist-ai/components/container.json +95 -0
- package/dist-ai/components/container.md +70 -0
- package/dist-ai/components/countdown.json +155 -0
- package/dist-ai/components/countdown.md +73 -0
- package/dist-ai/components/date-picker-panel.json +346 -0
- package/dist-ai/components/date-picker-panel.md +91 -0
- package/dist-ai/components/date-picker.json +574 -0
- package/dist-ai/components/date-picker.md +153 -0
- package/dist-ai/components/descriptions-item.json +175 -0
- package/dist-ai/components/descriptions-item.md +73 -0
- package/dist-ai/components/descriptions.json +171 -0
- package/dist-ai/components/descriptions.md +78 -0
- package/dist-ai/components/dialog.json +403 -0
- package/dist-ai/components/dialog.md +108 -0
- package/dist-ai/components/divider.json +102 -0
- package/dist-ai/components/divider.md +59 -0
- package/dist-ai/components/drawer.json +468 -0
- package/dist-ai/components/drawer.md +115 -0
- package/dist-ai/components/dropdown-item.json +156 -0
- package/dist-ai/components/dropdown-item.md +84 -0
- package/dist-ai/components/dropdown-menu.json +92 -0
- package/dist-ai/components/dropdown-menu.md +70 -0
- package/dist-ai/components/dropdown.json +374 -0
- package/dist-ai/components/dropdown.md +108 -0
- package/dist-ai/components/empty.json +116 -0
- package/dist-ai/components/empty.md +62 -0
- package/dist-ai/components/footer.json +86 -0
- package/dist-ai/components/footer.md +63 -0
- package/dist-ai/components/form-item.json +242 -0
- package/dist-ai/components/form-item.md +93 -0
- package/dist-ai/components/form.json +277 -0
- package/dist-ai/components/form.md +117 -0
- package/dist-ai/components/header.json +86 -0
- package/dist-ai/components/header.md +63 -0
- package/dist-ai/components/icon.json +95 -0
- package/dist-ai/components/icon.md +61 -0
- package/dist-ai/components/image-viewer.json +235 -0
- package/dist-ai/components/image-viewer.md +88 -0
- package/dist-ai/components/image.json +299 -0
- package/dist-ai/components/image.md +96 -0
- package/dist-ai/components/input-number.json +370 -0
- package/dist-ai/components/input-number.md +127 -0
- package/dist-ai/components/input.json +545 -0
- package/dist-ai/components/input.md +166 -0
- package/dist-ai/components/link.json +162 -0
- package/dist-ai/components/link.md +72 -0
- package/dist-ai/components/main.json +77 -0
- package/dist-ai/components/main.md +58 -0
- package/dist-ai/components/mention.json +598 -0
- package/dist-ai/components/mention.md +136 -0
- package/dist-ai/components/menu-item-group.json +101 -0
- package/dist-ai/components/menu-item-group.md +69 -0
- package/dist-ai/components/menu-item.json +131 -0
- package/dist-ai/components/menu-item.md +76 -0
- package/dist-ai/components/menu.json +314 -0
- package/dist-ai/components/menu.md +104 -0
- package/dist-ai/components/option-group.json +113 -0
- package/dist-ai/components/option-group.md +79 -0
- package/dist-ai/components/option.json +122 -0
- package/dist-ai/components/option.md +70 -0
- package/dist-ai/components/page-header.json +131 -0
- package/dist-ai/components/page-header.md +70 -0
- package/dist-ai/components/pagination.json +325 -0
- package/dist-ai/components/pagination.md +115 -0
- package/dist-ai/components/popconfirm.json +240 -0
- package/dist-ai/components/popconfirm.md +89 -0
- package/dist-ai/components/popover.json +351 -0
- package/dist-ai/components/popover.md +99 -0
- package/dist-ai/components/popper.json +93 -0
- package/dist-ai/components/popper.md +66 -0
- package/dist-ai/components/progress.json +219 -0
- package/dist-ai/components/progress.md +74 -0
- package/dist-ai/components/radio-button.json +142 -0
- package/dist-ai/components/radio-button.md +76 -0
- package/dist-ai/components/radio-group.json +219 -0
- package/dist-ai/components/radio-group.md +88 -0
- package/dist-ai/components/radio.json +177 -0
- package/dist-ai/components/radio.md +83 -0
- package/dist-ai/components/rate.json +286 -0
- package/dist-ai/components/rate.md +83 -0
- package/dist-ai/components/result.json +118 -0
- package/dist-ai/components/result.md +66 -0
- package/dist-ai/components/row.json +115 -0
- package/dist-ai/components/row.md +68 -0
- package/dist-ai/components/scrollbar.json +280 -0
- package/dist-ai/components/scrollbar.md +89 -0
- package/dist-ai/components/segmented.json +204 -0
- package/dist-ai/components/segmented.md +81 -0
- package/dist-ai/components/select-v2.json +729 -0
- package/dist-ai/components/select-v2.md +193 -0
- package/dist-ai/components/select.json +697 -0
- package/dist-ai/components/select.md +188 -0
- package/dist-ai/components/skeleton-item.json +80 -0
- package/dist-ai/components/skeleton-item.md +57 -0
- package/dist-ai/components/skeleton.json +134 -0
- package/dist-ai/components/skeleton.md +65 -0
- package/dist-ai/components/slider.json +326 -0
- package/dist-ai/components/slider.md +88 -0
- package/dist-ai/components/space.json +178 -0
- package/dist-ai/components/space.md +73 -0
- package/dist-ai/components/statistic.json +167 -0
- package/dist-ai/components/statistic.md +66 -0
- package/dist-ai/components/step.json +124 -0
- package/dist-ai/components/step.md +69 -0
- package/dist-ai/components/steps.json +157 -0
- package/dist-ai/components/steps.md +79 -0
- package/dist-ai/components/sub-menu.json +211 -0
- package/dist-ai/components/sub-menu.md +88 -0
- package/dist-ai/components/switch.json +292 -0
- package/dist-ai/components/switch.md +88 -0
- package/dist-ai/components/tab-pane.json +137 -0
- package/dist-ai/components/tab-pane.md +72 -0
- package/dist-ai/components/table-column.json +368 -0
- package/dist-ai/components/table-column.md +103 -0
- package/dist-ai/components/table-v2.json +486 -0
- package/dist-ai/components/table-v2.md +123 -0
- package/dist-ai/components/table.json +734 -0
- package/dist-ai/components/table.md +205 -0
- package/dist-ai/components/tabs.json +231 -0
- package/dist-ai/components/tabs.md +127 -0
- package/dist-ai/components/tag.json +205 -0
- package/dist-ai/components/tag.md +105 -0
- package/dist-ai/components/text.json +143 -0
- package/dist-ai/components/text.md +66 -0
- package/dist-ai/components/time-picker.json +555 -0
- package/dist-ai/components/time-picker.md +123 -0
- package/dist-ai/components/time-select.json +321 -0
- package/dist-ai/components/time-select.md +93 -0
- package/dist-ai/components/timeline-item.json +186 -0
- package/dist-ai/components/timeline-item.md +78 -0
- package/dist-ai/components/timeline.json +99 -0
- package/dist-ai/components/timeline.md +65 -0
- package/dist-ai/components/tooltip.json +599 -0
- package/dist-ai/components/tooltip.md +137 -0
- package/dist-ai/components/tour-step.json +219 -0
- package/dist-ai/components/tour-step.md +88 -0
- package/dist-ai/components/tour.json +258 -0
- package/dist-ai/components/tour.md +96 -0
- package/dist-ai/components/transfer.json +275 -0
- package/dist-ai/components/transfer.md +95 -0
- package/dist-ai/components/tree-select.json +945 -0
- package/dist-ai/components/tree-select.md +181 -0
- package/dist-ai/components/tree-v2.json +395 -0
- package/dist-ai/components/tree-v2.md +113 -0
- package/dist-ai/components/tree.json +485 -0
- package/dist-ai/components/tree.md +131 -0
- package/dist-ai/components/upload.json +382 -0
- package/dist-ai/components/upload.md +130 -0
- package/dist-ai/components/watermark.json +157 -0
- package/dist-ai/components/watermark.md +66 -0
- package/dist-ai/directives/click-outside.json +61 -0
- package/dist-ai/directives/click-outside.md +50 -0
- package/dist-ai/directives/infinite-scroll.json +83 -0
- package/dist-ai/directives/infinite-scroll.md +62 -0
- package/dist-ai/directives/loading.json +89 -0
- package/dist-ai/directives/loading.md +69 -0
- package/dist-ai/directives/mousewheel.json +54 -0
- package/dist-ai/directives/mousewheel.md +48 -0
- package/dist-ai/directives/repeat-click.json +68 -0
- package/dist-ai/directives/repeat-click.md +49 -0
- package/dist-ai/directives/trap-focus.json +46 -0
- package/dist-ai/directives/trap-focus.md +46 -0
- package/dist-ai/icons.json +1 -0
- package/dist-ai/index.json +1 -0
- package/dist-ai/llms.txt +170 -0
- package/dist-ai/manifest.json +26590 -0
- package/dist-ai/schema/manifest.schema.json +793 -0
- package/dist-ai/services/infinite-scroll.json +80 -0
- package/dist-ai/services/infinite-scroll.md +71 -0
- package/dist-ai/services/loading.json +108 -0
- package/dist-ai/services/loading.md +58 -0
- package/dist-ai/services/message-box.json +159 -0
- package/dist-ai/services/message-box.md +78 -0
- package/dist-ai/services/message.json +137 -0
- package/dist-ai/services/message.md +72 -0
- package/dist-ai/services/notification.json +136 -0
- package/dist-ai/services/notification.md +73 -0
- package/package.json +12 -2
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entry": {
|
|
3
|
+
"callForm": "v-infinite-scroll=\"load\"(同时可通过 EpInfiniteScroll 安装)",
|
|
4
|
+
"category": "interaction",
|
|
5
|
+
"constraints": [
|
|
6
|
+
"回调在内容不足以填满容器时也会立即触发,需用 disabled 或加载中状态防止重复请求",
|
|
7
|
+
"只监听向下的滚动;向上滚动不会触发加载",
|
|
8
|
+
"需要可滚动的父容器或目标元素自身具有滚动区域"
|
|
9
|
+
],
|
|
10
|
+
"directiveId": "directive:infinite-scroll",
|
|
11
|
+
"exampleOmittedReason": null,
|
|
12
|
+
"examples": [
|
|
13
|
+
{
|
|
14
|
+
"code": "import { createApp } from 'vue'\nimport { EpInfiniteScroll } from 'ep-craft'\nimport App from './App.vue'\n\ncreateApp(App).use(EpInfiniteScroll).mount('#app')",
|
|
15
|
+
"id": "infinite-scroll-1",
|
|
16
|
+
"language": "ts",
|
|
17
|
+
"title": "注册无限滚动"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue'\nimport { vInfiniteScroll } from 'ep-craft'\n\nconst items = ref(Array.from({ length: 20 }, (_, index) => `条目 ${index + 1}`))\nconst loading = ref(false)\n\nconst load = () => {\n if (loading.value) return\n loading.value = true\n setTimeout(() => {\n const start = items.value.length\n items.value.push(...Array.from({ length: 10 }, (_, index) => `条目 ${start + index + 1}`))\n loading.value = false\n }, 300)\n}\n</script>\n\n<template>\n <div\n v-infinite-scroll=\"load\"\n infinite-scroll-distance=\"20\"\n style=\"height: 240px; overflow: auto\"\n >\n <p v-for=\"item in items\" :key=\"item\">{{ item }}</p>\n </div>\n</template>",
|
|
21
|
+
"id": "infinite-scroll-2",
|
|
22
|
+
"language": "vue",
|
|
23
|
+
"title": "加载更多列表"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"id": "service:infinite-scroll",
|
|
27
|
+
"keywords": {
|
|
28
|
+
"en": [
|
|
29
|
+
"infinite-scroll",
|
|
30
|
+
"load-more",
|
|
31
|
+
"scroll",
|
|
32
|
+
"pagination"
|
|
33
|
+
],
|
|
34
|
+
"zh": [
|
|
35
|
+
"无限滚动",
|
|
36
|
+
"加载更多",
|
|
37
|
+
"触底",
|
|
38
|
+
"滚动"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"kind": "service",
|
|
42
|
+
"methods": [],
|
|
43
|
+
"name": "EpInfiniteScroll",
|
|
44
|
+
"options": [
|
|
45
|
+
{
|
|
46
|
+
"defaultText": "200",
|
|
47
|
+
"description": "滚动后触发的节流毫秒数,通过 infinite-scroll-delay 设置",
|
|
48
|
+
"name": "delay",
|
|
49
|
+
"required": false,
|
|
50
|
+
"type": "number"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"defaultText": "0",
|
|
54
|
+
"description": "距底部多少像素触发,通过 infinite-scroll-distance 设置",
|
|
55
|
+
"name": "distance",
|
|
56
|
+
"required": false,
|
|
57
|
+
"type": "number"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"defaultText": "false",
|
|
61
|
+
"description": "是否禁用加载,通过 infinite-scroll-disabled 设置",
|
|
62
|
+
"name": "disabled",
|
|
63
|
+
"required": false,
|
|
64
|
+
"type": "boolean"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"defaultText": "true",
|
|
68
|
+
"description": "挂载时是否立即检查内容是否不足以填满容器",
|
|
69
|
+
"name": "immediate",
|
|
70
|
+
"required": false,
|
|
71
|
+
"type": "boolean"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"slug": "infinite-scroll",
|
|
75
|
+
"summary": "无限滚动指令,滚动接近底部时触发加载回调"
|
|
76
|
+
},
|
|
77
|
+
"generatedAt": "2026-11-03T03:09:12.050Z",
|
|
78
|
+
"libraryVersion": "0.2.0",
|
|
79
|
+
"schemaVersion": 1
|
|
80
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# EpInfiniteScroll
|
|
2
|
+
|
|
3
|
+
`v-infinite-scroll="load"(同时可通过 EpInfiniteScroll 安装)` · interaction(交互) · `service:infinite-scroll`
|
|
4
|
+
|
|
5
|
+
## 摘要
|
|
6
|
+
|
|
7
|
+
无限滚动指令,滚动接近底部时触发加载回调
|
|
8
|
+
|
|
9
|
+
## 关键词
|
|
10
|
+
|
|
11
|
+
- 中文:无限滚动、加载更多、触底、滚动
|
|
12
|
+
- English: infinite-scroll, load-more, scroll, pagination
|
|
13
|
+
|
|
14
|
+
## 调用方式
|
|
15
|
+
|
|
16
|
+
- 调用形式:v-infinite-scroll="load"(同时可通过 EpInfiniteScroll 安装)
|
|
17
|
+
- 选项 delay(number,默认 200):滚动后触发的节流毫秒数,通过 infinite-scroll-delay 设置
|
|
18
|
+
- 选项 distance(number,默认 0):距底部多少像素触发,通过 infinite-scroll-distance 设置
|
|
19
|
+
- 选项 disabled(boolean,默认 false):是否禁用加载,通过 infinite-scroll-disabled 设置
|
|
20
|
+
- 选项 immediate(boolean,默认 true):挂载时是否立即检查内容是否不足以填满容器
|
|
21
|
+
- 约束:回调在内容不足以填满容器时也会立即触发,需用 disabled 或加载中状态防止重复请求
|
|
22
|
+
- 约束:只监听向下的滚动;向上滚动不会触发加载
|
|
23
|
+
- 约束:需要可滚动的父容器或目标元素自身具有滚动区域
|
|
24
|
+
|
|
25
|
+
## 示例
|
|
26
|
+
|
|
27
|
+
### 注册无限滚动
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { createApp } from 'vue'
|
|
31
|
+
import { EpInfiniteScroll } from 'ep-craft'
|
|
32
|
+
import App from './App.vue'
|
|
33
|
+
|
|
34
|
+
createApp(App).use(EpInfiniteScroll).mount('#app')
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 加载更多列表
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<script setup lang="ts">
|
|
41
|
+
import { ref } from 'vue'
|
|
42
|
+
import { vInfiniteScroll } from 'ep-craft'
|
|
43
|
+
|
|
44
|
+
const items = ref(Array.from({ length: 20 }, (_, index) => `条目 ${index + 1}`))
|
|
45
|
+
const loading = ref(false)
|
|
46
|
+
|
|
47
|
+
const load = () => {
|
|
48
|
+
if (loading.value) return
|
|
49
|
+
loading.value = true
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
const start = items.value.length
|
|
52
|
+
items.value.push(...Array.from({ length: 10 }, (_, index) => `条目 ${start + index + 1}`))
|
|
53
|
+
loading.value = false
|
|
54
|
+
}, 300)
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<template>
|
|
59
|
+
<div
|
|
60
|
+
v-infinite-scroll="load"
|
|
61
|
+
infinite-scroll-distance="20"
|
|
62
|
+
style="height: 240px; overflow: auto"
|
|
63
|
+
>
|
|
64
|
+
<p v-for="item in items" :key="item">{{ item }}</p>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
ep-craft 0.2.0
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entry": {
|
|
3
|
+
"callForm": "EpLoading.service(options) 或 v-loading=\"loading\"",
|
|
4
|
+
"category": "feedback",
|
|
5
|
+
"constraints": [
|
|
6
|
+
"EpLoading.service 返回实例,请求结束后必须调用实例的 close()",
|
|
7
|
+
"v-loading 适用于模板内的局部加载,service 适用于页面级或无法访问模板的异步流程",
|
|
8
|
+
"同一目标重复创建实例会叠加遮罩,应复用实例或先关闭旧实例"
|
|
9
|
+
],
|
|
10
|
+
"directiveId": "directive:loading",
|
|
11
|
+
"exampleOmittedReason": null,
|
|
12
|
+
"examples": [
|
|
13
|
+
{
|
|
14
|
+
"code": "<script setup lang=\"ts\">\nimport { EpButton, EpLoading } from 'ep-craft'\nimport type { LoadingInstance } from 'ep-craft'\n\nlet instance: LoadingInstance | null = null\n\nconst start = async () => {\n instance = EpLoading.service({ target: document.body, text: '加载中' })\n await new Promise((resolve) => setTimeout(resolve, 1000))\n instance?.close()\n instance = null\n}\n</script>\n\n<template>\n <ep-button type=\"primary\" :loading=\"instance !== null\" @click=\"start\">\n 加载数据\n </ep-button>\n</template>",
|
|
15
|
+
"id": "loading-1",
|
|
16
|
+
"language": "vue",
|
|
17
|
+
"title": "服务方式加载"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"id": "service:loading",
|
|
21
|
+
"keywords": {
|
|
22
|
+
"en": [
|
|
23
|
+
"loading",
|
|
24
|
+
"spinner",
|
|
25
|
+
"mask",
|
|
26
|
+
"service"
|
|
27
|
+
],
|
|
28
|
+
"zh": [
|
|
29
|
+
"加载",
|
|
30
|
+
"等待",
|
|
31
|
+
"遮罩",
|
|
32
|
+
"loading"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"kind": "service",
|
|
36
|
+
"methods": [
|
|
37
|
+
{
|
|
38
|
+
"description": "关闭本次通过 service 创建的加载实例",
|
|
39
|
+
"name": "close",
|
|
40
|
+
"signature": "() => void"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"name": "EpLoading",
|
|
44
|
+
"options": [
|
|
45
|
+
{
|
|
46
|
+
"defaultText": "document.body",
|
|
47
|
+
"description": "需要覆盖的目标元素或选择器",
|
|
48
|
+
"name": "target",
|
|
49
|
+
"required": false,
|
|
50
|
+
"type": "HTMLElement | string"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"defaultText": "false",
|
|
54
|
+
"description": "是否覆盖整个 body,等价于 fullscreen 用法",
|
|
55
|
+
"name": "body",
|
|
56
|
+
"required": false,
|
|
57
|
+
"type": "boolean"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"defaultText": "false",
|
|
61
|
+
"description": "是否全屏显示加载遮罩",
|
|
62
|
+
"name": "fullscreen",
|
|
63
|
+
"required": false,
|
|
64
|
+
"type": "boolean"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"defaultText": "false",
|
|
68
|
+
"description": "是否锁定页面滚动",
|
|
69
|
+
"name": "lock",
|
|
70
|
+
"required": false,
|
|
71
|
+
"type": "boolean"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"defaultText": "''",
|
|
75
|
+
"description": "加载图标下方的文字",
|
|
76
|
+
"name": "text",
|
|
77
|
+
"required": false,
|
|
78
|
+
"type": "string | VNode | VNode[]"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"defaultText": "false",
|
|
82
|
+
"description": "自定义加载图标类名",
|
|
83
|
+
"name": "spinner",
|
|
84
|
+
"required": false,
|
|
85
|
+
"type": "boolean | string"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"defaultText": null,
|
|
89
|
+
"description": "遮罩背景色",
|
|
90
|
+
"name": "background",
|
|
91
|
+
"required": false,
|
|
92
|
+
"type": "string"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"defaultText": "''",
|
|
96
|
+
"description": "加载遮罩的自定义类名",
|
|
97
|
+
"name": "customClass",
|
|
98
|
+
"required": false,
|
|
99
|
+
"type": "string"
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"slug": "loading",
|
|
103
|
+
"summary": "加载服务,在目标区域或全屏展示等待遮罩"
|
|
104
|
+
},
|
|
105
|
+
"generatedAt": "2026-11-03T03:09:12.050Z",
|
|
106
|
+
"libraryVersion": "0.2.0",
|
|
107
|
+
"schemaVersion": 1
|
|
108
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# EpLoading
|
|
2
|
+
|
|
3
|
+
`EpLoading.service(options) 或 v-loading="loading"` · feedback(反馈) · `service:loading`
|
|
4
|
+
|
|
5
|
+
## 摘要
|
|
6
|
+
|
|
7
|
+
加载服务,在目标区域或全屏展示等待遮罩
|
|
8
|
+
|
|
9
|
+
## 关键词
|
|
10
|
+
|
|
11
|
+
- 中文:加载、等待、遮罩、loading
|
|
12
|
+
- English: loading, spinner, mask, service
|
|
13
|
+
|
|
14
|
+
## 调用方式
|
|
15
|
+
|
|
16
|
+
- 调用形式:EpLoading.service(options) 或 v-loading="loading"
|
|
17
|
+
- 选项 target(HTMLElement | string,默认 document.body):需要覆盖的目标元素或选择器
|
|
18
|
+
- 选项 body(boolean,默认 false):是否覆盖整个 body,等价于 fullscreen 用法
|
|
19
|
+
- 选项 fullscreen(boolean,默认 false):是否全屏显示加载遮罩
|
|
20
|
+
- 选项 lock(boolean,默认 false):是否锁定页面滚动
|
|
21
|
+
- 选项 text(string | VNode | VNode[],默认 ''):加载图标下方的文字
|
|
22
|
+
- 选项 spinner(boolean | string,默认 false):自定义加载图标类名
|
|
23
|
+
- 选项 background(string):遮罩背景色
|
|
24
|
+
- 选项 customClass(string,默认 ''):加载遮罩的自定义类名
|
|
25
|
+
- 方法 close() => void:关闭本次通过 service 创建的加载实例
|
|
26
|
+
- 约束:EpLoading.service 返回实例,请求结束后必须调用实例的 close()
|
|
27
|
+
- 约束:v-loading 适用于模板内的局部加载,service 适用于页面级或无法访问模板的异步流程
|
|
28
|
+
- 约束:同一目标重复创建实例会叠加遮罩,应复用实例或先关闭旧实例
|
|
29
|
+
|
|
30
|
+
## 示例
|
|
31
|
+
|
|
32
|
+
### 服务方式加载
|
|
33
|
+
|
|
34
|
+
```vue
|
|
35
|
+
<script setup lang="ts">
|
|
36
|
+
import { EpButton, EpLoading } from 'ep-craft'
|
|
37
|
+
import type { LoadingInstance } from 'ep-craft'
|
|
38
|
+
|
|
39
|
+
let instance: LoadingInstance | null = null
|
|
40
|
+
|
|
41
|
+
const start = async () => {
|
|
42
|
+
instance = EpLoading.service({ target: document.body, text: '加载中' })
|
|
43
|
+
await new Promise((resolve) => setTimeout(resolve, 1000))
|
|
44
|
+
instance?.close()
|
|
45
|
+
instance = null
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<ep-button type="primary" :loading="instance !== null" @click="start">
|
|
51
|
+
加载数据
|
|
52
|
+
</ep-button>
|
|
53
|
+
</template>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
ep-craft 0.2.0
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entry": {
|
|
3
|
+
"callForm": "EpMessageBox.confirm(message, title, options) → Promise",
|
|
4
|
+
"category": "feedback",
|
|
5
|
+
"constraints": [
|
|
6
|
+
"confirm 与 prompt 在用户取消时 Promise 会 reject,调用方必须捕获或处理取消分支",
|
|
7
|
+
"消息框是模态交互,不应在循环或高频事件中重复弹出",
|
|
8
|
+
"需要自定义复杂表单时使用 EpDialog 组件而不是 prompt"
|
|
9
|
+
],
|
|
10
|
+
"directiveId": null,
|
|
11
|
+
"exampleOmittedReason": null,
|
|
12
|
+
"examples": [
|
|
13
|
+
{
|
|
14
|
+
"code": "<script setup lang=\"ts\">\nimport { EpButton, EpMessageBox } from 'ep-craft'\n\nconst remove = async () => {\n try {\n await EpMessageBox.confirm('删除后无法恢复,是否继续?', '删除确认', {\n type: 'warning',\n confirmButtonText: '删除',\n cancelButtonText: '取消',\n })\n EpMessageBox.close()\n } catch {\n // 用户取消\n }\n}\n</script>\n\n<template>\n <ep-button type=\"danger\" @click=\"remove\">删除</ep-button>\n</template>",
|
|
15
|
+
"id": "message-box-1",
|
|
16
|
+
"language": "vue",
|
|
17
|
+
"title": "确认操作"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"code": "import { EpMessageBox } from 'ep-craft'\n\nconst { value } = await EpMessageBox.prompt('请输入项目名称', '新建项目', {\n inputPlaceholder: '例如:营销活动页',\n confirmButtonText: '创建',\n})\nconsole.log(value)",
|
|
21
|
+
"id": "message-box-2",
|
|
22
|
+
"language": "ts",
|
|
23
|
+
"title": "输入提示"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"id": "service:message-box",
|
|
27
|
+
"keywords": {
|
|
28
|
+
"en": [
|
|
29
|
+
"message-box",
|
|
30
|
+
"confirm",
|
|
31
|
+
"alert",
|
|
32
|
+
"prompt",
|
|
33
|
+
"modal"
|
|
34
|
+
],
|
|
35
|
+
"zh": [
|
|
36
|
+
"消息框",
|
|
37
|
+
"确认框",
|
|
38
|
+
"警告",
|
|
39
|
+
"输入框",
|
|
40
|
+
"弹窗"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"kind": "service",
|
|
44
|
+
"methods": [
|
|
45
|
+
{
|
|
46
|
+
"description": "只有确认按钮的警告框",
|
|
47
|
+
"name": "alert",
|
|
48
|
+
"signature": "(message: string | VNode, title?: string, options?: MessageBoxOptions) => Promise<MessageBoxData>"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"description": "带确认与取消按钮的确认框;取消时 Promise reject",
|
|
52
|
+
"name": "confirm",
|
|
53
|
+
"signature": "(message: string | VNode, title?: string, options?: MessageBoxOptions) => Promise<MessageBoxData>"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"description": "带输入框的提示框",
|
|
57
|
+
"name": "prompt",
|
|
58
|
+
"signature": "(message: string | VNode, title?: string, options?: MessageBoxOptions) => Promise<MessageBoxData>"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"description": "关闭当前全部消息框实例",
|
|
62
|
+
"name": "close",
|
|
63
|
+
"signature": "() => void"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"name": "EpMessageBox",
|
|
67
|
+
"options": [
|
|
68
|
+
{
|
|
69
|
+
"defaultText": "''",
|
|
70
|
+
"description": "消息框标题",
|
|
71
|
+
"name": "title",
|
|
72
|
+
"required": false,
|
|
73
|
+
"type": "string"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"defaultText": "''",
|
|
77
|
+
"description": "消息框正文",
|
|
78
|
+
"name": "message",
|
|
79
|
+
"required": true,
|
|
80
|
+
"type": "string | VNode | ((params) => VNode)"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"defaultText": "''",
|
|
84
|
+
"description": "标题前的状态图标类型",
|
|
85
|
+
"name": "type",
|
|
86
|
+
"required": false,
|
|
87
|
+
"type": "'success' | 'info' | 'warning' | 'error'"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"defaultText": "'确定'",
|
|
91
|
+
"description": "确认按钮文案",
|
|
92
|
+
"name": "confirmButtonText",
|
|
93
|
+
"required": false,
|
|
94
|
+
"type": "string"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"defaultText": "'取消'",
|
|
98
|
+
"description": "取消按钮文案",
|
|
99
|
+
"name": "cancelButtonText",
|
|
100
|
+
"required": false,
|
|
101
|
+
"type": "string"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"defaultText": "false",
|
|
105
|
+
"description": "是否显示取消按钮",
|
|
106
|
+
"name": "showCancelButton",
|
|
107
|
+
"required": false,
|
|
108
|
+
"type": "boolean"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"defaultText": "false",
|
|
112
|
+
"description": "是否显示输入框,prompt 默认开启",
|
|
113
|
+
"name": "showInput",
|
|
114
|
+
"required": false,
|
|
115
|
+
"type": "boolean"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"defaultText": "''",
|
|
119
|
+
"description": "输入框占位文本",
|
|
120
|
+
"name": "inputPlaceholder",
|
|
121
|
+
"required": false,
|
|
122
|
+
"type": "string"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"defaultText": "true",
|
|
126
|
+
"description": "点击遮罩是否关闭",
|
|
127
|
+
"name": "closeOnClickModal",
|
|
128
|
+
"required": false,
|
|
129
|
+
"type": "boolean"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"defaultText": "true",
|
|
133
|
+
"description": "按 Esc 是否关闭",
|
|
134
|
+
"name": "closeOnPressEscape",
|
|
135
|
+
"required": false,
|
|
136
|
+
"type": "boolean"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"defaultText": "false",
|
|
140
|
+
"description": "内容是否居中",
|
|
141
|
+
"name": "center",
|
|
142
|
+
"required": false,
|
|
143
|
+
"type": "boolean"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"defaultText": "false",
|
|
147
|
+
"description": "是否允许拖拽消息框",
|
|
148
|
+
"name": "draggable",
|
|
149
|
+
"required": false,
|
|
150
|
+
"type": "boolean"
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
"slug": "message-box",
|
|
154
|
+
"summary": "模态消息框,用于确认、警告与输入"
|
|
155
|
+
},
|
|
156
|
+
"generatedAt": "2026-11-03T03:09:12.050Z",
|
|
157
|
+
"libraryVersion": "0.2.0",
|
|
158
|
+
"schemaVersion": 1
|
|
159
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# EpMessageBox
|
|
2
|
+
|
|
3
|
+
`EpMessageBox.confirm(message, title, options) → Promise` · feedback(反馈) · `service:message-box`
|
|
4
|
+
|
|
5
|
+
## 摘要
|
|
6
|
+
|
|
7
|
+
模态消息框,用于确认、警告与输入
|
|
8
|
+
|
|
9
|
+
## 关键词
|
|
10
|
+
|
|
11
|
+
- 中文:消息框、确认框、警告、输入框、弹窗
|
|
12
|
+
- English: message-box, confirm, alert, prompt, modal
|
|
13
|
+
|
|
14
|
+
## 调用方式
|
|
15
|
+
|
|
16
|
+
- 调用形式:EpMessageBox.confirm(message, title, options) → Promise
|
|
17
|
+
- 选项 title(string,默认 ''):消息框标题
|
|
18
|
+
- 选项 message(string | VNode | ((params) => VNode),必填,默认 ''):消息框正文
|
|
19
|
+
- 选项 type('success' | 'info' | 'warning' | 'error',默认 ''):标题前的状态图标类型
|
|
20
|
+
- 选项 confirmButtonText(string,默认 '确定'):确认按钮文案
|
|
21
|
+
- 选项 cancelButtonText(string,默认 '取消'):取消按钮文案
|
|
22
|
+
- 选项 showCancelButton(boolean,默认 false):是否显示取消按钮
|
|
23
|
+
- 选项 showInput(boolean,默认 false):是否显示输入框,prompt 默认开启
|
|
24
|
+
- 选项 inputPlaceholder(string,默认 ''):输入框占位文本
|
|
25
|
+
- 选项 closeOnClickModal(boolean,默认 true):点击遮罩是否关闭
|
|
26
|
+
- 选项 closeOnPressEscape(boolean,默认 true):按 Esc 是否关闭
|
|
27
|
+
- 选项 center(boolean,默认 false):内容是否居中
|
|
28
|
+
- 选项 draggable(boolean,默认 false):是否允许拖拽消息框
|
|
29
|
+
- 方法 alert(message: string | VNode, title?: string, options?: MessageBoxOptions) => Promise<MessageBoxData>:只有确认按钮的警告框
|
|
30
|
+
- 方法 confirm(message: string | VNode, title?: string, options?: MessageBoxOptions) => Promise<MessageBoxData>:带确认与取消按钮的确认框;取消时 Promise reject
|
|
31
|
+
- 方法 prompt(message: string | VNode, title?: string, options?: MessageBoxOptions) => Promise<MessageBoxData>:带输入框的提示框
|
|
32
|
+
- 方法 close() => void:关闭当前全部消息框实例
|
|
33
|
+
- 约束:confirm 与 prompt 在用户取消时 Promise 会 reject,调用方必须捕获或处理取消分支
|
|
34
|
+
- 约束:消息框是模态交互,不应在循环或高频事件中重复弹出
|
|
35
|
+
- 约束:需要自定义复杂表单时使用 EpDialog 组件而不是 prompt
|
|
36
|
+
|
|
37
|
+
## 示例
|
|
38
|
+
|
|
39
|
+
### 确认操作
|
|
40
|
+
|
|
41
|
+
```vue
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
import { EpButton, EpMessageBox } from 'ep-craft'
|
|
44
|
+
|
|
45
|
+
const remove = async () => {
|
|
46
|
+
try {
|
|
47
|
+
await EpMessageBox.confirm('删除后无法恢复,是否继续?', '删除确认', {
|
|
48
|
+
type: 'warning',
|
|
49
|
+
confirmButtonText: '删除',
|
|
50
|
+
cancelButtonText: '取消',
|
|
51
|
+
})
|
|
52
|
+
EpMessageBox.close()
|
|
53
|
+
} catch {
|
|
54
|
+
// 用户取消
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<ep-button type="danger" @click="remove">删除</ep-button>
|
|
61
|
+
</template>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 输入提示
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { EpMessageBox } from 'ep-craft'
|
|
68
|
+
|
|
69
|
+
const { value } = await EpMessageBox.prompt('请输入项目名称', '新建项目', {
|
|
70
|
+
inputPlaceholder: '例如:营销活动页',
|
|
71
|
+
confirmButtonText: '创建',
|
|
72
|
+
})
|
|
73
|
+
console.log(value)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
ep-craft 0.2.0
|