mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-10-07 10:21:41 +00:00
优化表格滚动设置,调整样式以提升用户体验
This commit is contained in:
@@ -37,9 +37,15 @@
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<a-table :rowKey="record => record.id" :columns="columns" :data-source="dataSource"
|
||||
:loading="tableLoading" :scroll="{ x: 500, y: 'calc(100vh - 500px)' }" :row-selection="rowSelection"
|
||||
:pagination="false" :style="{ minHeight: '500px' }">
|
||||
<!-- 树形表格 -->
|
||||
<a-table :rowKey="record => record.id"
|
||||
:columns="columns"
|
||||
:data-source="dataSource"
|
||||
:loading="tableLoading"
|
||||
:scroll="{ x: 500, y: 'calc(100vh - 500px)' }"
|
||||
:row-selection="rowSelection"
|
||||
:pagination="false"
|
||||
:style="{ minHeight: '500px' }">
|
||||
<template #bodyCell="{ column, record }">
|
||||
|
||||
<template v-if="column.dataIndex === 'action'">
|
||||
|
||||
@@ -38,7 +38,8 @@
|
||||
<a-card title="用户列表" :bordered="true" :headStyle="{ borderBottom: 'none', padding: '20px 24px' }"
|
||||
:bodyStyle="{ padding: '0 24px' }">
|
||||
<a-table :rowKey="record => record.id" :columns="columns" :data-source="dataSource" :loading="tableLoading"
|
||||
:row-selection="rowSelection" @change="handleTableChange" :scroll="{ x: 500, y: 'calc(100vh - 500px)' }"
|
||||
:row-selection="rowSelection" @change="handleTableChange"
|
||||
:scroll="{ x: 500 }"
|
||||
:pagination="pagination">
|
||||
<template v-slot:bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'index'">
|
||||
@@ -60,7 +61,7 @@
|
||||
import { ref, reactive, computed, unref } from 'vue';
|
||||
import type { TableColumnsType } from 'ant-design-vue';
|
||||
import { getUserList } from '@/api/system/user'
|
||||
import type { searchCreatorDataType, creatorTableDataType } from './types'
|
||||
import type { searchCreatorDataType, creatorType } from './types'
|
||||
|
||||
|
||||
const openModal = ref<boolean>(false);
|
||||
@@ -97,7 +98,7 @@ const columns: TableColumnsType = [
|
||||
width: 500
|
||||
}
|
||||
]
|
||||
const dataSource = ref<creatorTableDataType[]>([]);
|
||||
const dataSource = ref<creatorType[]>([]);
|
||||
|
||||
const loadingData = () => {
|
||||
tableLoading.value = true;
|
||||
@@ -154,10 +155,10 @@ const handleTableChange = (values: any) => {
|
||||
loadingData();
|
||||
}
|
||||
|
||||
const selectedRowKeys = ref<creatorTableDataType['id'][]>([]);
|
||||
const selectedRowName = ref<creatorTableDataType['name']>('');
|
||||
const selectedRowKeys = ref<creatorType['id'][]>([]);
|
||||
const selectedRowName = ref<creatorType['name']>('');
|
||||
|
||||
const onSelectChange = (selectingRowKeys: creatorTableDataType['id'][], selectingRows: creatorTableDataType[]) => {
|
||||
const onSelectChange = (selectingRowKeys: creatorType['id'][], selectingRows: creatorType[]) => {
|
||||
selectedRowKeys.value = selectingRowKeys;
|
||||
selectedRowName.value = selectingRows[0].name;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
:data-source="dataSource"
|
||||
:loading="tableLoading"
|
||||
@change="handleTableChange"
|
||||
:scroll="{ x: 500, y: 'calc(100vh - 500px)' }"
|
||||
:scroll="{ x: 500 }"
|
||||
:pagination="pagination"
|
||||
:style="{ minHeight: '500px' }">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
|
||||
@@ -57,12 +57,13 @@
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<a-table :rowKey="record => record.id"
|
||||
<a-table
|
||||
:rowKey="record => record.id"
|
||||
:columns="columns"
|
||||
:data-source="dataSource"
|
||||
:row-selection="rowSelection"
|
||||
:loading="tableLoading"
|
||||
:scroll="{ x: 500, y: 'calc(100vh - 500px)' }"
|
||||
:row-selection="rowSelection"
|
||||
:pagination="false"
|
||||
:style="{ minHeight: '500px' }"
|
||||
>
|
||||
|
||||
@@ -60,9 +60,14 @@
|
||||
</a-dropdown>
|
||||
|
||||
</template>
|
||||
<a-table :rowKey="record => record.id" :columns="columns" :data-source="dataSource"
|
||||
:row-selection="rowSelection" :loading="tableLoading" @change="handleTableChange"
|
||||
:scroll="{ x: 500, y: 'calc(100vh - 500px)' }" :pagination="pagination"
|
||||
<a-table :rowKey="record => record.id"
|
||||
:columns="columns"
|
||||
:data-source="dataSource"
|
||||
:row-selection="rowSelection"
|
||||
:loading="tableLoading"
|
||||
@change="handleTableChange"
|
||||
:scroll="{ x: 500 }"
|
||||
:pagination="pagination"
|
||||
:style="{ minHeight: '500px' }">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'index'">
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
:row-selection="rowSelection"
|
||||
:loading="tableLoading"
|
||||
@change="handleTableChange"
|
||||
:scroll="{ x: 500, y: 'calc(100vh - 500px)' }"
|
||||
:scroll="{ x: 500 }"
|
||||
:pagination="pagination"
|
||||
:style="{ minHeight: '500px' }">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
:data-source="menuTreeData"
|
||||
:row-selection="menuRowSelection"
|
||||
:loading="tableLoading"
|
||||
:scroll="{ x: 500, y: 'calc(100vh - 270px)' }"
|
||||
:scroll="{ x: 500 }"
|
||||
:pagination="false"
|
||||
:style="{ minHeight: '700px' }"
|
||||
:expandAll="true">
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
:row-selection="rowSelection"
|
||||
:loading="tableLoading"
|
||||
@change="handleTableChange"
|
||||
:scroll="{ x: 500, y: 'calc(100vh - 500px)' }"
|
||||
:scroll="{ x: 500 }"
|
||||
:pagination="pagination"
|
||||
:style="{ minHeight: '500px' }">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
|
||||
@@ -34,8 +34,14 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a-table :rowKey="record => record.id" :columns="columns" :data-source="dataSource" :row-selection="rowSelection"
|
||||
:loading="tableLoading" @change="handleTableChange" :scroll="{ x: 500, y: 330 }" :pagination="pagination"
|
||||
<a-table :rowKey="record => record.id"
|
||||
:columns="columns"
|
||||
:data-source="dataSource"
|
||||
:row-selection="rowSelection"
|
||||
:loading="tableLoading"
|
||||
@change="handleTableChange"
|
||||
:scroll="{ x: 500 }"
|
||||
:pagination="pagination"
|
||||
:style="{ minHeight: '330px' }">
|
||||
<template v-slot:bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'index'">
|
||||
|
||||
@@ -67,9 +67,15 @@
|
||||
</a-button>
|
||||
</a-dropdown>
|
||||
</template>
|
||||
<a-table :rowKey="record => record.id" :columns="columns" :data-source="dataSource"
|
||||
:row-selection="rowSelection" :loading="tableLoading" @change="handleTableChange"
|
||||
:scroll="{ x: 500, y: 'calc(100vh - 500px)' }" :pagination="pagination" :style="{ minHeight: '500px' }">
|
||||
<a-table :rowKey="record => record.id"
|
||||
:columns="columns"
|
||||
:data-source="dataSource"
|
||||
:row-selection="rowSelection"
|
||||
:loading="tableLoading"
|
||||
@change="handleTableChange"
|
||||
:scroll="{ x: 500 }"
|
||||
:pagination="pagination"
|
||||
:style="{ minHeight: '500px' }">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'index'">
|
||||
<span>{{ (pagination.current - 1) * pagination.pageSize + index + 1 }}</span>
|
||||
|
||||
Reference in New Issue
Block a user