mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-25 02:58:43 +08:00
perf(demo): 动态更换表格配置 (#2793)
This commit is contained in:
parent
0347c83620
commit
5de89b5ec5
@ -34,6 +34,7 @@
|
|||||||
import { getBasicColumns, getBasicShortColumns } from './tableData';
|
import { getBasicColumns, getBasicShortColumns } from './tableData';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import { demoListApi } from '/@/api/demo/table';
|
import { demoListApi } from '/@/api/demo/table';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { BasicTable },
|
components: { BasicTable },
|
||||||
setup() {
|
setup() {
|
||||||
@ -54,10 +55,22 @@
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
function changeColumns() {
|
function changeColumns() {
|
||||||
getTableAction().setColumns(getBasicShortColumns());
|
getTableAction().setProps({
|
||||||
|
columns: getBasicShortColumns(),
|
||||||
|
rowSelection: {
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
showIndexColumn: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function reloadTable() {
|
function reloadTable() {
|
||||||
getTableAction().setColumns(getBasicColumns());
|
getTableAction().setProps({
|
||||||
|
columns: getBasicColumns(),
|
||||||
|
rowSelection: {
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
showIndexColumn: true,
|
||||||
|
});
|
||||||
|
|
||||||
getTableAction().reload({
|
getTableAction().reload({
|
||||||
page: 1,
|
page: 1,
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
import { getBasicColumns, getBasicShortColumns } from './tableData';
|
import { getBasicColumns, getBasicShortColumns } from './tableData';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import { demoListApi } from '/@/api/demo/table';
|
import { demoListApi } from '/@/api/demo/table';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: { BasicTable },
|
components: { BasicTable },
|
||||||
setup() {
|
setup() {
|
||||||
@ -36,7 +37,7 @@
|
|||||||
registerTable,
|
registerTable,
|
||||||
{
|
{
|
||||||
setLoading,
|
setLoading,
|
||||||
setColumns,
|
setProps,
|
||||||
getColumns,
|
getColumns,
|
||||||
getDataSource,
|
getDataSource,
|
||||||
getRawDataSource,
|
getRawDataSource,
|
||||||
@ -76,11 +77,22 @@
|
|||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
function changeColumns() {
|
function changeColumns() {
|
||||||
setColumns(getBasicShortColumns());
|
setProps({
|
||||||
|
columns: getBasicShortColumns(),
|
||||||
|
rowSelection: {
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
showIndexColumn: true,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function reloadTable() {
|
function reloadTable() {
|
||||||
setColumns(getBasicColumns());
|
setProps({
|
||||||
|
columns: getBasicColumns(),
|
||||||
|
rowSelection: {
|
||||||
|
type: 'checkbox',
|
||||||
|
},
|
||||||
|
showIndexColumn: true,
|
||||||
|
});
|
||||||
reload({
|
reload({
|
||||||
page: 1,
|
page: 1,
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user