jianghu-ui 1.0.6 → 1.0.8
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/jianghu-ui.css +195 -132
- package/dist/jianghu-ui.js +1 -1
- package/package.json +1 -1
- package/src/components/JhDrawer/JhDrawer.stories.js +6 -6
- package/src/components/JhDrawer/JhDrawer.vue +7 -1
- package/src/components/JhDrawerForm/JhDrawerForm.stories.js +161 -0
- package/src/components/JhDrawerForm/JhDrawerForm.vue +1 -1
- package/src/components/JhForm/JhForm.stories.js +114 -95
- package/src/components/JhForm/JhForm.vue +896 -205
- package/src/components/JhFormFields/JhFormFields.vue +42 -16
- package/src/components/JhModal/JhModal.stories.js +6 -6
- package/src/components/JhModal/JhModal.vue +1 -1
- package/src/components/JhModalForm/JhModalForm.vue +1 -1
- package/src/components/JhTable/JhTable.stories.js +134 -167
- package/src/components/JhTable/JhTable.vue +83 -23
- package/src/style/globalCSSVuetifyV4.css +1 -2
- package/src/components/JhAddressSelect/JhAddressSelect.md +0 -267
- package/src/components/JhCard/JhCard.md +0 -246
- package/src/components/JhCheckCard/JhCheckCard.md +0 -245
- package/src/components/JhConfirmDialog/JhConfirmDialog.md +0 -70
- package/src/components/JhDateRangePicker/JhDateRangePicker.md +0 -56
- package/src/components/JhDescriptions/JhDescriptions.md +0 -724
- package/src/components/JhDraggable/JhDraggable.md +0 -66
- package/src/components/JhDrawer/JhDrawer.md +0 -68
- package/src/components/JhDrawerForm/JhDrawerForm.md +0 -69
- package/src/components/JhEditableTable/JhEditableTable.md +0 -507
- package/src/components/JhFileInput/JhFileInput.md +0 -56
- package/src/components/JhForm/JhForm.md +0 -676
- package/src/components/JhFormFields/JhFormFields.md +0 -647
- package/src/components/JhFormList/JhFormList.md +0 -303
- package/src/components/JhJsonEditor/JhJsonEditor.md +0 -54
- package/src/components/JhLayout/JhLayout.md +0 -580
- package/src/components/JhList/JhList.md +0 -441
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.md +0 -56
- package/src/components/JhMask/JhMask.md +0 -62
- package/src/components/JhMenu/JhMenu.md +0 -85
- package/src/components/JhModal/JhModal.md +0 -68
- package/src/components/JhModalForm/JhModalForm.md +0 -69
- package/src/components/JhPageContainer/JhPageContainer.md +0 -409
- package/src/components/JhQueryFilter/JhQueryFilter.md +0 -77
- package/src/components/JhScene/JhScene.md +0 -64
- package/src/components/JhStatisticCard/JhStatisticCard.md +0 -363
- package/src/components/JhStepsForm/JhStepsForm.md +0 -666
- package/src/components/JhTable/JhTable.md +0 -730
- package/src/components/JhTableAttachment/JhTableAttachment.md +0 -70
- package/src/components/JhToast/JhToast.md +0 -67
- package/src/components/JhTreeSelect/JhTreeSelect.md +0 -82
- package/src/components/JhWaterMark/JhWaterMark.md +0 -190
- package/src/components/README.md +0 -52
|
@@ -74,11 +74,6 @@
|
|
|
74
74
|
</v-tooltip>
|
|
75
75
|
</div>
|
|
76
76
|
|
|
77
|
-
<!-- 额外提示信息 -->
|
|
78
|
-
<div v-if="field.extra" class="jh-field-extra text-caption grey--text mb-2">
|
|
79
|
-
{{ field.extra }}
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
77
|
<!-- 只读模式展示 -->
|
|
83
78
|
<div v-if="isFieldReadonly(field)" class="jh-form-readonly-text">
|
|
84
79
|
{{ getReadonlyValue(field) }}
|
|
@@ -168,6 +163,7 @@
|
|
|
168
163
|
:multiple="field.multiple"
|
|
169
164
|
:chips="field.chips"
|
|
170
165
|
:hide-details="field.hideDetails || hideDetails"
|
|
166
|
+
small-chips
|
|
171
167
|
v-bind="field.props"
|
|
172
168
|
@change="handleChange(field.key, $event)"
|
|
173
169
|
@blur="handleBlur(field.key, $event)"
|
|
@@ -591,13 +587,20 @@ export default {
|
|
|
591
587
|
|
|
592
588
|
watch: {
|
|
593
589
|
value: {
|
|
594
|
-
handler(
|
|
595
|
-
this.
|
|
590
|
+
handler() {
|
|
591
|
+
this.initValues();
|
|
596
592
|
},
|
|
597
593
|
immediate: true,
|
|
598
594
|
deep: true,
|
|
599
595
|
},
|
|
600
596
|
|
|
597
|
+
fields: {
|
|
598
|
+
handler() {
|
|
599
|
+
this.initValues();
|
|
600
|
+
},
|
|
601
|
+
deep: true,
|
|
602
|
+
},
|
|
603
|
+
|
|
601
604
|
dependencies: {
|
|
602
605
|
handler(newDeps) {
|
|
603
606
|
this.setupDependencyWatchers(newDeps);
|
|
@@ -912,7 +915,7 @@ export default {
|
|
|
912
915
|
.jh-form-fields--bordered {
|
|
913
916
|
border: 1px solid rgba(0, 0, 0, 0.12);
|
|
914
917
|
border-radius: 4px;
|
|
915
|
-
padding: 16px;
|
|
918
|
+
padding: 15px 16px 30px;
|
|
916
919
|
}
|
|
917
920
|
|
|
918
921
|
.jh-form-fields-header {
|
|
@@ -943,10 +946,37 @@ export default {
|
|
|
943
946
|
margin-bottom: 0 !important;
|
|
944
947
|
}
|
|
945
948
|
|
|
946
|
-
.jh-form-fields--readonly
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
949
|
+
.jh-form-fields--readonly {
|
|
950
|
+
/* 只读模式整体样式 */
|
|
951
|
+
.jh-field-label {
|
|
952
|
+
/* 只读模式下的标签样式 */
|
|
953
|
+
color: rgba(0, 0, 0, 0.65);
|
|
954
|
+
font-weight: 500;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
.jh-form-readonly-text {
|
|
958
|
+
/* 只读模式下的文本样式 */
|
|
959
|
+
padding: 6px 12px;
|
|
960
|
+
color: rgba(0, 0, 0, 0.87);
|
|
961
|
+
background-color: rgba(0, 0, 0, 0.04);
|
|
962
|
+
border-radius: 4px;
|
|
963
|
+
line-height: 1.5;
|
|
964
|
+
transition: all 0.2s ease;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/* 水平布局下的调整 */
|
|
968
|
+
&.jh-form-fields--horizontal {
|
|
969
|
+
.jh-field-wrapper {
|
|
970
|
+
margin-bottom: 16px;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
/* 垂直布局下的调整 */
|
|
975
|
+
&.jh-form-fields--vertical {
|
|
976
|
+
.jh-field-wrapper {
|
|
977
|
+
margin-bottom: 16px;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
950
980
|
}
|
|
951
981
|
|
|
952
982
|
.jh-field-label {
|
|
@@ -983,10 +1013,6 @@ export default {
|
|
|
983
1013
|
word-break: break-word;
|
|
984
1014
|
}
|
|
985
1015
|
|
|
986
|
-
.jh-field-extra {
|
|
987
|
-
margin-top: -8px;
|
|
988
|
-
line-height: 1.5;
|
|
989
|
-
}
|
|
990
1016
|
|
|
991
1017
|
.jh-color-preview {
|
|
992
1018
|
display: inline-block;
|
|
@@ -119,7 +119,7 @@ export default {
|
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
// 基础用法
|
|
122
|
-
export const
|
|
122
|
+
export const 基础用法 = {
|
|
123
123
|
render: (args) => ({
|
|
124
124
|
components: { JhModal },
|
|
125
125
|
data() {
|
|
@@ -194,7 +194,7 @@ export const Basic = {
|
|
|
194
194
|
};
|
|
195
195
|
|
|
196
196
|
// 全屏弹窗
|
|
197
|
-
export const
|
|
197
|
+
export const 全屏弹窗 = {
|
|
198
198
|
render: (args) => ({
|
|
199
199
|
components: { JhModal },
|
|
200
200
|
data() {
|
|
@@ -260,7 +260,7 @@ export const Fullscreen = {
|
|
|
260
260
|
};
|
|
261
261
|
|
|
262
262
|
// 自定义操作按钮
|
|
263
|
-
export const
|
|
263
|
+
export const 自定义操作按钮 = {
|
|
264
264
|
render: (args) => ({
|
|
265
265
|
components: { JhModal },
|
|
266
266
|
data() {
|
|
@@ -352,7 +352,7 @@ export const CustomActions = {
|
|
|
352
352
|
};
|
|
353
353
|
|
|
354
354
|
// 无操作区域
|
|
355
|
-
export const
|
|
355
|
+
export const 无操作区域 = {
|
|
356
356
|
render: (args) => ({
|
|
357
357
|
components: { JhModal },
|
|
358
358
|
data() {
|
|
@@ -416,7 +416,7 @@ export const NoActions = {
|
|
|
416
416
|
};
|
|
417
417
|
|
|
418
418
|
// 不同尺寸
|
|
419
|
-
export const
|
|
419
|
+
export const 不同尺寸 = {
|
|
420
420
|
render: (args) => ({
|
|
421
421
|
components: { JhModal },
|
|
422
422
|
data() {
|
|
@@ -525,7 +525,7 @@ export const DifferentSizes = {
|
|
|
525
525
|
};
|
|
526
526
|
|
|
527
527
|
// 非持久化弹窗
|
|
528
|
-
export const
|
|
528
|
+
export const 非持久化弹窗 = {
|
|
529
529
|
render: (args) => ({
|
|
530
530
|
components: { JhModal },
|
|
531
531
|
data() {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
>
|
|
11
11
|
<v-card>
|
|
12
12
|
<!-- 标题栏 -->
|
|
13
|
-
<v-card-title class="d-flex align-center justify-space-between pa-4
|
|
13
|
+
<v-card-title class="d-flex align-center justify-space-between pa-4 sticky top-0 z-10 bg-white darken-1">
|
|
14
14
|
<span class="text-h6">{{ title }}</span>
|
|
15
15
|
<v-btn
|
|
16
16
|
v-if="closable"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
>
|
|
9
9
|
<v-card>
|
|
10
10
|
<!-- 标题栏 -->
|
|
11
|
-
<v-card-title class="d-flex align-center justify-space-between pa-4">
|
|
11
|
+
<v-card-title class="d-flex align-center justify-space-between pa-4 sticky top-0 z-10 bg-white darken-1">
|
|
12
12
|
<span class="text-h6">{{ title }}</span>
|
|
13
13
|
<v-btn
|
|
14
14
|
v-if="closable"
|
|
@@ -101,6 +101,14 @@ export default {
|
|
|
101
101
|
control: 'boolean',
|
|
102
102
|
description: '是否显示选择框',
|
|
103
103
|
},
|
|
104
|
+
rowKey: {
|
|
105
|
+
control: 'text',
|
|
106
|
+
description: '行唯一标识字段,默认为 "id"',
|
|
107
|
+
},
|
|
108
|
+
itemKey: {
|
|
109
|
+
control: 'text',
|
|
110
|
+
description: 'rowKey 的别名,与 v-data-table API 保持一致',
|
|
111
|
+
},
|
|
104
112
|
size: {
|
|
105
113
|
control: 'select',
|
|
106
114
|
options: ['default', 'medium', 'compact'],
|
|
@@ -144,97 +152,51 @@ export default {
|
|
|
144
152
|
description: {
|
|
145
153
|
component: `
|
|
146
154
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
##
|
|
150
|
-
|
|
151
|
-
### 1.
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
- **全屏切换**:全屏显示表格(可选)
|
|
157
|
-
|
|
158
|
-
### 2. 列增强功能
|
|
159
|
-
- **copyable**:显示复制按钮,一键复制单元格内容
|
|
160
|
-
- **ellipsis**:超长文本自动省略,鼠标悬停显示完整内容
|
|
161
|
-
- **tooltip**:鼠标悬停提示
|
|
162
|
-
- **自定义插槽**:完全自定义列渲染
|
|
163
|
-
|
|
164
|
-
### 3. 操作列配置化
|
|
165
|
-
\`\`\`javascript
|
|
166
|
-
actionColumn: {
|
|
167
|
-
title: '操作',
|
|
168
|
-
width: 180,
|
|
169
|
-
fixed: 'right',
|
|
170
|
-
buttons: [
|
|
171
|
-
{
|
|
172
|
-
text: '编辑',
|
|
173
|
-
type: 'link', // link / icon / button
|
|
174
|
-
icon: 'mdi-pencil',
|
|
175
|
-
color: 'primary',
|
|
176
|
-
tooltip: '编辑记录',
|
|
177
|
-
onClick: (row) => { console.log('编辑', row) },
|
|
178
|
-
visible: (row) => row.status !== '禁用',
|
|
179
|
-
confirm: '确认编辑?'
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
text: '删除',
|
|
183
|
-
type: 'link',
|
|
184
|
-
icon: 'mdi-delete',
|
|
185
|
-
color: 'error',
|
|
186
|
-
onClick: (row) => { console.log('删除', row) },
|
|
187
|
-
confirm: '确认删除?'
|
|
188
|
-
}
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
\`\`\`
|
|
192
|
-
|
|
193
|
-
### 4. 服务端分页
|
|
194
|
-
通过 \`request\` prop 支持服务端分页:
|
|
195
|
-
\`\`\`javascript
|
|
196
|
-
async fetchData(params) {
|
|
197
|
-
// params: { page, pageSize, search, sorter, filters }
|
|
198
|
-
const response = await fetch('/api/users', {
|
|
199
|
-
method: 'POST',
|
|
200
|
-
body: JSON.stringify(params),
|
|
201
|
-
});
|
|
202
|
-
return {
|
|
203
|
-
data: response.list,
|
|
204
|
-
total: response.total,
|
|
205
|
-
success: true,
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
\`\`\`
|
|
155
|
+
增强版数据表格组件,深度继承 Vuetify 2 的 v-data-table,并提供 Pro 级功能。
|
|
156
|
+
|
|
157
|
+
## 核心特性
|
|
158
|
+
|
|
159
|
+
### 1. 深度继承
|
|
160
|
+
- **API 兼容**:支持 v-data-table 的所有 Props(如 \`show-expand\`、\`group-by\`、\`item-class\` 等)。
|
|
161
|
+
- **插槽透传**:支持所有原生插槽(如 \`top\`、\`footer\`、\`expanded-item\` 等)以及自定义列插槽 \`item.<value>\`。
|
|
162
|
+
- **事件透传**:支持所有原生事件(如 \`click:row\`、\`current-items\` 等)。
|
|
163
|
+
- **实例访问**:通过 \`getVDataTable()\` 获取底层 v-data-table 实例。
|
|
209
164
|
|
|
210
|
-
###
|
|
211
|
-
-
|
|
212
|
-
-
|
|
213
|
-
-
|
|
165
|
+
### 2. 工具栏与高级筛选
|
|
166
|
+
- **集成搜索**:工具栏内置全局搜索。
|
|
167
|
+
- **列设置**:支持运行时列显示/隐藏切换。
|
|
168
|
+
- **密度切换**:支持 default/medium/compact 三种视觉密度。
|
|
169
|
+
- **高级筛选**:可集成 JhQueryFilter 实现复杂的组合查询。
|
|
214
170
|
|
|
215
|
-
###
|
|
216
|
-
|
|
217
|
-
-
|
|
218
|
-
-
|
|
219
|
-
|
|
171
|
+
### 3. 列与单元格增强
|
|
172
|
+
- **Schema 渲染**:支持 \`valueType\` (status, progress, money, date, json 等) 自动化渲染。
|
|
173
|
+
- **交互功能**:支持 \`copyable\` (一键复制) 和 \`ellipsis\` (超长省略)。
|
|
174
|
+
- **操作列配置**:支持配置化的按钮列表,内置权限控制和二次确认。
|
|
175
|
+
|
|
176
|
+
### 4. 数据流控制
|
|
177
|
+
- **服务端分页**:通过 \`request\` 自动处理请求、分页、排序。
|
|
178
|
+
- **状态持久化**:支持列显示状态持久化。
|
|
220
179
|
|
|
221
180
|
## 方法
|
|
222
181
|
|
|
182
|
+
- \`getVDataTable()\`: 获取底层 v-data-table 实例
|
|
223
183
|
- \`reload()\`: 重新加载数据(服务端分页)
|
|
224
184
|
- \`reset()\`: 重置到第一页
|
|
225
185
|
- \`clearSelection()\`: 清空选择
|
|
226
186
|
- \`getSelectedRows()\`: 获取选中的行
|
|
227
187
|
|
|
228
|
-
## 事件
|
|
188
|
+
## 事件 (除 v-data-table 原生事件外)
|
|
229
189
|
|
|
230
190
|
- \`create-click\`: 点击新增按钮
|
|
231
|
-
- \`update-click\`:
|
|
232
|
-
- \`delete-click\`:
|
|
233
|
-
- \`row-click\`: 点击行(item, event)
|
|
191
|
+
- \`update-click\`: 点击详情按钮(针对 actionColumn 默认按钮)
|
|
192
|
+
- \`delete-click\`: 点击删除按钮(针对 actionColumn 默认按钮)
|
|
234
193
|
- \`selection-change\`: 选择改变 ({ selectedRowKeys, selectedRows })
|
|
235
|
-
- \`
|
|
236
|
-
- \`
|
|
237
|
-
- \`
|
|
194
|
+
- \`columns-state-change\`: 列状态改变 (snapshot)
|
|
195
|
+
- \`filter-search\`: 高级筛选查询
|
|
196
|
+
- \`filter-reset\`: 高级筛选重置
|
|
197
|
+
- \`sort-change\`: 排序改变
|
|
198
|
+
- \`copy-success\`: 复制成功 (text)
|
|
199
|
+
- \`request-error\`: 请求失败 (error)
|
|
238
200
|
`,
|
|
239
201
|
},
|
|
240
202
|
},
|
|
@@ -253,7 +215,7 @@ export const 基础示例 = {
|
|
|
253
215
|
showUpdateAction: true,
|
|
254
216
|
showDeleteAction: true,
|
|
255
217
|
showSelect: false,
|
|
256
|
-
size: '
|
|
218
|
+
size: 'medium',
|
|
257
219
|
},
|
|
258
220
|
render: (args) => ({
|
|
259
221
|
components: { JhTable },
|
|
@@ -857,16 +819,20 @@ export const 自定义列渲染 = {
|
|
|
857
819
|
<div>
|
|
858
820
|
<jh-table v-bind="args">
|
|
859
821
|
<!-- 自定义状态列 -->
|
|
860
|
-
<template v-slot:item.status="{ item }">
|
|
822
|
+
<template v-slot:item.status="{ item, index }">
|
|
861
823
|
<v-chip
|
|
862
824
|
:color="item.status === '启用' ? 'success' : 'error'"
|
|
863
825
|
small
|
|
864
826
|
label
|
|
865
827
|
>
|
|
866
|
-
<v-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
828
|
+
<v-badge
|
|
829
|
+
v-if="index === 0"
|
|
830
|
+
dot
|
|
831
|
+
inline
|
|
832
|
+
color="red"
|
|
833
|
+
class="mr-1"
|
|
834
|
+
></v-badge>
|
|
835
|
+
{{ item.status }} (索引: {{ index }})
|
|
870
836
|
</v-chip>
|
|
871
837
|
</template>
|
|
872
838
|
</jh-table>
|
|
@@ -1360,89 +1326,6 @@ export const 完整CRUD示例 = {
|
|
|
1360
1326
|
};
|
|
1361
1327
|
|
|
1362
1328
|
|
|
1363
|
-
export const SelectionAlertRender = {
|
|
1364
|
-
render: () => ({
|
|
1365
|
-
components: { JhTable },
|
|
1366
|
-
data() {
|
|
1367
|
-
return {
|
|
1368
|
-
headers: [
|
|
1369
|
-
{ text: '????', value: 'name' },
|
|
1370
|
-
{ text: '????', value: 'containers' },
|
|
1371
|
-
{ text: '????', value: 'calls' },
|
|
1372
|
-
{ text: '???', value: 'owner' },
|
|
1373
|
-
{ text: '????', value: 'createdAt' }
|
|
1374
|
-
],
|
|
1375
|
-
items: [
|
|
1376
|
-
{ id: 1, name: 'AppName-0', containers: 8, calls: 1276, owner: '???', createdAt: '2025-11-23' },
|
|
1377
|
-
{ id: 2, name: 'AppName-1', containers: 12, calls: 938, owner: '???', createdAt: '2025-11-23' },
|
|
1378
|
-
{ id: 3, name: 'AppName-2', containers: 1, calls: 820, owner: '???', createdAt: '2025-11-23' },
|
|
1379
|
-
{ id: 4, name: 'AppName-3', containers: 5, calls: 1291, owner: '???', createdAt: '2025-11-23' },
|
|
1380
|
-
{ id: 5, name: 'AppName-4', containers: 17, calls: 1796, owner: '???', createdAt: '2025-11-23' }
|
|
1381
|
-
]
|
|
1382
|
-
};
|
|
1383
|
-
},
|
|
1384
|
-
methods: {
|
|
1385
|
-
renderAlert(h, { selectedRows, onCleanSelected }) {
|
|
1386
|
-
const totalContainers = selectedRows.reduce((sum, row) => sum + row.containers, 0);
|
|
1387
|
-
const totalCalls = selectedRows.reduce((sum, row) => sum + row.calls, 0);
|
|
1388
|
-
return h(
|
|
1389
|
-
'div',
|
|
1390
|
-
{ class: 'd-flex align-center flex-wrap', style: { gap: '12px' } },
|
|
1391
|
-
[
|
|
1392
|
-
h('span', { class: 'font-weight-medium' }, `?? ${selectedRows.length} ?`),
|
|
1393
|
-
h(
|
|
1394
|
-
'v-btn',
|
|
1395
|
-
{
|
|
1396
|
-
props: { text: true, xSmall: true, color: 'primary' },
|
|
1397
|
-
on: { click: onCleanSelected }
|
|
1398
|
-
},
|
|
1399
|
-
'????'
|
|
1400
|
-
),
|
|
1401
|
-
h('span', { class: 'grey--text text--darken-1' }, `?????${totalContainers} ?`),
|
|
1402
|
-
h('span', { class: 'grey--text text--darken-1' }, `????${totalCalls} ?`)
|
|
1403
|
-
]
|
|
1404
|
-
);
|
|
1405
|
-
},
|
|
1406
|
-
renderAlertActions(h, { selectedRows }) {
|
|
1407
|
-
return h('div', { class: 'd-flex align-center', style: { gap: '8px' } }, [
|
|
1408
|
-
h(
|
|
1409
|
-
'v-btn',
|
|
1410
|
-
{
|
|
1411
|
-
props: { small: true, color: 'error' },
|
|
1412
|
-
on: { click: () => this.handleBatchDelete(selectedRows) }
|
|
1413
|
-
},
|
|
1414
|
-
'????'
|
|
1415
|
-
),
|
|
1416
|
-
h(
|
|
1417
|
-
'v-btn',
|
|
1418
|
-
{
|
|
1419
|
-
props: { small: true, outlined: true, color: 'primary' },
|
|
1420
|
-
on: { click: () => this.handleExport(selectedRows) }
|
|
1421
|
-
},
|
|
1422
|
-
'????'
|
|
1423
|
-
)
|
|
1424
|
-
]);
|
|
1425
|
-
},
|
|
1426
|
-
handleBatchDelete(rows) {
|
|
1427
|
-
alert(`???? ${rows.length} ?`);
|
|
1428
|
-
},
|
|
1429
|
-
handleExport(rows) {
|
|
1430
|
-
alert(`?? ${rows.length} ?`);
|
|
1431
|
-
}
|
|
1432
|
-
},
|
|
1433
|
-
template: `
|
|
1434
|
-
<jh-table
|
|
1435
|
-
:headers="headers"
|
|
1436
|
-
:items="items"
|
|
1437
|
-
show-select
|
|
1438
|
-
:toolbar="false"
|
|
1439
|
-
:table-alert-render="renderAlert"
|
|
1440
|
-
:table-alert-option-render="renderAlertActions"
|
|
1441
|
-
/>
|
|
1442
|
-
`
|
|
1443
|
-
})
|
|
1444
|
-
};
|
|
1445
|
-
|
|
1446
1329
|
// 受控服务端分页 (完全由父组件控制)
|
|
1447
1330
|
export const 受控服务端分页 = {
|
|
1448
1331
|
render: () => ({
|
|
@@ -1513,3 +1396,87 @@ export const 受控服务端分页 = {
|
|
|
1513
1396
|
`,
|
|
1514
1397
|
}),
|
|
1515
1398
|
};
|
|
1399
|
+
|
|
1400
|
+
// 原生插槽透传
|
|
1401
|
+
export const 原生插槽透传 = {
|
|
1402
|
+
render: () => ({
|
|
1403
|
+
components: { JhTable },
|
|
1404
|
+
data() {
|
|
1405
|
+
return {
|
|
1406
|
+
headers: sampleHeaders,
|
|
1407
|
+
items: sampleItems.slice(0, 5),
|
|
1408
|
+
};
|
|
1409
|
+
},
|
|
1410
|
+
template: `
|
|
1411
|
+
<jh-table :headers="headers" :items="items" header-title="原生插槽透传示例">
|
|
1412
|
+
<!-- 顶部插槽 -->
|
|
1413
|
+
<template v-slot:top>
|
|
1414
|
+
<v-toolbar flat color="blue lighten-4">
|
|
1415
|
+
<v-toolbar-title>这是 v-data-table 的 top 插槽</v-toolbar-title>
|
|
1416
|
+
<v-divider class="mx-4" inset vertical></v-divider>
|
|
1417
|
+
<v-spacer></v-spacer>
|
|
1418
|
+
<v-btn color="primary" dark class="mb-2">自定义按钮</v-btn>
|
|
1419
|
+
</v-toolbar>
|
|
1420
|
+
</template>
|
|
1421
|
+
|
|
1422
|
+
<!-- 底部插槽 -->
|
|
1423
|
+
<template v-slot:footer>
|
|
1424
|
+
<div class="pa-4 text-center grey lighten-3">
|
|
1425
|
+
这是 v-data-table 的 footer 插槽,可以放置汇总信息等
|
|
1426
|
+
</div>
|
|
1427
|
+
</template>
|
|
1428
|
+
|
|
1429
|
+
<!-- 自定义表头插槽 (原生方式) -->
|
|
1430
|
+
<template v-slot:header.username="{ header }">
|
|
1431
|
+
<span class="orange--text font-weight-bold italic">{{ header.text }} (自定义)</span>
|
|
1432
|
+
</template>
|
|
1433
|
+
</jh-table>
|
|
1434
|
+
`,
|
|
1435
|
+
}),
|
|
1436
|
+
};
|
|
1437
|
+
|
|
1438
|
+
// 原生实例访问
|
|
1439
|
+
export const 原生实例访问 = {
|
|
1440
|
+
render: () => ({
|
|
1441
|
+
components: { JhTable },
|
|
1442
|
+
data() {
|
|
1443
|
+
return {
|
|
1444
|
+
headers: sampleHeaders,
|
|
1445
|
+
items: sampleItems,
|
|
1446
|
+
};
|
|
1447
|
+
},
|
|
1448
|
+
template: `
|
|
1449
|
+
<div>
|
|
1450
|
+
<div class="mb-4">
|
|
1451
|
+
<v-btn @click="callNativeSelectAll" color="primary">通过 Ref 调用原生全选 (selectAll)</v-btn>
|
|
1452
|
+
<v-btn @click="checkNativeInstance" color="secondary" class="ml-2">检查原生实例</v-btn>
|
|
1453
|
+
</div>
|
|
1454
|
+
<jh-table
|
|
1455
|
+
ref="jhTableRef"
|
|
1456
|
+
:headers="headers"
|
|
1457
|
+
:items="items"
|
|
1458
|
+
show-select
|
|
1459
|
+
header-title="原生实例访问示例"
|
|
1460
|
+
/>
|
|
1461
|
+
</div>
|
|
1462
|
+
`,
|
|
1463
|
+
methods: {
|
|
1464
|
+
callNativeSelectAll() {
|
|
1465
|
+
const vDataTable = this.$refs.jhTableRef.getVDataTable();
|
|
1466
|
+
if (vDataTable) {
|
|
1467
|
+
// 注意:Vuetify 2.x 的 selectAll 可能需要特定参数或通过内部 toggle 实现
|
|
1468
|
+
// 这里演示获取实例并操作
|
|
1469
|
+
vDataTable.toggleSelectAll(true);
|
|
1470
|
+
alert('已通过 getVDataTable().toggleSelectAll(true) 触发全选');
|
|
1471
|
+
}
|
|
1472
|
+
},
|
|
1473
|
+
checkNativeInstance() {
|
|
1474
|
+
const vDataTable = this.$refs.jhTableRef.getVDataTable();
|
|
1475
|
+
console.log('原生 v-data-table 实例:', vDataTable);
|
|
1476
|
+
alert('实例已打印到控制台,构造函数名:' + vDataTable.$options.name);
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
}),
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1482
|
+
|