Skip to content

Bug: useTable里设置size:'small'结果项目里用到的basicTable全都成了small #4001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
5 tasks done
caidc opened this issue Aug 2, 2024 · 0 comments
Closed
5 tasks done
Labels

Comments

@caidc
Copy link

caidc commented Aug 2, 2024

Version

Vben Admin

Describe the bug?

useTable里设置size:'small'结果项目里用到的basicTable全都成了small
KE{ H{~(8R9SWBWFD5QN9

Reproduction

`

还原 开启loading 更改Columns 获取Columns 获取表格数据 获取接口原始数据 跳转到第2页
获取选中行 获取选中行Key 设置选中行 清空选中行 获取分页信息
<script lang="ts" setup> import { BasicTable, ColumnChangeParam, useTable } from '@/components/Table'; import { getBasicColumns, getBasicShortColumns } from './tableData'; import { useMessage } from '@/hooks/web/useMessage'; import { demoListApi } from '@/api/demo/table';

const { createMessage } = useMessage();
function onChange() {
console.log('onChange', arguments);
}
const [
registerTable,
{
setLoading,
setProps,
getColumns,
getDataSource,
getRawDataSource,
reload,
getPaginationRef,
setPagination,
getSelectRows,
getSelectRowKeys,
setSelectedRowKeys,
clearSelectedRowKeys,
},
] = useTable({
canResize: true,
title: 'useTable示例',
titleHelpMessage: '使用useTable调用表格内方法',
api: demoListApi,
columns: getBasicColumns(),
defSort: {
field: 'name',
order: 'ascend',
},
rowKey: 'id',
showTableSetting: true,
onChange,
rowSelection: {
type: 'checkbox',
},
onColumnsChange: (data: ColumnChangeParam[]) => {
console.log('ColumnsChanged', data);
},
showSelectionBar: true, // 显示多选状态栏
size: 'small',
});

function changeLoading() {
setLoading(true);
setTimeout(() => {
setLoading(false);
}, 1000);
}
function changeColumns() {
setProps({
columns: getBasicShortColumns(),
rowSelection: {
type: 'checkbox',
},
showIndexColumn: true,
});
}
function reloadTable() {
setProps({
columns: getBasicColumns(),
rowSelection: {
type: 'checkbox',
},
showIndexColumn: true,
});
reload({
page: 1,
});
}
function getColumn() {
createMessage.info('请在控制台查看!');
console.log(getColumns());
}

function getTableData() {
createMessage.info('请在控制台查看!');
console.log(getDataSource());
}

function getTableRawData() {
createMessage.info('请在控制台查看!');
console.log(getRawDataSource());
}

function getPagination() {
createMessage.info('请在控制台查看!');
console.log(getPaginationRef());
}

function setPaginationInfo() {
setPagination({
current: 2,
});
reload();
}
function getSelectRowList() {
createMessage.info('请在控制台查看!');
console.log(getSelectRows());
}
function getSelectRowKeyList() {
createMessage.info('请在控制台查看!');
console.log(getSelectRowKeys());
}
function setSelectedRowKeyList() {
setSelectedRowKeys(['0', '1', '2']);
}
function clearSelect() {
clearSelectedRowKeys();
}
</script>

`

System Info

System:
    OS: Windows 11 10.0.26120
    CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
    Memory: 2.91 GB / 15.87 GB
  Binaries:
    Node: 20.12.2 - C:\Program Files\nodejs\node.EXE
    npm: 10.5.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.6.0 - ~\AppData\Local\pnpm\pnpm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.31)
    Internet Explorer: 11.0.26100.1

Relevant log output

No response

Validations

@likui628 likui628 added the v2 label Aug 2, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants