@yidun/antd-super-table 0.1.5 → 0.1.6
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 +9 -0
- package/dist/index.js +309 -305
- package/example/index.vue +51 -1
- package/package.json +1 -1
package/example/index.vue
CHANGED
|
@@ -20,7 +20,7 @@ const tableColumns: any = createTableColumns({
|
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
const setting = useLocalStorage('super-table-example-config', {
|
|
23
|
-
enableScene:
|
|
23
|
+
enableScene: true,
|
|
24
24
|
enableTableConfig: false,
|
|
25
25
|
sortable: false,
|
|
26
26
|
showRefreshButton: false,
|
|
@@ -34,6 +34,21 @@ const setting = useLocalStorage('super-table-example-config', {
|
|
|
34
34
|
formItemColSpan: 6,
|
|
35
35
|
})
|
|
36
36
|
|
|
37
|
+
// 默认场景配置
|
|
38
|
+
const defaultScene = {
|
|
39
|
+
name: '默认场景',
|
|
40
|
+
items: [
|
|
41
|
+
{
|
|
42
|
+
name: 'input',
|
|
43
|
+
value: '',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'select',
|
|
47
|
+
value: undefined,
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
}
|
|
51
|
+
|
|
37
52
|
// 表单项变更事件处理
|
|
38
53
|
function onFormItemChange(name: string, value: any, formItem: any, formOperations: any, tableOperations: any) {
|
|
39
54
|
console.log('form-item-change 事件触发:', {
|
|
@@ -139,6 +154,31 @@ const handleUpdateSelectOptions = () => {
|
|
|
139
154
|
setFormValue('select', 100)
|
|
140
155
|
}
|
|
141
156
|
|
|
157
|
+
// 清空缓存
|
|
158
|
+
const handleClearCache = () => {
|
|
159
|
+
Modal.confirm({
|
|
160
|
+
title: '提示',
|
|
161
|
+
content: '确定要清空所有 localStorage 缓存吗?此操作不可恢复。',
|
|
162
|
+
onOk: () => {
|
|
163
|
+
try {
|
|
164
|
+
localStorage.clear()
|
|
165
|
+
Modal.success({
|
|
166
|
+
title: '成功',
|
|
167
|
+
content: '缓存已清空,页面将自动刷新',
|
|
168
|
+
onOk: () => {
|
|
169
|
+
window.location.reload()
|
|
170
|
+
},
|
|
171
|
+
})
|
|
172
|
+
} catch (error) {
|
|
173
|
+
Modal.error({
|
|
174
|
+
title: '错误',
|
|
175
|
+
content: '清空缓存失败:' + (error as Error).message,
|
|
176
|
+
})
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
})
|
|
180
|
+
}
|
|
181
|
+
|
|
142
182
|
onMounted(() => {
|
|
143
183
|
handleUpdateSelectOptions()
|
|
144
184
|
|
|
@@ -247,6 +287,15 @@ onMounted(() => {
|
|
|
247
287
|
<a-radio :value="12">12</a-radio>
|
|
248
288
|
</a-radio-group>
|
|
249
289
|
</a-form-item>
|
|
290
|
+
<a-form-item>
|
|
291
|
+
<a-button
|
|
292
|
+
type="primary"
|
|
293
|
+
danger
|
|
294
|
+
@click="handleClearCache"
|
|
295
|
+
>
|
|
296
|
+
清空缓存
|
|
297
|
+
</a-button>
|
|
298
|
+
</a-form-item>
|
|
250
299
|
</a-form>
|
|
251
300
|
<super-table
|
|
252
301
|
ref="tableRef"
|
|
@@ -260,6 +309,7 @@ onMounted(() => {
|
|
|
260
309
|
:show-refresh-button="setting.showRefreshButton"
|
|
261
310
|
:show-expand-button="setting.showExpandButton"
|
|
262
311
|
:form-item-col-span="setting.formItemColSpan"
|
|
312
|
+
:default-scene="defaultScene"
|
|
263
313
|
:table-props="{
|
|
264
314
|
scroll: {
|
|
265
315
|
y: 600,
|