qy-better-lib 0.0.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/.vscode/extensions.json +3 -0
- package/LICENSE +24 -0
- package/README.md +2 -0
- package/index.html +13 -0
- package/package.json +37 -0
- package/packages/core/DOCUMENTATION.md +2681 -0
- package/packages/core/LICENSE +24 -0
- package/packages/core/package.json +67 -0
- package/packages/core/types/index.d.ts +39 -0
- package/packages/core/types/json.d.ts +4 -0
- package/packages/core/types/vue.shim.d.ts +5 -0
- package/packages/core/vitest.config.ts +15 -0
- package/packages/core/yarn.lock +1233 -0
- package/packages/hooks/DOCUMENTATION.md +634 -0
- package/packages/hooks/LICENSE +24 -0
- package/packages/hooks/__tests__/use-chart/index.test.ts +287 -0
- package/packages/hooks/__tests__/use-emit/index.test.ts +248 -0
- package/packages/hooks/__tests__/use-fullscreen/index.test.ts +162 -0
- package/packages/hooks/__tests__/use-image/index.test.ts +230 -0
- package/packages/hooks/__tests__/use-layout-flow/index.test.ts +382 -0
- package/packages/hooks/__tests__/use-mqtt/index.test.ts +392 -0
- package/packages/hooks/__tests__/use-print/index.test.ts +378 -0
- package/packages/hooks/__tests__/use-watermark/index.test.ts +277 -0
- package/packages/hooks/__tests__/use-websocket/index.test.ts +402 -0
- package/packages/hooks/package.json +104 -0
- package/packages/hooks/types/index.d.ts +1 -0
- package/packages/hooks/types/json.d.ts +4 -0
- package/packages/hooks/types/vue.shim.d.ts +5 -0
- package/packages/hooks/yarn.lock +1832 -0
- package/packages/lowcode/core/package.json +60 -0
- package/packages/lowcode/core/types/index.d.ts +1 -0
- package/packages/lowcode/core/types/json.d.ts +4 -0
- package/packages/lowcode/core/types/vue.shim.d.ts +5 -0
- package/packages/lowcode/core/vite.dist.min.config.js +40 -0
- package/packages/lowcode/core/vite.dist.min.config.js.map +1 -0
- package/packages/lowcode/core/vite.lib.config.js +74 -0
- package/packages/lowcode/core/vite.lib.config.js.map +1 -0
- package/packages/lowcode/core/yarn.lock +1132 -0
- package/packages/lowcode/mobile/package.json +63 -0
- package/packages/lowcode/mobile/types/index.d.ts +1 -0
- package/packages/lowcode/mobile/types/json.d.ts +4 -0
- package/packages/lowcode/mobile/types/vue.shim.d.ts +77 -0
- package/packages/lowcode/mobile/vite.config.js +11 -0
- package/packages/lowcode/mobile/vite.config.js.map +1 -0
- package/packages/lowcode/mobile/vite.dist.min.config.js +71 -0
- package/packages/lowcode/mobile/vite.dist.min.config.js.map +1 -0
- package/packages/lowcode/mobile/vite.lib.config.js +137 -0
- package/packages/lowcode/mobile/vite.lib.config.js.map +1 -0
- package/packages/lowcode/mobile/yarn.lock +3888 -0
- package/packages/lowcode/pc/package.json +64 -0
- package/packages/lowcode/pc/vite.config.js +11 -0
- package/packages/lowcode/pc/vite.config.js.map +1 -0
- package/packages/lowcode/pc/vite.dist.min.config.js +71 -0
- package/packages/lowcode/pc/vite.dist.min.config.js.map +1 -0
- package/packages/lowcode/pc/vite.lib.config.js +137 -0
- package/packages/lowcode/pc/vite.lib.config.js.map +1 -0
- package/packages/lowcode/pc/yarn.lock +4026 -0
- package/packages/pc_components/DOCUMENTATION.md +566 -0
- package/packages/pc_components/LICENSE +24 -0
- package/packages/pc_components/lib/commDialog/index.d.ts +3 -0
- package/packages/pc_components/lib/commDialog/index.js +8 -0
- package/packages/pc_components/lib/commDialog/src/index.vue.d.ts +102 -0
- package/packages/pc_components/lib/commDialog/src/index.vue.js +43 -0
- package/packages/pc_components/lib/commDialog/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/commDialog/src/props.d.ts +49 -0
- package/packages/pc_components/lib/commDialog/src/props.js +48 -0
- package/packages/pc_components/lib/commDialog/src/type.d.ts +39 -0
- package/packages/pc_components/lib/commForm/index.d.ts +3 -0
- package/packages/pc_components/lib/commForm/index.js +8 -0
- package/packages/pc_components/lib/commForm/src/index.vue.d.ts +95 -0
- package/packages/pc_components/lib/commForm/src/index.vue.js +50 -0
- package/packages/pc_components/lib/commForm/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/commForm/src/props.d.ts +49 -0
- package/packages/pc_components/lib/commForm/src/props.js +47 -0
- package/packages/pc_components/lib/commForm/src/type.d.ts +8 -0
- package/packages/pc_components/lib/contextMenu/index.d.ts +5 -0
- package/packages/pc_components/lib/contextMenu/index.js +8 -0
- package/packages/pc_components/lib/contextMenu/src/index.vue.d.ts +91 -0
- package/packages/pc_components/lib/contextMenu/src/index.vue.js +153 -0
- package/packages/pc_components/lib/contextMenu/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/contextMenu/src/props.d.ts +32 -0
- package/packages/pc_components/lib/contextMenu/src/props.js +27 -0
- package/packages/pc_components/lib/contextMenu/src/type.d.ts +11 -0
- package/packages/pc_components/lib/describeView/index.d.ts +2 -0
- package/packages/pc_components/lib/describeView/index.js +7 -0
- package/packages/pc_components/lib/describeView/src/index.vue.d.ts +61 -0
- package/packages/pc_components/lib/describeView/src/index.vue.js +84 -0
- package/packages/pc_components/lib/describeView/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/describeView/src/props.d.ts +35 -0
- package/packages/pc_components/lib/describeView/src/props.js +33 -0
- package/packages/pc_components/lib/describeView/src/type.d.ts +10 -0
- package/packages/pc_components/lib/index.d.ts +18 -0
- package/packages/pc_components/lib/index.js +40 -0
- package/packages/pc_components/lib/simpleVirtualList/index.d.ts +2 -0
- package/packages/pc_components/lib/simpleVirtualList/index.js +7 -0
- package/packages/pc_components/lib/simpleVirtualList/src/index.vue.d.ts +28 -0
- package/packages/pc_components/lib/simpleVirtualList/src/index.vue.js +101 -0
- package/packages/pc_components/lib/simpleVirtualList/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/simpleVirtualList/src/type.d.ts +12 -0
- package/packages/pc_components/lib/styles/comm-form.scss +4 -0
- package/packages/pc_components/lib/styles/context-menu.scss +47 -0
- package/packages/pc_components/lib/styles/describe-view.scss +25 -0
- package/packages/pc_components/lib/styles/index.scss +6 -0
- package/packages/pc_components/lib/styles/simple-virtual-list.scss +25 -0
- package/packages/pc_components/lib/styles/table-extend.scss +100 -0
- package/packages/pc_components/lib/styles/text-button.scss +71 -0
- package/packages/pc_components/lib/tableExtend/index.d.ts +3 -0
- package/packages/pc_components/lib/tableExtend/index.js +7 -0
- package/packages/pc_components/lib/tableExtend/props.d.ts +130 -0
- package/packages/pc_components/lib/tableExtend/props.js +128 -0
- package/packages/pc_components/lib/tableExtend/src/colVisible.vue.d.ts +3 -0
- package/packages/pc_components/lib/tableExtend/src/colVisible.vue.js +128 -0
- package/packages/pc_components/lib/tableExtend/src/colVisible.vue2.js +4 -0
- package/packages/pc_components/lib/tableExtend/src/index.vue.d.ts +186 -0
- package/packages/pc_components/lib/tableExtend/src/index.vue.js +234 -0
- package/packages/pc_components/lib/tableExtend/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/tableExtend/src/valueCol.vue.d.ts +24 -0
- package/packages/pc_components/lib/tableExtend/src/valueCol.vue.js +29 -0
- package/packages/pc_components/lib/tableExtend/src/valueCol.vue2.js +4 -0
- package/packages/pc_components/lib/tableExtend/type.d.ts +165 -0
- package/packages/pc_components/lib/tableExtend/type.js +9 -0
- package/packages/pc_components/lib/tableExtend/useTable.d.ts +27 -0
- package/packages/pc_components/lib/tableExtend/useTable.js +115 -0
- package/packages/pc_components/lib/textButton/index.d.ts +2 -0
- package/packages/pc_components/lib/textButton/index.js +7 -0
- package/packages/pc_components/lib/textButton/src/index.vue.d.ts +42 -0
- package/packages/pc_components/lib/textButton/src/index.vue.js +44 -0
- package/packages/pc_components/lib/textButton/src/index.vue2.js +4 -0
- package/packages/pc_components/lib/textButton/src/props.d.ts +23 -0
- package/packages/pc_components/lib/textButton/src/props.js +30 -0
- package/packages/pc_components/lib/textButton/src/type.d.ts +30 -0
- package/packages/pc_components/lib/utils/index.d.ts +77 -0
- package/packages/pc_components/lib/utils/index.js +124 -0
- package/packages/pc_components/package.json +73 -0
- package/packages/pc_components/types/index.d.ts +9 -0
- package/packages/pc_components/types/json.d.ts +4 -0
- package/packages/pc_components/types/vue.shim.d.ts +5 -0
- package/packages/pc_components/yarn.lock +1641 -0
- package/postcss.config.js +19 -0
- package/public/vite.svg +1 -0
- package/src/App.vue +37 -0
- package/src/api/index.ts +42 -0
- package/src/assets/vue.svg +1 -0
- package/src/document/core.md +2680 -0
- package/src/document/hooks.md +632 -0
- package/src/document/pc_components.md +566 -0
- package/src/locales/en.json +1 -0
- package/src/locales/zh-cn.json +1 -0
- package/src/main.ts +13 -0
- package/src/plugins/element-plus.ts +16 -0
- package/src/plugins/i18n.ts +17 -0
- package/src/plugins/index.ts +13 -0
- package/src/plugins/store.ts +12 -0
- package/src/router/index.ts +20 -0
- package/src/shared/chartType.ts +279 -0
- package/src/shared/const.ts +160 -0
- package/src/shared/lib.ts +129 -0
- package/src/shared/request.ts +255 -0
- package/src/shared/type.ts +48 -0
- package/src/shared/utils/date.ts +83 -0
- package/src/shared/utils/utils.ts +85 -0
- package/src/store/index.ts +22 -0
- package/src/store/modules/app.ts +17 -0
- package/src/store/modules/shared.ts +21 -0
- package/src/styles/index.scss +169 -0
- package/src/types/app.d.ts +23 -0
- package/src/types/echarts.d.ts +5 -0
- package/src/types/index.d.ts +1 -0
- package/src/types/json.d.ts +4 -0
- package/src/types/scss.d.ts +9 -0
- package/src/types/vue.shim.d.ts +5 -0
- package/src/views/docs/docs-content.vue +379 -0
- package/src/views/docs/docs-header.vue +130 -0
- package/src/views/docs/docs-sidebar.vue +76 -0
- package/src/views/docs/hooks.ts +600 -0
- package/src/views/docs/index.vue +30 -0
- package/src/views/docs/styles/docs-content.scss +106 -0
- package/src/views/docs/styles/docs-header.scss +20 -0
- package/src/views/docs/styles/docs-sidebar.scss +182 -0
- package/src/views/docs/styles/index.scss +14 -0
- package/src/views/docs/type.ts +101 -0
- package/src/views/index.vue +34 -0
- package/tsconfig.json +37 -0
- package/tsconfig.node.json +8 -0
- package/vite.config.ts +54 -0
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
# QY Better Lib PC Components - 使用文档
|
|
2
|
+
|
|
3
|
+
本文档详细介绍了 QY Better Lib PC Components 包中的各种组件,包括功能描述、参数说明和使用示例。
|
|
4
|
+
|
|
5
|
+
## 组件列表
|
|
6
|
+
|
|
7
|
+
### 1. tableExtend - 表格扩展组件
|
|
8
|
+
|
|
9
|
+
#### 功能描述
|
|
10
|
+
基于 Element Plus Table 组件的增强实现,提供分页、列显示/隐藏、排序、行选择等功能。
|
|
11
|
+
|
|
12
|
+
#### 属性
|
|
13
|
+
|
|
14
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
15
|
+
|-------|------|-------|------|
|
|
16
|
+
| options | Object | {} | 表格UI选项配置 |
|
|
17
|
+
| tableData | Array | [] | 表格数据源 |
|
|
18
|
+
| tableColums | Array<TableColumn> | [] | 表格列配置 |
|
|
19
|
+
| tableLoading | Boolean | false | 加载状态 |
|
|
20
|
+
| expand | Boolean | false | 是否显示展开行 |
|
|
21
|
+
| selectionCol | Boolean | true | 是否显示选择列 |
|
|
22
|
+
| indexCol | Boolean | true | 是否显示索引列 |
|
|
23
|
+
| isSetColumn | Boolean | false | 是否启用列显示/隐藏设置 |
|
|
24
|
+
| paging | Object | - | 分页配置,包含 pageIndex 和 pageSize |
|
|
25
|
+
| total | Number | - | 数据总数 |
|
|
26
|
+
| sizeList | Array<number> | [15, 20, 30, 50, 100] | 可选页面大小列表 |
|
|
27
|
+
| autoHeight | Boolean | false | 是否自动高度 |
|
|
28
|
+
| autoPagination | Boolean | false | 是否自动显示分页器 |
|
|
29
|
+
|
|
30
|
+
#### 事件
|
|
31
|
+
|
|
32
|
+
| 事件名 | 参数 | 说明 |
|
|
33
|
+
|-------|------|------|
|
|
34
|
+
| tableSort | { sort_name, sort_type } | 排序事件 |
|
|
35
|
+
| handleSelectionChange | rows | 选择变更事件 |
|
|
36
|
+
| currentChange | page_index | 页码变更事件 |
|
|
37
|
+
| pageSizeChange | page_size | 分页大小变更事件 |
|
|
38
|
+
| rowClick | rows | 行点击事件 |
|
|
39
|
+
| rowDblClick | rows | 行双击事件 |
|
|
40
|
+
|
|
41
|
+
#### 方法
|
|
42
|
+
|
|
43
|
+
| 方法名 | 参数 | 说明 |
|
|
44
|
+
|-------|------|------|
|
|
45
|
+
| clearSelection | 无 | 清空选择 |
|
|
46
|
+
| toggleRowSelection | row | 切换行选择状态 |
|
|
47
|
+
|
|
48
|
+
#### 暴露的属性和方法 (defineExpose)
|
|
49
|
+
|
|
50
|
+
| 属性/方法名 | 类型 | 说明 |
|
|
51
|
+
|-----------|------|------|
|
|
52
|
+
| clearSelection | Function | 清空选择 |
|
|
53
|
+
| toggleRowSelection | Function(row) | 切换行选择状态 |
|
|
54
|
+
| table | Ref<any> | 表格组件引用 |
|
|
55
|
+
|
|
56
|
+
#### 使用示例
|
|
57
|
+
|
|
58
|
+
```vue
|
|
59
|
+
<template>
|
|
60
|
+
<table-extend
|
|
61
|
+
:tableData="tableData"
|
|
62
|
+
:tableColums="tableColums"
|
|
63
|
+
:tableLoading="loading"
|
|
64
|
+
:paging="{ pageIndex: currentPage, pageSize: pageSize }"
|
|
65
|
+
:total="total"
|
|
66
|
+
@tableSort="handleSort"
|
|
67
|
+
@handleSelectionChange="handleSelectionChange"
|
|
68
|
+
@currentChange="handleCurrentChange"
|
|
69
|
+
@pageSizeChange="handlePageSizeChange"
|
|
70
|
+
@rowClick="handleRowClick"
|
|
71
|
+
>
|
|
72
|
+
<!-- 工具栏左侧插槽 -->
|
|
73
|
+
<template #tool-left>
|
|
74
|
+
<el-button type="primary">添加</el-button>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<!-- 工具栏右侧插槽 -->
|
|
78
|
+
<template #tool-right>
|
|
79
|
+
<el-button>导出</el-button>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<!-- 操作列插槽 -->
|
|
83
|
+
<template #operatColumn>
|
|
84
|
+
<el-table-column label="操作" width="150" fixed="right">
|
|
85
|
+
<template #default="scope">
|
|
86
|
+
<el-button size="small" @click="edit(scope.row)">编辑</el-button>
|
|
87
|
+
<el-button size="small" type="danger" @click="del(scope.row)">删除</el-button>
|
|
88
|
+
</template>
|
|
89
|
+
</el-table-column>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<!-- 展开行插槽 -->
|
|
93
|
+
<template #expand="{ row }">
|
|
94
|
+
<div>{{ row.description }}</div>
|
|
95
|
+
</template>
|
|
96
|
+
</table-extend>
|
|
97
|
+
</template>
|
|
98
|
+
|
|
99
|
+
<script setup>
|
|
100
|
+
import { ref } from 'vue';
|
|
101
|
+
import TableExtend from '@qy_better_lib/pc/components/tableExtend';
|
|
102
|
+
// 引入样式
|
|
103
|
+
import '@qy_better_lib/pc/styles/table-extend.scss';
|
|
104
|
+
|
|
105
|
+
const tableData = ref([
|
|
106
|
+
{ id: 1, name: '张三', age: 20, address: '北京市' },
|
|
107
|
+
{ id: 2, name: '李四', age: 25, address: '上海市' },
|
|
108
|
+
{ id: 3, name: '王五', age: 30, address: '广州市' }
|
|
109
|
+
]);
|
|
110
|
+
|
|
111
|
+
const tableColums = ref([
|
|
112
|
+
{ prop: 'name', label: '姓名', width: 100 },
|
|
113
|
+
{ prop: 'age', label: '年龄', width: 80, sortable: true },
|
|
114
|
+
{ prop: 'address', label: '地址', minWidth: 150 }
|
|
115
|
+
]);
|
|
116
|
+
|
|
117
|
+
const loading = ref(false);
|
|
118
|
+
const currentPage = ref(1);
|
|
119
|
+
const pageSize = ref(10);
|
|
120
|
+
const total = ref(3);
|
|
121
|
+
|
|
122
|
+
function handleSort(sort) {
|
|
123
|
+
console.log('排序:', sort);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function handleSelectionChange(rows) {
|
|
127
|
+
console.log('选择变更:', rows);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function handleCurrentChange(page) {
|
|
131
|
+
console.log('页码变更:', page);
|
|
132
|
+
currentPage.value = page;
|
|
133
|
+
// 加载数据
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function handlePageSizeChange(size) {
|
|
137
|
+
console.log('分页大小变更:', size);
|
|
138
|
+
pageSize.value = size;
|
|
139
|
+
// 加载数据
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function handleRowClick(row) {
|
|
143
|
+
console.log('行点击:', row);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function edit(row) {
|
|
147
|
+
console.log('编辑:', row);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function del(row) {
|
|
151
|
+
console.log('删除:', row);
|
|
152
|
+
}
|
|
153
|
+
</script>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 2. commForm - 通用表单组件
|
|
157
|
+
|
|
158
|
+
#### 功能描述
|
|
159
|
+
基于 Element Plus Form 组件的封装,提供表单验证、布局管理等功能。
|
|
160
|
+
|
|
161
|
+
#### 属性
|
|
162
|
+
|
|
163
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
164
|
+
|-------|------|-------|------|
|
|
165
|
+
| model | Object | {} | 表单数据对象 |
|
|
166
|
+
| rules | Object | {} | 表单验证规则 |
|
|
167
|
+
| labelWidth | String / Number | '80px' | 标签宽度 |
|
|
168
|
+
| labelPosition | String | 'right' | 标签位置 |
|
|
169
|
+
| size | String | 'default' | 表单尺寸 |
|
|
170
|
+
| inline | Boolean | false | 是否为行内表单 |
|
|
171
|
+
| disabled | Boolean | false | 是否禁用 |
|
|
172
|
+
|
|
173
|
+
#### 方法
|
|
174
|
+
|
|
175
|
+
| 方法名 | 参数 | 说明 |
|
|
176
|
+
|-------|------|------|
|
|
177
|
+
| validate | callback | 表单验证 |
|
|
178
|
+
| resetFields | 无 | 重置表单 |
|
|
179
|
+
| clearValidate | props | 清除验证 |
|
|
180
|
+
|
|
181
|
+
#### 暴露的属性和方法 (defineExpose)
|
|
182
|
+
|
|
183
|
+
| 属性/方法名 | 类型 | 说明 |
|
|
184
|
+
|-----------|------|------|
|
|
185
|
+
| validate | Function | 表单验证 |
|
|
186
|
+
| reset | Function | 重置表单 |
|
|
187
|
+
|
|
188
|
+
#### 使用示例
|
|
189
|
+
|
|
190
|
+
```vue
|
|
191
|
+
<template>
|
|
192
|
+
<comm-form
|
|
193
|
+
:model="formData"
|
|
194
|
+
:rules="rules"
|
|
195
|
+
label-width="100px"
|
|
196
|
+
>
|
|
197
|
+
<el-form-item label="姓名" prop="name">
|
|
198
|
+
<el-input v-model="formData.name"></el-input>
|
|
199
|
+
</el-form-item>
|
|
200
|
+
|
|
201
|
+
<el-form-item label="年龄" prop="age">
|
|
202
|
+
<el-input-number v-model="formData.age" :min="0" :max="100"></el-input-number>
|
|
203
|
+
</el-form-item>
|
|
204
|
+
|
|
205
|
+
<el-form-item label="地址" prop="address">
|
|
206
|
+
<el-input v-model="formData.address" type="textarea"></el-input>
|
|
207
|
+
</el-form-item>
|
|
208
|
+
|
|
209
|
+
<el-form-item>
|
|
210
|
+
<el-button type="primary" @click="submitForm">提交</el-button>
|
|
211
|
+
<el-button @click="resetForm">重置</el-button>
|
|
212
|
+
</el-form-item>
|
|
213
|
+
</comm-form>
|
|
214
|
+
</template>
|
|
215
|
+
|
|
216
|
+
<script setup>
|
|
217
|
+
import { ref } from 'vue';
|
|
218
|
+
import CommForm from '@qy_better_lib/pc/components/commForm';
|
|
219
|
+
// 引入样式
|
|
220
|
+
import '@qy_better_lib/pc/styles/comm-form.scss';
|
|
221
|
+
|
|
222
|
+
const formData = ref({
|
|
223
|
+
name: '',
|
|
224
|
+
age: '',
|
|
225
|
+
address: ''
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
const rules = ref({
|
|
229
|
+
name: [
|
|
230
|
+
{ required: true, message: '请输入姓名', trigger: 'blur' }
|
|
231
|
+
],
|
|
232
|
+
age: [
|
|
233
|
+
{ required: true, message: '请输入年龄', trigger: 'blur' },
|
|
234
|
+
{ type: 'number', message: '年龄必须为数字', trigger: 'blur' }
|
|
235
|
+
],
|
|
236
|
+
address: [
|
|
237
|
+
{ required: true, message: '请输入地址', trigger: 'blur' }
|
|
238
|
+
]
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
function submitForm() {
|
|
242
|
+
// 表单验证
|
|
243
|
+
// 提交数据
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function resetForm() {
|
|
247
|
+
// 重置表单
|
|
248
|
+
}
|
|
249
|
+
</script>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### 3. textButton - 文本按钮组件
|
|
253
|
+
|
|
254
|
+
#### 功能描述
|
|
255
|
+
文本按钮组件,支持多种状态和样式。
|
|
256
|
+
|
|
257
|
+
#### 属性
|
|
258
|
+
|
|
259
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
260
|
+
|-------|------|-------|------|
|
|
261
|
+
| type | String | 'default' | 按钮类型 |
|
|
262
|
+
| size | String | 'medium' | 按钮尺寸 |
|
|
263
|
+
| disabled | Boolean | false | 是否禁用 |
|
|
264
|
+
| loading | Boolean | false | 是否加载中 |
|
|
265
|
+
| icon | String | '' | 图标类名 |
|
|
266
|
+
|
|
267
|
+
#### 使用示例
|
|
268
|
+
|
|
269
|
+
```vue
|
|
270
|
+
<template>
|
|
271
|
+
<div>
|
|
272
|
+
<text-button type="primary" @click="handleClick">主要按钮</text-button>
|
|
273
|
+
<text-button type="success">成功按钮</text-button>
|
|
274
|
+
<text-button type="warning">警告按钮</text-button>
|
|
275
|
+
<text-button type="danger">危险按钮</text-button>
|
|
276
|
+
<text-button disabled>禁用按钮</text-button>
|
|
277
|
+
<text-button loading>加载中按钮</text-button>
|
|
278
|
+
</div>
|
|
279
|
+
</template>
|
|
280
|
+
|
|
281
|
+
<script setup>
|
|
282
|
+
import { ref } from 'vue';
|
|
283
|
+
import TextButton from '@qy_better_lib/pc/components/textButton';
|
|
284
|
+
// 引入样式
|
|
285
|
+
import '@qy_better_lib/pc/styles/text-button.scss';
|
|
286
|
+
|
|
287
|
+
function handleClick() {
|
|
288
|
+
console.log('按钮点击');
|
|
289
|
+
}
|
|
290
|
+
</script>
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### 4. contextMenu - 右键菜单组件
|
|
294
|
+
|
|
295
|
+
#### 功能描述
|
|
296
|
+
右键菜单组件,支持自定义菜单项和事件处理。
|
|
297
|
+
|
|
298
|
+
#### 属性
|
|
299
|
+
|
|
300
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
301
|
+
|-------|------|-------|------|
|
|
302
|
+
| menuList | Array | [] | 菜单列表 |
|
|
303
|
+
| trigger | String | 'click' | 触发方式 |
|
|
304
|
+
| placement | String | 'bottom' | 菜单位置 |
|
|
305
|
+
|
|
306
|
+
#### 暴露的属性和方法 (defineExpose)
|
|
307
|
+
|
|
308
|
+
| 属性/方法名 | 类型 | 说明 |
|
|
309
|
+
|-----------|------|------|
|
|
310
|
+
| show | Function(event) | 显示菜单,参数为鼠标事件或位置对象 |
|
|
311
|
+
| hide | Function | 隐藏菜单 |
|
|
312
|
+
|
|
313
|
+
#### 使用示例
|
|
314
|
+
|
|
315
|
+
```vue
|
|
316
|
+
<template>
|
|
317
|
+
<div>
|
|
318
|
+
<div ref="menuTarget" @contextmenu.prevent="showMenu">
|
|
319
|
+
右键点击我
|
|
320
|
+
</div>
|
|
321
|
+
|
|
322
|
+
<context-menu
|
|
323
|
+
ref="contextMenu"
|
|
324
|
+
:menu-list="menuList"
|
|
325
|
+
:target="menuTarget"
|
|
326
|
+
@menu-click="handleMenuClick"
|
|
327
|
+
></context-menu>
|
|
328
|
+
</div>
|
|
329
|
+
</template>
|
|
330
|
+
|
|
331
|
+
<script setup>
|
|
332
|
+
import { ref } from 'vue';
|
|
333
|
+
import ContextMenu from '@qy_better_lib/pc/components/contextMenu';
|
|
334
|
+
// 引入样式
|
|
335
|
+
import '@qy_better_lib/pc/styles/context-menu.scss';
|
|
336
|
+
|
|
337
|
+
const menuTarget = ref(null);
|
|
338
|
+
const contextMenu = ref(null);
|
|
339
|
+
|
|
340
|
+
const menuList = ref([
|
|
341
|
+
{ id: 1, label: '复制', icon: 'el-icon-document-copy' },
|
|
342
|
+
{ id: 2, label: '剪切', icon: 'el-icon-scissors' },
|
|
343
|
+
{ id: 3, label: '粘贴', icon: 'el-icon-document-remove' },
|
|
344
|
+
{ id: 4, label: '删除', icon: 'el-icon-delete', type: 'danger' }
|
|
345
|
+
]);
|
|
346
|
+
|
|
347
|
+
function showMenu(event) {
|
|
348
|
+
contextMenu.value.show(event);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function handleMenuClick(item) {
|
|
352
|
+
console.log('菜单点击:', item);
|
|
353
|
+
// 处理菜单点击事件
|
|
354
|
+
}
|
|
355
|
+
</script>
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### 5. describeView - 描述视图组件
|
|
359
|
+
|
|
360
|
+
#### 功能描述
|
|
361
|
+
描述视图组件,用于展示对象的详细信息。
|
|
362
|
+
|
|
363
|
+
#### 属性
|
|
364
|
+
|
|
365
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
366
|
+
|-------|------|-------|------|
|
|
367
|
+
| data | Object | {} | 数据对象 |
|
|
368
|
+
| schema | Array | [] | 描述项配置 |
|
|
369
|
+
| title | String | '' | 标题 |
|
|
370
|
+
| border | Boolean | false | 是否显示边框 |
|
|
371
|
+
| column | Number | 2 | 列数 |
|
|
372
|
+
|
|
373
|
+
#### 使用示例
|
|
374
|
+
|
|
375
|
+
```vue
|
|
376
|
+
<template>
|
|
377
|
+
<describe-view
|
|
378
|
+
:data="userInfo"
|
|
379
|
+
:schema="schema"
|
|
380
|
+
title="用户信息"
|
|
381
|
+
:border="true"
|
|
382
|
+
:column="3"
|
|
383
|
+
></describe-view>
|
|
384
|
+
</template>
|
|
385
|
+
|
|
386
|
+
<script setup>
|
|
387
|
+
import { ref } from 'vue';
|
|
388
|
+
import DescribeView from '@qy_better_lib/pc/components/describeView';
|
|
389
|
+
// 引入样式
|
|
390
|
+
import '@qy_better_lib/pc/styles/describe-view.scss';
|
|
391
|
+
|
|
392
|
+
const userInfo = ref({
|
|
393
|
+
name: '张三',
|
|
394
|
+
age: 25,
|
|
395
|
+
gender: '男',
|
|
396
|
+
address: '北京市朝阳区',
|
|
397
|
+
phone: '13800138000',
|
|
398
|
+
email: 'zhangsan@example.com'
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
const schema = ref([
|
|
402
|
+
{ label: '姓名', prop: 'name' },
|
|
403
|
+
{ label: '年龄', prop: 'age' },
|
|
404
|
+
{ label: '性别', prop: 'gender' },
|
|
405
|
+
{ label: '地址', prop: 'address' },
|
|
406
|
+
{ label: '电话', prop: 'phone' },
|
|
407
|
+
{ label: '邮箱', prop: 'email' }
|
|
408
|
+
]);
|
|
409
|
+
</script>
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### 6. simpleVirtualList - 简单虚拟列表组件
|
|
413
|
+
|
|
414
|
+
#### 功能描述
|
|
415
|
+
简单虚拟列表组件,用于高效渲染大量数据。
|
|
416
|
+
|
|
417
|
+
#### 属性
|
|
418
|
+
|
|
419
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
420
|
+
|-------|------|-------|------|
|
|
421
|
+
| data | Array | [] | 数据源 |
|
|
422
|
+
| height | Number / String | 300 | 列表高度 |
|
|
423
|
+
| itemHeight | Number | 50 | 每一项的高度 |
|
|
424
|
+
| keyField | String | 'id' | 数据项的唯一标识字段 |
|
|
425
|
+
|
|
426
|
+
#### 使用示例
|
|
427
|
+
|
|
428
|
+
```vue
|
|
429
|
+
<template>
|
|
430
|
+
<simple-virtual-list
|
|
431
|
+
:data="listData"
|
|
432
|
+
:height="500"
|
|
433
|
+
:item-height="60"
|
|
434
|
+
key-field="id"
|
|
435
|
+
>
|
|
436
|
+
<template #default="{ item, index }">
|
|
437
|
+
<div class="list-item">
|
|
438
|
+
<span class="index">{{ index + 1 }}</span>
|
|
439
|
+
<span class="name">{{ item.name }}</span>
|
|
440
|
+
<span class="age">{{ item.age }}</span>
|
|
441
|
+
</div>
|
|
442
|
+
</template>
|
|
443
|
+
</simple-virtual-list>
|
|
444
|
+
</template>
|
|
445
|
+
|
|
446
|
+
<script setup>
|
|
447
|
+
import { ref } from 'vue';
|
|
448
|
+
import SimpleVirtualList from '@qy_better_lib/pc/components/simpleVirtualList';
|
|
449
|
+
// 引入样式
|
|
450
|
+
import '@qy_better_lib/pc/styles/simple-virtual-list.scss';
|
|
451
|
+
|
|
452
|
+
// 生成大量数据
|
|
453
|
+
const listData = ref([]);
|
|
454
|
+
for (let i = 1; i <= 10000; i++) {
|
|
455
|
+
listData.value.push({
|
|
456
|
+
id: i,
|
|
457
|
+
name: `用户${i}`,
|
|
458
|
+
age: Math.floor(Math.random() * 50) + 18
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
</script>
|
|
462
|
+
|
|
463
|
+
<style scoped>
|
|
464
|
+
.list-item {
|
|
465
|
+
display: flex;
|
|
466
|
+
align-items: center;
|
|
467
|
+
padding: 0 20px;
|
|
468
|
+
height: 60px;
|
|
469
|
+
border-bottom: 1px solid #eee;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
.index {
|
|
473
|
+
width: 60px;
|
|
474
|
+
color: #999;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.name {
|
|
478
|
+
flex: 1;
|
|
479
|
+
font-weight: bold;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.age {
|
|
483
|
+
width: 60px;
|
|
484
|
+
color: #666;
|
|
485
|
+
}
|
|
486
|
+
</style>
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### 7. commDialog - 通用对话框组件
|
|
490
|
+
|
|
491
|
+
#### 功能描述
|
|
492
|
+
通用对话框组件,支持对话框(dialog)和抽屉(drawer)两种类型,基于Element Plus的ElDialog和ElDrawer组件。
|
|
493
|
+
|
|
494
|
+
#### 属性
|
|
495
|
+
|
|
496
|
+
| 属性名 | 类型 | 默认值 | 说明 |
|
|
497
|
+
|-------|------|-------|------|
|
|
498
|
+
| type | String | 'dialog' | 组件类型,可选值:dialog(对话框)、drawer(抽屉) |
|
|
499
|
+
| size | String / Number | '50%' | 对话框宽度或抽屉大小 |
|
|
500
|
+
| showClose | Boolean | true | 是否显示关闭按钮 |
|
|
501
|
+
| draggable | Boolean | false | 是否可拖动 |
|
|
502
|
+
| modal | Boolean | true | 是否显示遮罩 |
|
|
503
|
+
| modalStyle | Object | {} | 遮罩样式 |
|
|
504
|
+
|
|
505
|
+
#### 使用示例
|
|
506
|
+
|
|
507
|
+
```vue
|
|
508
|
+
<template>
|
|
509
|
+
<div>
|
|
510
|
+
<el-button type="primary" @click="dialogVisible = true">打开对话框</el-button>
|
|
511
|
+
<el-button @click="drawerVisible = true">打开抽屉</el-button>
|
|
512
|
+
|
|
513
|
+
<!-- 对话框 -->
|
|
514
|
+
<comm-dialog
|
|
515
|
+
v-model:visible="dialogVisible"
|
|
516
|
+
title="示例对话框"
|
|
517
|
+
type="dialog"
|
|
518
|
+
size="40%"
|
|
519
|
+
>
|
|
520
|
+
<div class="dialog-content">
|
|
521
|
+
<p>这是对话框内容</p>
|
|
522
|
+
<p>可以添加任意内容</p>
|
|
523
|
+
</div>
|
|
524
|
+
|
|
525
|
+
<template #footer>
|
|
526
|
+
<el-button @click="dialogVisible = false">取消</el-button>
|
|
527
|
+
<el-button type="primary" @click="handleConfirm">确定</el-button>
|
|
528
|
+
</template>
|
|
529
|
+
</comm-dialog>
|
|
530
|
+
|
|
531
|
+
<!-- 抽屉 -->
|
|
532
|
+
<comm-dialog
|
|
533
|
+
v-model:visible="drawerVisible"
|
|
534
|
+
title="示例抽屉"
|
|
535
|
+
type="drawer"
|
|
536
|
+
size="30%"
|
|
537
|
+
>
|
|
538
|
+
<div class="drawer-content">
|
|
539
|
+
<p>这是抽屉内容</p>
|
|
540
|
+
<p>可以添加任意内容</p>
|
|
541
|
+
</div>
|
|
542
|
+
</comm-dialog>
|
|
543
|
+
</div>
|
|
544
|
+
</template>
|
|
545
|
+
|
|
546
|
+
<script setup>
|
|
547
|
+
import { ref } from 'vue';
|
|
548
|
+
import CommDialog from '@qy_better_lib/pc/components/commDialog';
|
|
549
|
+
// commDialog 使用 Element Plus 内置样式,无需单独引入
|
|
550
|
+
|
|
551
|
+
const dialogVisible = ref(false);
|
|
552
|
+
const drawerVisible = ref(false);
|
|
553
|
+
|
|
554
|
+
function handleConfirm() {
|
|
555
|
+
console.log('确定');
|
|
556
|
+
dialogVisible.value = false;
|
|
557
|
+
}
|
|
558
|
+
</script>
|
|
559
|
+
|
|
560
|
+
<style scoped>
|
|
561
|
+
.dialog-content,
|
|
562
|
+
.drawer-content {
|
|
563
|
+
padding: 20px 0;
|
|
564
|
+
}
|
|
565
|
+
</style>
|
|
566
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
package/src/main.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createApp } from "vue";
|
|
2
|
+
import App from "./App.vue";
|
|
3
|
+
import router from "@/router/index";
|
|
4
|
+
import plugins from "@/plugins/index";
|
|
5
|
+
import "@/styles/index.scss";
|
|
6
|
+
|
|
7
|
+
const app = createApp(App);
|
|
8
|
+
|
|
9
|
+
app.use(router);
|
|
10
|
+
|
|
11
|
+
app.use(plugins);
|
|
12
|
+
|
|
13
|
+
app.mount("#app");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "element-plus/dist/index.css";
|
|
2
|
+
import "element-plus/theme-chalk/dark/css-vars.css";
|
|
3
|
+
import * as icons from "@element-plus/icons-vue";
|
|
4
|
+
import type { App } from "vue";
|
|
5
|
+
import elementPlus from "element-plus";
|
|
6
|
+
|
|
7
|
+
export default function (app: App) {
|
|
8
|
+
app.use(elementPlus);
|
|
9
|
+
// 注册图标
|
|
10
|
+
const keys = Object.keys(icons);
|
|
11
|
+
for (let i = 0; i < keys.length; i++) {
|
|
12
|
+
const key: string = keys[i];
|
|
13
|
+
const item = (icons as Record<string, any>)[key];
|
|
14
|
+
app.component(item.name, item);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createI18n } from "vue-i18n";
|
|
2
|
+
import en from "@/locales/en.json";
|
|
3
|
+
import zhcn from "@/locales/zh-cn.json";
|
|
4
|
+
|
|
5
|
+
const i18n = createI18n({
|
|
6
|
+
locale: "zh-cn",
|
|
7
|
+
legacy: false,
|
|
8
|
+
globalInjection: true,
|
|
9
|
+
silentFallbackWarn: true,
|
|
10
|
+
// 语言包文件内容
|
|
11
|
+
messages: {
|
|
12
|
+
"zh-cn": zhcn,
|
|
13
|
+
en: en,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export default i18n;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { App } from "vue";
|
|
2
|
+
import elementplus from "./element-plus";
|
|
3
|
+
import i18n from "./i18n";
|
|
4
|
+
import store from "./store";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
install: (app: App, options?: any) => {
|
|
8
|
+
// 状态管理
|
|
9
|
+
app.use(store);
|
|
10
|
+
app.use(elementplus);
|
|
11
|
+
app.use(i18n);
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { App } from "vue";
|
|
2
|
+
import { createPinia } from "pinia";
|
|
3
|
+
import { registerStore } from "@/store/index";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
install: (app: App, options?: any) => {
|
|
7
|
+
// 注册pinia
|
|
8
|
+
app.use(createPinia());
|
|
9
|
+
// 注册全局状态库
|
|
10
|
+
registerStore();
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createRouter, createWebHistory, Router } from "vue-router";
|
|
2
|
+
|
|
3
|
+
const routes = [
|
|
4
|
+
{
|
|
5
|
+
path: "/",
|
|
6
|
+
name: "index",
|
|
7
|
+
component: () => import("@/views/index.vue"),
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
path: "/docs",
|
|
11
|
+
name: "docs",
|
|
12
|
+
component: () => import("@/views/docs/index.vue"),
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
const router: Router = createRouter({
|
|
16
|
+
history: createWebHistory(import.meta.env.BASE_URL),
|
|
17
|
+
routes,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export default router;
|