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,167 @@
|
|
|
1
|
+
## Popover 弹出框
|
|
2
|
+
|
|
3
|
+
### 基础用法
|
|
4
|
+
Popover 的属性与 Tooltip 很类似,它们都是基于`Vue-popper`开发的,因此对于重复属性,请参考 Tooltip 的文档,在此文档中不做详尽解释。
|
|
5
|
+
|
|
6
|
+
:::demo `trigger`属性用于设置何时触发 Popover,支持四种触发方式:`hover`,`click`,`focus` 和 `manual`。对于触发 Popover 的元素,有两种写法:使用 `slot="reference"` 的具名插槽,或使用自定义指令`v-popover`指向 Popover 的索引`ref`。
|
|
7
|
+
```html
|
|
8
|
+
<template>
|
|
9
|
+
<el-popover
|
|
10
|
+
placement="top-start"
|
|
11
|
+
title="标题"
|
|
12
|
+
width="200"
|
|
13
|
+
trigger="hover"
|
|
14
|
+
content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
|
|
15
|
+
<el-button slot="reference">hover 激活</el-button>
|
|
16
|
+
</el-popover>
|
|
17
|
+
|
|
18
|
+
<el-popover
|
|
19
|
+
placement="bottom"
|
|
20
|
+
title="标题"
|
|
21
|
+
width="200"
|
|
22
|
+
trigger="click"
|
|
23
|
+
content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
|
|
24
|
+
<el-button slot="reference">click 激活</el-button>
|
|
25
|
+
</el-popover>
|
|
26
|
+
|
|
27
|
+
<el-popover
|
|
28
|
+
ref="popover"
|
|
29
|
+
placement="right"
|
|
30
|
+
title="标题"
|
|
31
|
+
width="200"
|
|
32
|
+
trigger="focus"
|
|
33
|
+
content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
|
|
34
|
+
</el-popover>
|
|
35
|
+
<el-button v-popover:popover>focus 激活</el-button>
|
|
36
|
+
|
|
37
|
+
<el-popover
|
|
38
|
+
placement="bottom"
|
|
39
|
+
title="标题"
|
|
40
|
+
width="200"
|
|
41
|
+
trigger="manual"
|
|
42
|
+
content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。"
|
|
43
|
+
v-model="visible">
|
|
44
|
+
<el-button slot="reference" @click="visible = !visible">手动激活</el-button>
|
|
45
|
+
</el-popover>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
export default {
|
|
50
|
+
data() {
|
|
51
|
+
return {
|
|
52
|
+
visible: false
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
</script>
|
|
57
|
+
```
|
|
58
|
+
:::
|
|
59
|
+
|
|
60
|
+
### 嵌套信息
|
|
61
|
+
|
|
62
|
+
可以在 Popover 中嵌套多种类型信息,以下为嵌套表格的例子。
|
|
63
|
+
|
|
64
|
+
:::demo 利用分发取代`content`属性
|
|
65
|
+
```html
|
|
66
|
+
<el-popover
|
|
67
|
+
placement="right"
|
|
68
|
+
width="400"
|
|
69
|
+
trigger="click">
|
|
70
|
+
<el-table :data="gridData">
|
|
71
|
+
<el-table-column width="150" property="date" label="日期"></el-table-column>
|
|
72
|
+
<el-table-column width="100" property="name" label="姓名"></el-table-column>
|
|
73
|
+
<el-table-column width="300" property="address" label="地址"></el-table-column>
|
|
74
|
+
</el-table>
|
|
75
|
+
<el-button slot="reference">click 激活</el-button>
|
|
76
|
+
</el-popover>
|
|
77
|
+
|
|
78
|
+
<script>
|
|
79
|
+
export default {
|
|
80
|
+
data() {
|
|
81
|
+
return {
|
|
82
|
+
gridData: [{
|
|
83
|
+
date: '2016-05-02',
|
|
84
|
+
name: '王小虎',
|
|
85
|
+
address: '上海市普陀区金沙江路 1518 弄'
|
|
86
|
+
}, {
|
|
87
|
+
date: '2016-05-04',
|
|
88
|
+
name: '王小虎',
|
|
89
|
+
address: '上海市普陀区金沙江路 1518 弄'
|
|
90
|
+
}, {
|
|
91
|
+
date: '2016-05-01',
|
|
92
|
+
name: '王小虎',
|
|
93
|
+
address: '上海市普陀区金沙江路 1518 弄'
|
|
94
|
+
}, {
|
|
95
|
+
date: '2016-05-03',
|
|
96
|
+
name: '王小虎',
|
|
97
|
+
address: '上海市普陀区金沙江路 1518 弄'
|
|
98
|
+
}]
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
</script>
|
|
103
|
+
```
|
|
104
|
+
:::
|
|
105
|
+
|
|
106
|
+
### 嵌套操作
|
|
107
|
+
|
|
108
|
+
当然,你还可以嵌套操作,这相比 Dialog 更为轻量:
|
|
109
|
+
|
|
110
|
+
:::demo
|
|
111
|
+
```html
|
|
112
|
+
<el-popover
|
|
113
|
+
placement="top"
|
|
114
|
+
width="160"
|
|
115
|
+
v-model="visible">
|
|
116
|
+
<p>这是一段内容这是一段内容确定删除吗?</p>
|
|
117
|
+
<div style="text-align: right; margin: 0">
|
|
118
|
+
<el-button size="mini" type="text" @click="visible = false">取消</el-button>
|
|
119
|
+
<el-button type="primary" size="mini" @click="visible = false">确定</el-button>
|
|
120
|
+
</div>
|
|
121
|
+
<el-button slot="reference">删除</el-button>
|
|
122
|
+
</el-popover>
|
|
123
|
+
|
|
124
|
+
<script>
|
|
125
|
+
export default {
|
|
126
|
+
data() {
|
|
127
|
+
return {
|
|
128
|
+
visible: false,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
</script>
|
|
133
|
+
```
|
|
134
|
+
:::
|
|
135
|
+
|
|
136
|
+
### Attributes
|
|
137
|
+
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
138
|
+
|--------------------|----------------------------------------------------------|-------------------|-------------|--------|
|
|
139
|
+
| trigger | 触发方式 | String | click/focus/hover/manual | click |
|
|
140
|
+
| title | 标题 | String | — | — |
|
|
141
|
+
| content | 显示的内容,也可以通过 `slot` 传入 DOM | String | — | — |
|
|
142
|
+
| width | 宽度 | String, Number | — | 最小宽度 150px |
|
|
143
|
+
| placement | 出现位置 | String | top/top-start/top-end/bottom/bottom-start/bottom-end/left/left-start/left-end/right/right-start/right-end | bottom |
|
|
144
|
+
| disabled | Popover 是否可用 | Boolean | — | false |
|
|
145
|
+
| value / v-model | 状态是否可见 | Boolean | — | false |
|
|
146
|
+
| offset | 出现位置的偏移量 | Number | — | 0 |
|
|
147
|
+
| transition | 定义渐变动画 | String | — | fade-in-linear |
|
|
148
|
+
| visible-arrow | 是否显示 Tooltip 箭头,更多参数可见[Vue-popper](https://github.com/element-component/vue-popper) | Boolean | — | true |
|
|
149
|
+
| popper-options | [popper.js](https://popper.js.org/documentation.html) 的参数 | Object | 参考 [popper.js](https://popper.js.org/documentation.html) 文档 | `{ boundariesElement: 'body', gpuAcceleration: false }` |
|
|
150
|
+
| popper-class | 为 popper 添加类名 | String | — | — |
|
|
151
|
+
| open-delay | 触发方式为 hover 时的显示延迟,单位为毫秒 | Number | — | — |
|
|
152
|
+
| close-delay | 触发方式为 hover 时的隐藏延迟,单位为毫秒 | number | — | 200 |
|
|
153
|
+
| tabindex | Popover 组件的 [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) | number | — | 0 |
|
|
154
|
+
|
|
155
|
+
### Slot
|
|
156
|
+
| 参数 | 说明 |
|
|
157
|
+
|--- | ---|
|
|
158
|
+
| — | Popover 内嵌 HTML 文本 |
|
|
159
|
+
| reference | 触发 Popover 显示的 HTML 元素 |
|
|
160
|
+
|
|
161
|
+
### Events
|
|
162
|
+
| 事件名称 | 说明 | 回调参数 |
|
|
163
|
+
|---------|--------|---------|
|
|
164
|
+
| show | 显示时触发 | — |
|
|
165
|
+
| after-enter | 显示动画播放完毕后触发 | — |
|
|
166
|
+
| hide | 隐藏时触发 | — |
|
|
167
|
+
| after-leave | 隐藏动画播放完毕后触发 | — |
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
## Progress 进度条
|
|
2
|
+
|
|
3
|
+
用于展示操作进度,告知用户当前状态和预期。
|
|
4
|
+
|
|
5
|
+
### 线形进度条
|
|
6
|
+
|
|
7
|
+
:::demo Progress 组件设置`percentage`属性即可,表示进度条对应的百分比,**必填**,必须在 0-100。通过 `format` 属性来指定进度条文字内容。
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<el-progress :percentage="50"></el-progress>
|
|
11
|
+
<el-progress :percentage="100" :format="format"></el-progress>
|
|
12
|
+
<el-progress :percentage="100" status="success"></el-progress>
|
|
13
|
+
<el-progress :percentage="100" status="warning"></el-progress>
|
|
14
|
+
<el-progress :percentage="50" status="exception"></el-progress>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
export default {
|
|
18
|
+
methods: {
|
|
19
|
+
format(percentage) {
|
|
20
|
+
return percentage === 100 ? '满' : `${percentage}%`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
</script>
|
|
25
|
+
```
|
|
26
|
+
:::
|
|
27
|
+
|
|
28
|
+
### 百分比内显
|
|
29
|
+
|
|
30
|
+
百分比不占用额外控件,适用于文件上传等场景。
|
|
31
|
+
|
|
32
|
+
:::demo Progress 组件可通过 `stroke-width` 属性更改进度条的高度,并可通过 `text-inside` 属性来将进度条描述置于进度条内部。
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<el-progress :text-inside="true" :stroke-width="26" :percentage="70"></el-progress>
|
|
36
|
+
<el-progress :text-inside="true" :stroke-width="24" :percentage="100" status="success"></el-progress>
|
|
37
|
+
<el-progress :text-inside="true" :stroke-width="22" :percentage="80" status="warning"></el-progress>
|
|
38
|
+
<el-progress :text-inside="true" :stroke-width="20" :percentage="50" status="exception"></el-progress>
|
|
39
|
+
```
|
|
40
|
+
:::
|
|
41
|
+
|
|
42
|
+
### 自定义颜色
|
|
43
|
+
|
|
44
|
+
可以通过 `color` 设置进度条的颜色,`color` 可以接受颜色字符串,函数和数组。
|
|
45
|
+
|
|
46
|
+
:::demo
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<el-progress :percentage="percentage" :color="customColor"></el-progress>
|
|
50
|
+
|
|
51
|
+
<el-progress :percentage="percentage" :color="customColorMethod"></el-progress>
|
|
52
|
+
|
|
53
|
+
<el-progress :percentage="percentage" :color="customColors"></el-progress>
|
|
54
|
+
<div>
|
|
55
|
+
<el-button-group>
|
|
56
|
+
<el-button icon="el-icon-minus" @click="decrease"></el-button>
|
|
57
|
+
<el-button icon="el-icon-plus" @click="increase"></el-button>
|
|
58
|
+
</el-button-group>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<script>
|
|
62
|
+
export default {
|
|
63
|
+
data() {
|
|
64
|
+
return {
|
|
65
|
+
percentage: 20,
|
|
66
|
+
customColor: '#409eff',
|
|
67
|
+
customColors: [
|
|
68
|
+
{color: '#f56c6c', percentage: 20},
|
|
69
|
+
{color: '#e6a23c', percentage: 40},
|
|
70
|
+
{color: '#5cb87a', percentage: 60},
|
|
71
|
+
{color: '#1989fa', percentage: 80},
|
|
72
|
+
{color: '#6f7ad3', percentage: 100}
|
|
73
|
+
]
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
methods: {
|
|
77
|
+
customColorMethod(percentage) {
|
|
78
|
+
if (percentage < 30) {
|
|
79
|
+
return '#909399';
|
|
80
|
+
} else if (percentage < 70) {
|
|
81
|
+
return '#e6a23c';
|
|
82
|
+
} else {
|
|
83
|
+
return '#67c23a';
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
increase() {
|
|
87
|
+
this.percentage += 10;
|
|
88
|
+
if (this.percentage > 100) {
|
|
89
|
+
this.percentage = 100;
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
decrease() {
|
|
93
|
+
this.percentage -= 10;
|
|
94
|
+
if (this.percentage < 0) {
|
|
95
|
+
this.percentage = 0;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</script>
|
|
101
|
+
```
|
|
102
|
+
:::
|
|
103
|
+
|
|
104
|
+
### 环形进度条
|
|
105
|
+
|
|
106
|
+
Progress 组件可通过 `type` 属性来指定使用环形进度条,在环形进度条中,还可以通过 `width` 属性来设置其大小。
|
|
107
|
+
|
|
108
|
+
:::demo
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<el-progress type="circle" :percentage="0"></el-progress>
|
|
112
|
+
<el-progress type="circle" :percentage="25"></el-progress>
|
|
113
|
+
<el-progress type="circle" :percentage="100" status="success"></el-progress>
|
|
114
|
+
<el-progress type="circle" :percentage="70" status="warning"></el-progress>
|
|
115
|
+
<el-progress type="circle" :percentage="50" status="exception"></el-progress>
|
|
116
|
+
```
|
|
117
|
+
:::
|
|
118
|
+
|
|
119
|
+
### 仪表盘形进度条
|
|
120
|
+
|
|
121
|
+
:::demo 通过 `type` 属性来指定使用仪表盘形进度条。
|
|
122
|
+
|
|
123
|
+
```html
|
|
124
|
+
|
|
125
|
+
<el-progress type="dashboard" :percentage="percentage" :color="colors"></el-progress>
|
|
126
|
+
<div>
|
|
127
|
+
<el-button-group>
|
|
128
|
+
<el-button icon="el-icon-minus" @click="decrease"></el-button>
|
|
129
|
+
<el-button icon="el-icon-plus" @click="increase"></el-button>
|
|
130
|
+
</el-button-group>
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<script>
|
|
134
|
+
export default {
|
|
135
|
+
data() {
|
|
136
|
+
return {
|
|
137
|
+
percentage: 10,
|
|
138
|
+
colors: [
|
|
139
|
+
{color: '#f56c6c', percentage: 20},
|
|
140
|
+
{color: '#e6a23c', percentage: 40},
|
|
141
|
+
{color: '#5cb87a', percentage: 60},
|
|
142
|
+
{color: '#1989fa', percentage: 80},
|
|
143
|
+
{color: '#6f7ad3', percentage: 100}
|
|
144
|
+
]
|
|
145
|
+
};
|
|
146
|
+
},
|
|
147
|
+
methods: {
|
|
148
|
+
increase() {
|
|
149
|
+
this.percentage += 10;
|
|
150
|
+
if (this.percentage > 100) {
|
|
151
|
+
this.percentage = 100;
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
decrease() {
|
|
155
|
+
this.percentage -= 10;
|
|
156
|
+
if (this.percentage < 0) {
|
|
157
|
+
this.percentage = 0;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
</script>
|
|
163
|
+
```
|
|
164
|
+
:::
|
|
165
|
+
|
|
166
|
+
### Attributes
|
|
167
|
+
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
|
168
|
+
|------------- |---------------- |---------------- |---------------------- |-------- |
|
|
169
|
+
| **percentage** | **百分比(必填)** | number | 0-100 | 0 |
|
|
170
|
+
| type | 进度条类型 | string | line/circle/dashboard | line |
|
|
171
|
+
| stroke-width | 进度条的宽度,单位 px | number | — | 6 |
|
|
172
|
+
| text-inside | 进度条显示文字内置在进度条内(只在 type=line 时可用) | boolean | — | false |
|
|
173
|
+
| status | 进度条当前状态 | string | success/exception/warning | — |
|
|
174
|
+
| color | 进度条背景色(会覆盖 status 状态颜色) | string/function/array | — | '' |
|
|
175
|
+
| width | 环形进度条画布宽度(只在 type 为 circle 或 dashboard 时可用) | number | | 126 |
|
|
176
|
+
| show-text | 是否显示进度条文字内容 | boolean | — | true |
|
|
177
|
+
| stroke-linecap | circle/dashboard 类型路径两端的形状 | string | butt/round/square | round |
|
|
178
|
+
| format | 指定进度条文字内容 | function(percentage) | — | — |
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
## 快速上手
|
|
2
|
+
|
|
3
|
+
本节将介绍如何在项目中使用 Element。
|
|
4
|
+
|
|
5
|
+
### 使用 vue-cli@3
|
|
6
|
+
|
|
7
|
+
我们为新版的 vue-cli 准备了相应的 [Element 插件](https://github.com/ElementUI/vue-cli-plugin-element),你可以用它们快速地搭建一个基于 Element 的项目。
|
|
8
|
+
|
|
9
|
+
### 使用 Starter Kit
|
|
10
|
+
|
|
11
|
+
我们提供了通用的[项目模板](https://github.com/ElementUI/element-starter),你可以直接使用。对于 Laravel 用户,我们也准备了相应的[模板](https://github.com/ElementUI/element-in-laravel-starter),同样可以直接下载使用。
|
|
12
|
+
|
|
13
|
+
如果不希望使用我们提供的模板,请继续阅读。
|
|
14
|
+
|
|
15
|
+
### 引入 Element
|
|
16
|
+
|
|
17
|
+
你可以引入整个 Element,或是根据需要仅引入部分组件。我们先介绍如何引入完整的 Element。
|
|
18
|
+
|
|
19
|
+
#### 完整引入
|
|
20
|
+
|
|
21
|
+
在 main.js 中写入以下内容:
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
import Vue from 'vue';
|
|
25
|
+
import ElementUI from 'pit-element-ui';
|
|
26
|
+
import 'pit-element-ui/lib/theme-chalk/index.css';
|
|
27
|
+
import App from './App.vue';
|
|
28
|
+
|
|
29
|
+
Vue.use(ElementUI);
|
|
30
|
+
|
|
31
|
+
new Vue({
|
|
32
|
+
el: '#app',
|
|
33
|
+
render: h => h(App)
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
以上代码便完成了 Element 的引入。需要注意的是,样式文件需要单独引入。
|
|
38
|
+
|
|
39
|
+
#### 按需引入
|
|
40
|
+
|
|
41
|
+
借助 [babel-plugin-component](https://github.com/QingWei-Li/babel-plugin-component),我们可以只引入需要的组件,以达到减小项目体积的目的。
|
|
42
|
+
|
|
43
|
+
首先,安装 babel-plugin-component:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install babel-plugin-component -D
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
然后,将 .babelrc 修改为:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"presets": [["es2015", { "modules": false }]],
|
|
54
|
+
"plugins": [
|
|
55
|
+
[
|
|
56
|
+
"component",
|
|
57
|
+
{
|
|
58
|
+
"libraryName": "element-ui",
|
|
59
|
+
"styleLibraryName": "theme-chalk"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
接下来,如果你只希望引入部分组件,比如 Button 和 Select,那么需要在 main.js 中写入以下内容:
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
import Vue from 'vue';
|
|
70
|
+
import { Button, Select } from 'element-ui';
|
|
71
|
+
import App from './App.vue';
|
|
72
|
+
|
|
73
|
+
Vue.component(Button.name, Button);
|
|
74
|
+
Vue.component(Select.name, Select);
|
|
75
|
+
/* 或写为
|
|
76
|
+
* Vue.use(Button)
|
|
77
|
+
* Vue.use(Select)
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
new Vue({
|
|
81
|
+
el: '#app',
|
|
82
|
+
render: h => h(App)
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
完整组件列表和引入方式(完整组件列表以 [components.json](https://github.com/ElemeFE/element/blob/master/components.json) 为准)
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
import Vue from 'vue';
|
|
90
|
+
import {
|
|
91
|
+
Pagination,
|
|
92
|
+
Dialog,
|
|
93
|
+
Autocomplete,
|
|
94
|
+
Dropdown,
|
|
95
|
+
DropdownMenu,
|
|
96
|
+
DropdownItem,
|
|
97
|
+
Menu,
|
|
98
|
+
Submenu,
|
|
99
|
+
MenuItem,
|
|
100
|
+
MenuItemGroup,
|
|
101
|
+
Input,
|
|
102
|
+
InputNumber,
|
|
103
|
+
Radio,
|
|
104
|
+
RadioGroup,
|
|
105
|
+
RadioButton,
|
|
106
|
+
Checkbox,
|
|
107
|
+
CheckboxButton,
|
|
108
|
+
CheckboxGroup,
|
|
109
|
+
Switch,
|
|
110
|
+
Select,
|
|
111
|
+
Option,
|
|
112
|
+
OptionGroup,
|
|
113
|
+
Button,
|
|
114
|
+
ButtonGroup,
|
|
115
|
+
Table,
|
|
116
|
+
TableColumn,
|
|
117
|
+
DatePicker,
|
|
118
|
+
TimeSelect,
|
|
119
|
+
TimePicker,
|
|
120
|
+
Popover,
|
|
121
|
+
Tooltip,
|
|
122
|
+
Breadcrumb,
|
|
123
|
+
BreadcrumbItem,
|
|
124
|
+
Form,
|
|
125
|
+
FormItem,
|
|
126
|
+
Tabs,
|
|
127
|
+
TabPane,
|
|
128
|
+
Tag,
|
|
129
|
+
Tree,
|
|
130
|
+
Alert,
|
|
131
|
+
Slider,
|
|
132
|
+
Icon,
|
|
133
|
+
Row,
|
|
134
|
+
Col,
|
|
135
|
+
Upload,
|
|
136
|
+
Progress,
|
|
137
|
+
Spinner,
|
|
138
|
+
Badge,
|
|
139
|
+
Card,
|
|
140
|
+
Rate,
|
|
141
|
+
Steps,
|
|
142
|
+
Step,
|
|
143
|
+
Carousel,
|
|
144
|
+
CarouselItem,
|
|
145
|
+
Collapse,
|
|
146
|
+
CollapseItem,
|
|
147
|
+
Cascader,
|
|
148
|
+
ColorPicker,
|
|
149
|
+
Transfer,
|
|
150
|
+
Container,
|
|
151
|
+
Header,
|
|
152
|
+
Aside,
|
|
153
|
+
Main,
|
|
154
|
+
Footer,
|
|
155
|
+
Timeline,
|
|
156
|
+
TimelineItem,
|
|
157
|
+
Link,
|
|
158
|
+
Divider,
|
|
159
|
+
Image,
|
|
160
|
+
Calendar,
|
|
161
|
+
Backtop,
|
|
162
|
+
PageHeader,
|
|
163
|
+
CascaderPanel,
|
|
164
|
+
Loading,
|
|
165
|
+
MessageBox,
|
|
166
|
+
Message,
|
|
167
|
+
Notification
|
|
168
|
+
} from 'element-ui';
|
|
169
|
+
|
|
170
|
+
Vue.use(Pagination);
|
|
171
|
+
Vue.use(Dialog);
|
|
172
|
+
Vue.use(Autocomplete);
|
|
173
|
+
Vue.use(Dropdown);
|
|
174
|
+
Vue.use(DropdownMenu);
|
|
175
|
+
Vue.use(DropdownItem);
|
|
176
|
+
Vue.use(Menu);
|
|
177
|
+
Vue.use(Submenu);
|
|
178
|
+
Vue.use(MenuItem);
|
|
179
|
+
Vue.use(MenuItemGroup);
|
|
180
|
+
Vue.use(Input);
|
|
181
|
+
Vue.use(InputNumber);
|
|
182
|
+
Vue.use(Radio);
|
|
183
|
+
Vue.use(RadioGroup);
|
|
184
|
+
Vue.use(RadioButton);
|
|
185
|
+
Vue.use(Checkbox);
|
|
186
|
+
Vue.use(CheckboxButton);
|
|
187
|
+
Vue.use(CheckboxGroup);
|
|
188
|
+
Vue.use(Switch);
|
|
189
|
+
Vue.use(Select);
|
|
190
|
+
Vue.use(Option);
|
|
191
|
+
Vue.use(OptionGroup);
|
|
192
|
+
Vue.use(Button);
|
|
193
|
+
Vue.use(ButtonGroup);
|
|
194
|
+
Vue.use(Table);
|
|
195
|
+
Vue.use(TableColumn);
|
|
196
|
+
Vue.use(DatePicker);
|
|
197
|
+
Vue.use(TimeSelect);
|
|
198
|
+
Vue.use(TimePicker);
|
|
199
|
+
Vue.use(Popover);
|
|
200
|
+
Vue.use(Tooltip);
|
|
201
|
+
Vue.use(Breadcrumb);
|
|
202
|
+
Vue.use(BreadcrumbItem);
|
|
203
|
+
Vue.use(Form);
|
|
204
|
+
Vue.use(FormItem);
|
|
205
|
+
Vue.use(Tabs);
|
|
206
|
+
Vue.use(TabPane);
|
|
207
|
+
Vue.use(Tag);
|
|
208
|
+
Vue.use(Tree);
|
|
209
|
+
Vue.use(Alert);
|
|
210
|
+
Vue.use(Slider);
|
|
211
|
+
Vue.use(Icon);
|
|
212
|
+
Vue.use(Row);
|
|
213
|
+
Vue.use(Col);
|
|
214
|
+
Vue.use(Upload);
|
|
215
|
+
Vue.use(Progress);
|
|
216
|
+
Vue.use(Spinner);
|
|
217
|
+
Vue.use(Badge);
|
|
218
|
+
Vue.use(Card);
|
|
219
|
+
Vue.use(Rate);
|
|
220
|
+
Vue.use(Steps);
|
|
221
|
+
Vue.use(Step);
|
|
222
|
+
Vue.use(Carousel);
|
|
223
|
+
Vue.use(CarouselItem);
|
|
224
|
+
Vue.use(Collapse);
|
|
225
|
+
Vue.use(CollapseItem);
|
|
226
|
+
Vue.use(Cascader);
|
|
227
|
+
Vue.use(ColorPicker);
|
|
228
|
+
Vue.use(Transfer);
|
|
229
|
+
Vue.use(Container);
|
|
230
|
+
Vue.use(Header);
|
|
231
|
+
Vue.use(Aside);
|
|
232
|
+
Vue.use(Main);
|
|
233
|
+
Vue.use(Footer);
|
|
234
|
+
Vue.use(Timeline);
|
|
235
|
+
Vue.use(TimelineItem);
|
|
236
|
+
Vue.use(Link);
|
|
237
|
+
Vue.use(Divider);
|
|
238
|
+
Vue.use(Image);
|
|
239
|
+
Vue.use(Calendar);
|
|
240
|
+
Vue.use(Backtop);
|
|
241
|
+
Vue.use(PageHeader);
|
|
242
|
+
Vue.use(CascaderPanel);
|
|
243
|
+
|
|
244
|
+
Vue.use(Loading.directive);
|
|
245
|
+
|
|
246
|
+
Vue.prototype.$loading = Loading.service;
|
|
247
|
+
Vue.prototype.$msgbox = MessageBox;
|
|
248
|
+
Vue.prototype.$alert = MessageBox.alert;
|
|
249
|
+
Vue.prototype.$confirm = MessageBox.confirm;
|
|
250
|
+
Vue.prototype.$prompt = MessageBox.prompt;
|
|
251
|
+
Vue.prototype.$notify = Notification;
|
|
252
|
+
Vue.prototype.$message = Message;
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### 全局配置
|
|
256
|
+
|
|
257
|
+
在引入 Element 时,可以传入一个全局配置对象。该对象目前支持 `size` 与 `zIndex` 字段。`size` 用于改变组件的默认尺寸,`zIndex` 设置弹框的初始 z-index(默认值:2000)。按照引入 Element 的方式,具体操作如下:
|
|
258
|
+
|
|
259
|
+
完整引入 Element:
|
|
260
|
+
|
|
261
|
+
```js
|
|
262
|
+
import Vue from 'vue';
|
|
263
|
+
import Element from 'element-ui';
|
|
264
|
+
Vue.use(Element, { size: 'small', zIndex: 3000 });
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
按需引入 Element:
|
|
268
|
+
|
|
269
|
+
```js
|
|
270
|
+
import Vue from 'vue';
|
|
271
|
+
import { Button } from 'element-ui';
|
|
272
|
+
|
|
273
|
+
Vue.prototype.$ELEMENT = { size: 'small', zIndex: 3000 };
|
|
274
|
+
Vue.use(Button);
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
按照以上设置,项目中所有拥有 `size` 属性的组件的默认尺寸均为 'small',弹框的初始 z-index 为 3000。
|
|
278
|
+
|
|
279
|
+
### 开始使用
|
|
280
|
+
|
|
281
|
+
至此,一个基于 Vue 和 Element 的开发环境已经搭建完毕,现在就可以编写代码了。各个组件的使用方法请参阅它们各自的文档。
|
|
282
|
+
|
|
283
|
+
### 使用 Nuxt.js
|
|
284
|
+
|
|
285
|
+
我们还可以使用 [Nuxt.js](https://nuxtjs.org):
|
|
286
|
+
|
|
287
|
+
<div class="glitch-embed-wrap" style="height: 420px; width: 100%;">
|
|
288
|
+
<iframe src="https://glitch.com/embed/#!/embed/nuxt-with-element?path=nuxt.config.js&previewSize=0&attributionHidden=true" alt="nuxt-with-element on glitch" style="height: 100%; width: 100%; border: 0;"></iframe>
|
|
289
|
+
</div>
|
|
290
|
+
|