pit-docs-mcp 1.0.2
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 +180 -0
- package/dist/codegen.d.ts +5 -0
- package/dist/codegen.d.ts.map +1 -0
- package/dist/codegen.js +112 -0
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +10 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +115 -0
- package/dist/resources.d.ts +3 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +80 -0
- package/dist/tools.d.ts +3 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +258 -0
- package/dist/utils.d.ts +26 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +198 -0
- package/docs/codegen/pit-simplify-web.md +686 -0
- package/docs/pitBusinessUi/README.md +102 -0
- package/docs/pitBusinessUi/add-date-picker.md +57 -0
- package/docs/pitBusinessUi/add-operation.md +64 -0
- package/docs/pitBusinessUi/batch-download.md +44 -0
- package/docs/pitBusinessUi/bill-tree-dialog.md +82 -0
- package/docs/pitBusinessUi/collapse.md +88 -0
- package/docs/pitBusinessUi/date-time-picker.md +74 -0
- package/docs/pitBusinessUi/design-report-explain.md +47 -0
- package/docs/pitBusinessUi/dialog.md +89 -0
- package/docs/pitBusinessUi/dic-radio.md +67 -0
- package/docs/pitBusinessUi/dic.md +78 -0
- package/docs/pitBusinessUi/document-preview.md +54 -0
- package/docs/pitBusinessUi/drawer.md +67 -0
- package/docs/pitBusinessUi/editor.md +63 -0
- package/docs/pitBusinessUi/expand-search-form.md +65 -0
- package/docs/pitBusinessUi/file-preview.md +56 -0
- package/docs/pitBusinessUi/flow-table-status.md +47 -0
- package/docs/pitBusinessUi/icon-box.md +74 -0
- package/docs/pitBusinessUi/image-preview.md +55 -0
- package/docs/pitBusinessUi/image.md +53 -0
- package/docs/pitBusinessUi/input-formatter.md +100 -0
- package/docs/pitBusinessUi/input-number.md +47 -0
- package/docs/pitBusinessUi/input-select.md +68 -0
- package/docs/pitBusinessUi/input.md +56 -0
- package/docs/pitBusinessUi/jm-preview.md +47 -0
- package/docs/pitBusinessUi/json-editor.md +71 -0
- package/docs/pitBusinessUi/loading-btn.md +64 -0
- package/docs/pitBusinessUi/monaco.md +82 -0
- package/docs/pitBusinessUi/money-input.md +59 -0
- package/docs/pitBusinessUi/pagination.md +70 -0
- package/docs/pitBusinessUi/password-strength.md +59 -0
- package/docs/pitBusinessUi/positive-number.md +63 -0
- package/docs/pitBusinessUi/preview-image.md +62 -0
- package/docs/pitBusinessUi/preview-office.md +50 -0
- package/docs/pitBusinessUi/preview.md +57 -0
- package/docs/pitBusinessUi/quill.md +52 -0
- package/docs/pitBusinessUi/runflow-btn.md +52 -0
- package/docs/pitBusinessUi/search-date-picker.md +60 -0
- package/docs/pitBusinessUi/select-bid-list.md +66 -0
- package/docs/pitBusinessUi/select-color.md +38 -0
- package/docs/pitBusinessUi/select-contract-tree.md +41 -0
- package/docs/pitBusinessUi/select-dept.md +38 -0
- package/docs/pitBusinessUi/select-project-unit.md +48 -0
- package/docs/pitBusinessUi/select-section-tree.md +45 -0
- package/docs/pitBusinessUi/select-section.md +66 -0
- package/docs/pitBusinessUi/select-string.md +60 -0
- package/docs/pitBusinessUi/select-system-unit.md +41 -0
- package/docs/pitBusinessUi/select-user-by-role.md +51 -0
- package/docs/pitBusinessUi/switch.md +43 -0
- package/docs/pitBusinessUi/table-contract.md +66 -0
- package/docs/pitBusinessUi/table-operation.md +81 -0
- package/docs/pitBusinessUi/table.md +75 -0
- package/docs/pitBusinessUi/tag.md +86 -0
- package/docs/pitBusinessUi/textarea.md +65 -0
- package/docs/pitBusinessUi/transfer-direct.md +57 -0
- package/docs/pitBusinessUi/transfer-user-project.md +78 -0
- package/docs/pitBusinessUi/transfer.md +68 -0
- package/docs/pitBusinessUi/tree-lazy.md +72 -0
- package/docs/pitBusinessUi/tree-select-name.md +59 -0
- package/docs/pitBusinessUi/tree-select-plus.md +106 -0
- package/docs/pitBusinessUi/tree-select.md +86 -0
- package/docs/pitBusinessUi/upload-avatar.md +60 -0
- package/docs/pitBusinessUi/upload-file-dialog.md +86 -0
- package/docs/pitBusinessUi/upload-file.md +77 -0
- package/docs/pitBusinessUi/upload-list-card.md +62 -0
- package/docs/pitBusinessUi/upload-table.md +77 -0
- package/docs/pitBusinessUi/user-transform.md +72 -0
- package/docs/pitBusinessUi/utils.md +272 -0
- package/docs/pitBusinessUtils/README.md +144 -0
- package/docs/pitBusinessUtils/auth.md +170 -0
- package/docs/pitBusinessUtils/clipboard.md +72 -0
- package/docs/pitBusinessUtils/filePreview.md +60 -0
- package/docs/pitBusinessUtils/formValidate.md +75 -0
- package/docs/pitBusinessUtils/generateTitle.md +49 -0
- package/docs/pitBusinessUtils/get-page-title.md +65 -0
- package/docs/pitBusinessUtils/i18n.md +130 -0
- package/docs/pitBusinessUtils/jwks.md +82 -0
- package/docs/pitBusinessUtils/oss.md +391 -0
- package/docs/pitBusinessUtils/passwordValidate.md +120 -0
- package/docs/pitBusinessUtils/pit.md +496 -0
- package/docs/pitBusinessUtils/print.md +126 -0
- package/docs/pitBusinessUtils/request.md +137 -0
- package/docs/pitBusinessUtils/scroll-to.md +68 -0
- package/docs/pitBusinessUtils/utils.md +762 -0
- package/docs/pitBusinessUtils/validate.md +224 -0
- package/docs/pitElementUi/alert.md +238 -0
- package/docs/pitElementUi/avatar.md +147 -0
- package/docs/pitElementUi/backtop.md +60 -0
- package/docs/pitElementUi/badge.md +120 -0
- package/docs/pitElementUi/base-tabs.md +73 -0
- package/docs/pitElementUi/border.md +135 -0
- package/docs/pitElementUi/breadcrumb.md +44 -0
- package/docs/pitElementUi/button.md +301 -0
- package/docs/pitElementUi/calendar.md +66 -0
- package/docs/pitElementUi/card.md +170 -0
- package/docs/pitElementUi/carousel.md +212 -0
- package/docs/pitElementUi/cascader.md +1966 -0
- package/docs/pitElementUi/checkbox.md +283 -0
- package/docs/pitElementUi/collapse.md +131 -0
- package/docs/pitElementUi/color-picker.md +123 -0
- package/docs/pitElementUi/color.md +244 -0
- package/docs/pitElementUi/container.md +240 -0
- package/docs/pitElementUi/custom-theme.md +131 -0
- package/docs/pitElementUi/date-picker.md +448 -0
- package/docs/pitElementUi/datetime-picker.md +254 -0
- package/docs/pitElementUi/descriptions.md +191 -0
- package/docs/pitElementUi/dialog-header.md +53 -0
- package/docs/pitElementUi/dialog.md +239 -0
- package/docs/pitElementUi/divider.md +61 -0
- package/docs/pitElementUi/drawer.md +307 -0
- package/docs/pitElementUi/dropdown.md +308 -0
- package/docs/pitElementUi/empty.md +61 -0
- package/docs/pitElementUi/font-family.md +90 -0
- package/docs/pitElementUi/form-base.md +1239 -0
- package/docs/pitElementUi/form-item-checkbox-group.md +48 -0
- package/docs/pitElementUi/form-item-date.md +60 -0
- package/docs/pitElementUi/form-item-dic.md +18 -0
- package/docs/pitElementUi/form-item-editor.md +16 -0
- package/docs/pitElementUi/form-item-input-money.md +19 -0
- package/docs/pitElementUi/form-item-input-number.md +20 -0
- package/docs/pitElementUi/form-item-input.md +18 -0
- package/docs/pitElementUi/form-item-radio-group.md +21 -0
- package/docs/pitElementUi/form-item-select.md +21 -0
- package/docs/pitElementUi/form-item-switch.md +15 -0
- package/docs/pitElementUi/form-item-textarea.md +20 -0
- package/docs/pitElementUi/form-item-tree-select.md +27 -0
- package/docs/pitElementUi/form-item-upload-card.md +18 -0
- package/docs/pitElementUi/form-item-upload.md +1 -0
- package/docs/pitElementUi/form-two.md +102 -0
- package/docs/pitElementUi/form.md +952 -0
- package/docs/pitElementUi/i18n.md +228 -0
- package/docs/pitElementUi/icon-custom.md +99 -0
- package/docs/pitElementUi/icon-line-custom.md +12 -0
- package/docs/pitElementUi/icon.md +28 -0
- package/docs/pitElementUi/image.md +178 -0
- package/docs/pitElementUi/infiniteScroll.md +87 -0
- package/docs/pitElementUi/input-number.md +197 -0
- package/docs/pitElementUi/input-select.md +1 -0
- package/docs/pitElementUi/input.md +800 -0
- package/docs/pitElementUi/installation.md +9 -0
- package/docs/pitElementUi/layout-column.md +376 -0
- package/docs/pitElementUi/layout-tree.md +715 -0
- package/docs/pitElementUi/layout.md +354 -0
- package/docs/pitElementUi/link.md +66 -0
- package/docs/pitElementUi/loading.md +208 -0
- package/docs/pitElementUi/menu.md +403 -0
- package/docs/pitElementUi/message-box.md +326 -0
- package/docs/pitElementUi/message.md +219 -0
- package/docs/pitElementUi/notification.md +311 -0
- package/docs/pitElementUi/page-header.md +40 -0
- package/docs/pitElementUi/pagination.md +200 -0
- package/docs/pitElementUi/popconfirm.md +60 -0
- package/docs/pitElementUi/popover.md +167 -0
- package/docs/pitElementUi/progress.md +178 -0
- package/docs/pitElementUi/quickstart.md +290 -0
- package/docs/pitElementUi/radio.md +211 -0
- package/docs/pitElementUi/rate.md +135 -0
- package/docs/pitElementUi/result.md +76 -0
- package/docs/pitElementUi/select-tree.md +661 -0
- package/docs/pitElementUi/select.md +586 -0
- package/docs/pitElementUi/skeleton.md +316 -0
- package/docs/pitElementUi/slider.md +237 -0
- package/docs/pitElementUi/steps.md +154 -0
- package/docs/pitElementUi/switch.md +142 -0
- package/docs/pitElementUi/table.md +4023 -0
- package/docs/pitElementUi/tabs.md +303 -0
- package/docs/pitElementUi/tag.md +203 -0
- package/docs/pitElementUi/time-picker.md +199 -0
- package/docs/pitElementUi/timeline.md +154 -0
- package/docs/pitElementUi/tooltip.md +177 -0
- package/docs/pitElementUi/transfer.md +249 -0
- package/docs/pitElementUi/transition.md +155 -0
- package/docs/pitElementUi/tree.md +1157 -0
- package/docs/pitElementUi/typography.md +151 -0
- package/docs/pitElementUi/upload-table.md +39 -0
- package/docs/pitElementUi/upload.md +392 -0
- package/docs/pitElementUi/virtual-list.md +154 -0
- package/docs/pitElementUi/virtual-select-tree.md +243 -0
- package/docs/pitElementUi/virtual-select.md +451 -0
- package/docs/pitElementUi/virtual-table-column.md +1 -0
- package/docs/pitElementUi/virtual-table.md +490 -0
- package/docs/pitElementUi/virtual-tree.md +119 -0
- package/package.json +33 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
## Notification 通知
|
|
2
|
+
|
|
3
|
+
悬浮出现在页面角落,显示全局的通知提醒消息。
|
|
4
|
+
|
|
5
|
+
### 基本用法
|
|
6
|
+
|
|
7
|
+
适用性广泛的通知栏
|
|
8
|
+
|
|
9
|
+
:::demo Notification 组件提供通知功能,Element 注册了`$notify`方法,接收一个`options`字面量参数,在最简单的情况下,你可以设置`title`字段和`message`字段,用于设置通知的标题和正文。默认情况下,经过一段时间后 Notification 组件会自动关闭,但是通过设置`duration`,可以控制关闭的时间间隔,特别的是,如果设置为`0`,则不会自动关闭。注意:`duration`接收一个`Number`,单位为毫秒,默认为`4500`。
|
|
10
|
+
```html
|
|
11
|
+
<template>
|
|
12
|
+
<el-button
|
|
13
|
+
plain
|
|
14
|
+
@click="open1">
|
|
15
|
+
可自动关闭
|
|
16
|
+
</el-button>
|
|
17
|
+
<el-button
|
|
18
|
+
plain
|
|
19
|
+
@click="open2">
|
|
20
|
+
不会自动关闭
|
|
21
|
+
</el-button>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
export default {
|
|
26
|
+
methods: {
|
|
27
|
+
open1() {
|
|
28
|
+
const h = this.$createElement;
|
|
29
|
+
|
|
30
|
+
this.$notify({
|
|
31
|
+
title: '标题名称',
|
|
32
|
+
message: h('i', { style: 'color: teal'}, '这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案这是提示文案')
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
open2() {
|
|
37
|
+
this.$notify({
|
|
38
|
+
title: '提示',
|
|
39
|
+
message: '这是一条不会自动关闭的消息',
|
|
40
|
+
duration: 0
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</script>
|
|
46
|
+
```
|
|
47
|
+
:::
|
|
48
|
+
|
|
49
|
+
### 带有倾向性
|
|
50
|
+
|
|
51
|
+
带有 icon,常用来显示「成功、警告、消息、错误」类的系统消息
|
|
52
|
+
|
|
53
|
+
:::demo Element 为 Notification 组件准备了四种通知类型:`success`, `warning`, `info`, `error`。通过`type`字段来设置,除此以外的值将被忽略。同时,我们也为 Notification 的各种 type 注册了方法,可以在不传入`type`字段的情况下像`open3`和`open4`那样直接调用。
|
|
54
|
+
```html
|
|
55
|
+
<template>
|
|
56
|
+
<el-button
|
|
57
|
+
plain
|
|
58
|
+
@click="open1">
|
|
59
|
+
成功
|
|
60
|
+
</el-button>
|
|
61
|
+
<el-button
|
|
62
|
+
plain
|
|
63
|
+
@click="open2">
|
|
64
|
+
警告
|
|
65
|
+
</el-button>
|
|
66
|
+
<el-button
|
|
67
|
+
plain
|
|
68
|
+
@click="open3">
|
|
69
|
+
消息
|
|
70
|
+
</el-button>
|
|
71
|
+
<el-button
|
|
72
|
+
plain
|
|
73
|
+
@click="open4">
|
|
74
|
+
错误
|
|
75
|
+
</el-button>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<script>
|
|
79
|
+
export default {
|
|
80
|
+
methods: {
|
|
81
|
+
open1() {
|
|
82
|
+
this.$notify({
|
|
83
|
+
title: '成功',
|
|
84
|
+
message: '这是一条成功的提示消息',
|
|
85
|
+
type: 'success'
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
open2() {
|
|
90
|
+
this.$notify({
|
|
91
|
+
title: '警告',
|
|
92
|
+
message: '这是一条警告的提示消息',
|
|
93
|
+
type: 'warning'
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
open3() {
|
|
98
|
+
this.$notify.info({
|
|
99
|
+
title: '消息',
|
|
100
|
+
message: '这是一条消息的提示消息'
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
open4() {
|
|
105
|
+
this.$notify.error({
|
|
106
|
+
title: '错误',
|
|
107
|
+
message: '这是一条错误的提示消息'
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
</script>
|
|
113
|
+
```
|
|
114
|
+
:::
|
|
115
|
+
|
|
116
|
+
### 自定义弹出位置
|
|
117
|
+
|
|
118
|
+
可以让 Notification 从屏幕四角中的任意一角弹出
|
|
119
|
+
|
|
120
|
+
:::demo 使用`position`属性定义 Notification 的弹出位置,支持四个选项:`top-right`、`top-left`、`bottom-right`、`bottom-left`,默认为`top-right`。
|
|
121
|
+
```html
|
|
122
|
+
<template>
|
|
123
|
+
<el-button
|
|
124
|
+
plain
|
|
125
|
+
@click="open1">
|
|
126
|
+
右上角
|
|
127
|
+
</el-button>
|
|
128
|
+
<el-button
|
|
129
|
+
plain
|
|
130
|
+
@click="open2">
|
|
131
|
+
右下角
|
|
132
|
+
</el-button>
|
|
133
|
+
<el-button
|
|
134
|
+
plain
|
|
135
|
+
@click="open3">
|
|
136
|
+
左下角
|
|
137
|
+
</el-button>
|
|
138
|
+
<el-button
|
|
139
|
+
plain
|
|
140
|
+
@click="open4">
|
|
141
|
+
左上角
|
|
142
|
+
</el-button>
|
|
143
|
+
</template>
|
|
144
|
+
|
|
145
|
+
<script>
|
|
146
|
+
export default {
|
|
147
|
+
methods: {
|
|
148
|
+
open1() {
|
|
149
|
+
this.$notify({
|
|
150
|
+
title: '自定义位置',
|
|
151
|
+
message: '右上角弹出的消息'
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
open2() {
|
|
156
|
+
this.$notify({
|
|
157
|
+
title: '自定义位置',
|
|
158
|
+
message: '右下角弹出的消息',
|
|
159
|
+
position: 'bottom-right'
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
open3() {
|
|
164
|
+
this.$notify({
|
|
165
|
+
title: '自定义位置',
|
|
166
|
+
message: '左下角弹出的消息',
|
|
167
|
+
position: 'bottom-left'
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
|
|
171
|
+
open4() {
|
|
172
|
+
this.$notify({
|
|
173
|
+
title: '自定义位置',
|
|
174
|
+
message: '左上角弹出的消息',
|
|
175
|
+
position: 'top-left'
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
</script>
|
|
181
|
+
```
|
|
182
|
+
:::
|
|
183
|
+
|
|
184
|
+
### 带有偏移
|
|
185
|
+
|
|
186
|
+
让 Notification 偏移一些位置
|
|
187
|
+
|
|
188
|
+
:::demo Notification 提供设置偏移量的功能,通过设置 `offset` 字段,可以使弹出的消息距屏幕边缘偏移一段距离。注意在同一时刻,所有的 Notification 实例应当具有一个相同的偏移量。
|
|
189
|
+
```html
|
|
190
|
+
<template>
|
|
191
|
+
<el-button
|
|
192
|
+
plain
|
|
193
|
+
@click="open">
|
|
194
|
+
偏移的消息
|
|
195
|
+
</el-button>
|
|
196
|
+
</template>
|
|
197
|
+
|
|
198
|
+
<script>
|
|
199
|
+
export default {
|
|
200
|
+
methods: {
|
|
201
|
+
open() {
|
|
202
|
+
this.$notify({
|
|
203
|
+
title: '偏移',
|
|
204
|
+
message: '这是一条带有偏移的提示消息',
|
|
205
|
+
offset: 100
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
</script>
|
|
211
|
+
```
|
|
212
|
+
:::
|
|
213
|
+
|
|
214
|
+
### 使用 HTML 片段
|
|
215
|
+
`message` 属性支持传入 HTML 片段
|
|
216
|
+
|
|
217
|
+
:::demo 将`dangerouslyUseHTMLString`属性设置为 true,`message` 就会被当作 HTML 片段处理。
|
|
218
|
+
```html
|
|
219
|
+
<template>
|
|
220
|
+
<el-button
|
|
221
|
+
plain
|
|
222
|
+
@click="open">
|
|
223
|
+
使用 HTML 片段
|
|
224
|
+
</el-button>
|
|
225
|
+
</template>
|
|
226
|
+
|
|
227
|
+
<script>
|
|
228
|
+
export default {
|
|
229
|
+
methods: {
|
|
230
|
+
open() {
|
|
231
|
+
this.$notify({
|
|
232
|
+
title: 'HTML 片段',
|
|
233
|
+
dangerouslyUseHTMLString: true,
|
|
234
|
+
message: '<strong>这是 <i>HTML</i> 片段</strong>'
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
</script>
|
|
240
|
+
```
|
|
241
|
+
:::
|
|
242
|
+
|
|
243
|
+
:::warning
|
|
244
|
+
`message` 属性虽然支持传入 HTML 片段,但是在网站上动态渲染任意 HTML 是非常危险的,因为容易导致 [XSS 攻击](https://en.wikipedia.org/wiki/Cross-site_scripting)。因此在 `dangerouslyUseHTMLString` 打开的情况下,请确保 `message` 的内容是可信的,**永远不要**将用户提交的内容赋值给 `message` 属性。
|
|
245
|
+
:::
|
|
246
|
+
|
|
247
|
+
### 隐藏关闭按钮
|
|
248
|
+
|
|
249
|
+
可以不显示关闭按钮
|
|
250
|
+
|
|
251
|
+
:::demo 将`showClose`属性设置为`false`即可隐藏关闭按钮。
|
|
252
|
+
```html
|
|
253
|
+
<template>
|
|
254
|
+
<el-button
|
|
255
|
+
plain
|
|
256
|
+
@click="open">
|
|
257
|
+
隐藏关闭按钮
|
|
258
|
+
</el-button>
|
|
259
|
+
</template>
|
|
260
|
+
|
|
261
|
+
<script>
|
|
262
|
+
export default {
|
|
263
|
+
methods: {
|
|
264
|
+
open() {
|
|
265
|
+
this.$notify.success({
|
|
266
|
+
title: 'Info',
|
|
267
|
+
message: '这是一条没有关闭按钮的消息',
|
|
268
|
+
showClose: false
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
</script>
|
|
274
|
+
```
|
|
275
|
+
:::
|
|
276
|
+
|
|
277
|
+
### 全局方法
|
|
278
|
+
|
|
279
|
+
Element 为 `Vue.prototype` 添加了全局方法 `$notify`。因此在 vue instance 中可以采用本页面中的方式调用 Notification。
|
|
280
|
+
|
|
281
|
+
### 单独引用
|
|
282
|
+
|
|
283
|
+
单独引入 Notification:
|
|
284
|
+
|
|
285
|
+
```javascript
|
|
286
|
+
import { Notification } from 'element-ui';
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
此时调用方法为 `Notification(options)`。我们也为每个 type 定义了各自的方法,如 `Notification.success(options)`。并且可以调用 `Notification.closeAll()` 手动关闭所有实例。
|
|
290
|
+
|
|
291
|
+
### Options
|
|
292
|
+
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
293
|
+
|---------- |-------------- |---------- |-------------------------------- |-------- |
|
|
294
|
+
| title | 标题 | string | — | — |
|
|
295
|
+
| message | 说明文字 | string/Vue.VNode | — | — |
|
|
296
|
+
| dangerouslyUseHTMLString | 是否将 message 属性作为 HTML 片段处理 | boolean | — | false |
|
|
297
|
+
| type | 主题样式,如果不在可选值内将被忽略 | string | success/warning/info/error | — |
|
|
298
|
+
| iconClass | 自定义图标的类名。若设置了 `type`,则 `iconClass` 会被覆盖 | string | — | — |
|
|
299
|
+
| customClass | 自定义类名 | string | — | — |
|
|
300
|
+
| duration | 显示时间, 毫秒。设为 0 则不会自动关闭 | number | — | 4500 |
|
|
301
|
+
| position | 自定义弹出位置 | string | top-right/top-left/bottom-right/bottom-left | top-right |
|
|
302
|
+
| showClose | 是否显示关闭按钮 | boolean | — | true |
|
|
303
|
+
| onClose | 关闭时的回调函数 | function | — | — |
|
|
304
|
+
| onClick | 点击 Notification 时的回调函数 | function | — | — |
|
|
305
|
+
| offset | 偏移的距离,在同一时刻,所有的 Notification 实例应当具有一个相同的偏移量 | number | — | 0 |
|
|
306
|
+
|
|
307
|
+
### 方法
|
|
308
|
+
调用 `Notification` 或 `this.$notify` 会返回当前 Notification 的实例。如果需要手动关闭实例,可以调用它的 `close` 方法。
|
|
309
|
+
| 方法名 | 说明 |
|
|
310
|
+
| ---- | ---- |
|
|
311
|
+
| close | 关闭当前的 Notification |
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
## PageHeader 页头
|
|
2
|
+
|
|
3
|
+
如果页面的路径比较简单,推荐使用页头组件而非面包屑组件。
|
|
4
|
+
|
|
5
|
+
### 基础
|
|
6
|
+
|
|
7
|
+
:::demo
|
|
8
|
+
```html
|
|
9
|
+
<el-page-header @back="goBack" content="详情页面">
|
|
10
|
+
</el-page-header>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
methods: {
|
|
15
|
+
goBack() {
|
|
16
|
+
console.log('go back');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
```
|
|
22
|
+
:::
|
|
23
|
+
|
|
24
|
+
### Attributes
|
|
25
|
+
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
26
|
+
|---------- |-------------- |---------- |------------------------------ | ------ |
|
|
27
|
+
| title | 标题 | string | — | 返回 |
|
|
28
|
+
| content | 内容 | string | — | — |
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Events
|
|
32
|
+
| 事件名称 | 说明 | 回调参数 |
|
|
33
|
+
|---------- |-------------- |---------- |
|
|
34
|
+
| back | 点击左侧区域触发 | — |
|
|
35
|
+
|
|
36
|
+
### Slots
|
|
37
|
+
| 事件名称 | 说明 |
|
|
38
|
+
|---------- |------------- |
|
|
39
|
+
| title | 标题内容 |
|
|
40
|
+
| content | 内容 |
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
## Pagination 分页
|
|
2
|
+
|
|
3
|
+
当数据量过多时,使用分页分解数据。
|
|
4
|
+
|
|
5
|
+
### 基础用法
|
|
6
|
+
|
|
7
|
+
:::demo 设置`layout`,表示需要显示的内容,用逗号分隔,布局元素会依次显示。`prev`表示上一页,`next`为下一页,`pager`表示页码列表,除此以外还提供了`jumper`和`total`,`size`和特殊的布局符号`->`,`->`后的元素会靠右显示,`jumper`表示跳页元素,`total`表示总条目数,`size`用于设置每页显示的页码数量。
|
|
8
|
+
```html
|
|
9
|
+
<div class="block">
|
|
10
|
+
<span class="demonstration">页数较少时的效果</span>
|
|
11
|
+
<el-pagination
|
|
12
|
+
layout="prev, pager, next"
|
|
13
|
+
:total="50">
|
|
14
|
+
</el-pagination>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="block">
|
|
17
|
+
<span class="demonstration">大于 7 页时的效果</span>
|
|
18
|
+
<el-pagination
|
|
19
|
+
layout="prev, pager, next"
|
|
20
|
+
:total="1000">
|
|
21
|
+
</el-pagination>
|
|
22
|
+
</div>
|
|
23
|
+
```
|
|
24
|
+
:::
|
|
25
|
+
|
|
26
|
+
### 设置最大页码按钮数
|
|
27
|
+
|
|
28
|
+
:::demo 默认情况下,当总页数超过 7 页时,Pagination 会折叠多余的页码按钮。通过`pager-count`属性可以设置最大页码按钮数。
|
|
29
|
+
```html
|
|
30
|
+
<el-pagination
|
|
31
|
+
:page-size="20"
|
|
32
|
+
:pager-count="11"
|
|
33
|
+
layout="prev, pager, next"
|
|
34
|
+
:total="1000">
|
|
35
|
+
</el-pagination>
|
|
36
|
+
```
|
|
37
|
+
:::
|
|
38
|
+
|
|
39
|
+
### 带有背景色的分页
|
|
40
|
+
|
|
41
|
+
:::demo 设置`background`属性可以为分页按钮添加背景色。
|
|
42
|
+
```html
|
|
43
|
+
<el-pagination
|
|
44
|
+
background
|
|
45
|
+
layout="prev, pager, next"
|
|
46
|
+
:total="1000">
|
|
47
|
+
</el-pagination>
|
|
48
|
+
```
|
|
49
|
+
:::
|
|
50
|
+
|
|
51
|
+
### 小型分页
|
|
52
|
+
|
|
53
|
+
在空间有限的情况下,可以使用简单的小型分页。
|
|
54
|
+
|
|
55
|
+
:::demo 只需要一个`small`属性,它接受一个`Boolean`,默认为`false`,设为`true`即可启用。
|
|
56
|
+
```html
|
|
57
|
+
<el-pagination
|
|
58
|
+
small
|
|
59
|
+
layout="prev, pager, next"
|
|
60
|
+
:total="50">
|
|
61
|
+
</el-pagination>
|
|
62
|
+
```
|
|
63
|
+
:::
|
|
64
|
+
|
|
65
|
+
### 附加功能
|
|
66
|
+
|
|
67
|
+
根据场景需要,可以添加其他功能模块。
|
|
68
|
+
|
|
69
|
+
:::demo 此例是一个完整的用例,使用了`size-change`和`current-change`事件来处理页码大小和当前页变动时候触发的事件。`page-sizes`接受一个整型数组,数组元素为展示的选择每页显示个数的选项,`[100, 200, 300, 400]`表示四个选项,每页显示 100 个,200 个,300 个或者 400 个。
|
|
70
|
+
|
|
71
|
+
```html
|
|
72
|
+
<template>
|
|
73
|
+
<div class="block">
|
|
74
|
+
<span class="demonstration">显示总数</span>
|
|
75
|
+
<el-pagination
|
|
76
|
+
@size-change="handleSizeChange"
|
|
77
|
+
@current-change="handleCurrentChange"
|
|
78
|
+
:current-page.sync="currentPage1"
|
|
79
|
+
:page-size="100"
|
|
80
|
+
layout="total, prev, pager, next"
|
|
81
|
+
:total="1000">
|
|
82
|
+
</el-pagination>
|
|
83
|
+
</div>
|
|
84
|
+
<div class="block">
|
|
85
|
+
<span class="demonstration">调整每页显示条数</span>
|
|
86
|
+
<el-pagination
|
|
87
|
+
@size-change="handleSizeChange"
|
|
88
|
+
@current-change="handleCurrentChange"
|
|
89
|
+
:current-page.sync="currentPage2"
|
|
90
|
+
:page-sizes="[100, 200, 300, 400]"
|
|
91
|
+
:page-size="100"
|
|
92
|
+
layout="sizes, prev, pager, next"
|
|
93
|
+
:total="1000">
|
|
94
|
+
</el-pagination>
|
|
95
|
+
</div>
|
|
96
|
+
<div class="block">
|
|
97
|
+
<span class="demonstration">直接前往</span>
|
|
98
|
+
<el-pagination
|
|
99
|
+
@size-change="handleSizeChange"
|
|
100
|
+
@current-change="handleCurrentChange"
|
|
101
|
+
:current-page.sync="currentPage3"
|
|
102
|
+
:page-size="100"
|
|
103
|
+
layout="prev, pager, next, jumper"
|
|
104
|
+
:total="1000">
|
|
105
|
+
</el-pagination>
|
|
106
|
+
</div>
|
|
107
|
+
<div class="block">
|
|
108
|
+
<span class="demonstration">完整功能</span>
|
|
109
|
+
<el-pagination
|
|
110
|
+
@size-change="handleSizeChange"
|
|
111
|
+
@current-change="handleCurrentChange"
|
|
112
|
+
:current-page="currentPage4"
|
|
113
|
+
:page-sizes="[100, 200, 300, 400]"
|
|
114
|
+
:page-size="100"
|
|
115
|
+
layout="total, sizes, prev, pager, next, jumper"
|
|
116
|
+
:total="400">
|
|
117
|
+
</el-pagination>
|
|
118
|
+
</div>
|
|
119
|
+
</template>
|
|
120
|
+
<script>
|
|
121
|
+
export default {
|
|
122
|
+
methods: {
|
|
123
|
+
handleSizeChange(val) {
|
|
124
|
+
console.log(`每页 ${val} 条`);
|
|
125
|
+
},
|
|
126
|
+
handleCurrentChange(val) {
|
|
127
|
+
console.log(`当前页: ${val}`);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
data() {
|
|
131
|
+
return {
|
|
132
|
+
currentPage1: 5,
|
|
133
|
+
currentPage2: 5,
|
|
134
|
+
currentPage3: 5,
|
|
135
|
+
currentPage4: 4
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
</script>
|
|
140
|
+
```
|
|
141
|
+
:::
|
|
142
|
+
|
|
143
|
+
### 当只有一页时隐藏分页
|
|
144
|
+
|
|
145
|
+
当只有一页时,通过设置 `hide-on-single-page` 属性来隐藏分页。
|
|
146
|
+
|
|
147
|
+
:::demo
|
|
148
|
+
```html
|
|
149
|
+
<div>
|
|
150
|
+
<el-switch v-model="value">
|
|
151
|
+
</el-switch>
|
|
152
|
+
<el-pagination
|
|
153
|
+
:hide-on-single-page="value"
|
|
154
|
+
:total="5"
|
|
155
|
+
layout="prev, pager, next">
|
|
156
|
+
</el-pagination>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<script>
|
|
160
|
+
export default {
|
|
161
|
+
data() {
|
|
162
|
+
return {
|
|
163
|
+
value: false
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
</script>
|
|
168
|
+
```
|
|
169
|
+
:::
|
|
170
|
+
|
|
171
|
+
### Attributes
|
|
172
|
+
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
173
|
+
|--------------------|----------------------------------------------------------|-------------------|-------------|--------|
|
|
174
|
+
| small | 是否使用小型分页样式 | boolean | — | false |
|
|
175
|
+
| background | 是否为分页按钮添加背景色 | boolean | — | false |
|
|
176
|
+
| page-size | 每页显示条目个数,支持 .sync 修饰符 | number | — | 10 |
|
|
177
|
+
| total | 总条目数 | number | — | — |
|
|
178
|
+
| page-count | 总页数,total 和 page-count 设置任意一个就可以达到显示页码的功能;如果要支持 page-sizes 的更改,则需要使用 total 属性 | Number | — | — |
|
|
179
|
+
| pager-count | 页码按钮的数量,当总页数超过该值时会折叠 | number | 大于等于 5 且小于等于 21 的奇数 | 7 |
|
|
180
|
+
| current-page | 当前页数,支持 .sync 修饰符 | number | — | 1 |
|
|
181
|
+
| layout | 组件布局,子组件名用逗号分隔| String | `sizes`, `prev`, `pager`, `next`, `jumper`, `->`, `total`, `slot` | 'prev, pager, next, jumper, ->, total' |
|
|
182
|
+
| page-sizes | 每页显示个数选择器的选项设置 | number[] | — | [10, 20, 30, 40, 50, 100] |
|
|
183
|
+
| popper-class | 每页显示个数选择器的下拉框类名 | string | — | — |
|
|
184
|
+
| prev-text | 替代图标显示的上一页文字 | string | — | — |
|
|
185
|
+
| next-text | 替代图标显示的下一页文字 | string | — | — |
|
|
186
|
+
| disabled | 是否禁用 | boolean | — | false |
|
|
187
|
+
| hide-on-single-page | 只有一页时是否隐藏 | boolean | — | - |
|
|
188
|
+
|
|
189
|
+
### Events
|
|
190
|
+
| 事件名称 | 说明 | 回调参数 |
|
|
191
|
+
|---------|--------|---------|
|
|
192
|
+
| size-change | pageSize 改变时会触发 | 每页条数 |
|
|
193
|
+
| current-change | currentPage 改变时会触发 | 当前页 |
|
|
194
|
+
| prev-click | 用户点击上一页按钮改变当前页后触发 | 当前页 |
|
|
195
|
+
| next-click | 用户点击下一页按钮改变当前页后触发 | 当前页 |
|
|
196
|
+
|
|
197
|
+
### Slot
|
|
198
|
+
| name | 说明 |
|
|
199
|
+
|------|--------|
|
|
200
|
+
| — | 自定义内容,需要在 `layout` 中列出 `slot` |
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
## Popconfirm 气泡确认框
|
|
2
|
+
|
|
3
|
+
点击元素,弹出气泡确认框。
|
|
4
|
+
|
|
5
|
+
### 基础用法
|
|
6
|
+
|
|
7
|
+
Popconfirm 的属性与 Popover 很类似,因此对于重复属性,请参考 Popover 的文档,在此文档中不做详尽解释。
|
|
8
|
+
:::demo 在 Popconfirm 中,只有 `title` 属性可用,`content` 属性不会被展示。
|
|
9
|
+
```html
|
|
10
|
+
<template>
|
|
11
|
+
<el-popconfirm
|
|
12
|
+
title="这是一段内容确定删除吗?"
|
|
13
|
+
>
|
|
14
|
+
<el-button slot="reference">删除</el-button>
|
|
15
|
+
</el-popconfirm>
|
|
16
|
+
</template>
|
|
17
|
+
````
|
|
18
|
+
:::
|
|
19
|
+
|
|
20
|
+
### 自定义
|
|
21
|
+
|
|
22
|
+
可以在 Popconfirm 中自定义内容。
|
|
23
|
+
:::demo
|
|
24
|
+
```html
|
|
25
|
+
<template>
|
|
26
|
+
<el-popconfirm
|
|
27
|
+
confirm-button-text='好的'
|
|
28
|
+
cancel-button-text='不用了'
|
|
29
|
+
icon="el-icon-info"
|
|
30
|
+
icon-color="red"
|
|
31
|
+
title="这是一段内容确定删除吗?"
|
|
32
|
+
>
|
|
33
|
+
<el-button slot="reference">删除</el-button>
|
|
34
|
+
</el-popconfirm>
|
|
35
|
+
</template>
|
|
36
|
+
```
|
|
37
|
+
:::
|
|
38
|
+
|
|
39
|
+
### Attributes
|
|
40
|
+
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
41
|
+
|--------------------|----------------------------------------------------------|-------------------|-------------|--------|
|
|
42
|
+
| title | 标题 | String | — | — |
|
|
43
|
+
| confirm-button-text | 确认按钮文字 | String | — | — |
|
|
44
|
+
| cancel-button-text | 取消按钮文字 | String | — | — |
|
|
45
|
+
| confirm-button-type | 确认按钮类型 | String | — | Primary |
|
|
46
|
+
| cancel-button-type | 取消按钮类型 | String | — | Text |
|
|
47
|
+
| icon | Icon | String | — | el-icon-question |
|
|
48
|
+
| icon-color | Icon 颜色 | String | — | #f90 |
|
|
49
|
+
| hide-icon | 是否隐藏 Icon | Boolean | — | false |
|
|
50
|
+
|
|
51
|
+
### Slot
|
|
52
|
+
| 参数 | 说明 |
|
|
53
|
+
|--- | ---|
|
|
54
|
+
| reference | 触发 Popconfirm 显示的 HTML 元素 |
|
|
55
|
+
|
|
56
|
+
### Events
|
|
57
|
+
| 事件名称 | 说明 | 回调参数 |
|
|
58
|
+
|---------|--------|---------|
|
|
59
|
+
| confirm | 点击确认按钮时触发 | — |
|
|
60
|
+
| cancel | 点击取消按钮时触发 | — |
|