mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 11:09:20 +08:00
refactor: 重构电商模块目录结构
This commit is contained in:
@@ -56,6 +56,7 @@ const gridOptions: VxeGridProps<any> = {
|
||||
height: 'auto',
|
||||
border: true,
|
||||
stripe: true,
|
||||
highlightHoverRow: true,
|
||||
showOverflow: true,
|
||||
size: 'small',
|
||||
data: [],
|
||||
@@ -83,18 +84,47 @@ const gridOptions: VxeGridProps<any> = {
|
||||
| 'Total'
|
||||
)[],
|
||||
},
|
||||
// 配置远程加载,实现真正的分页
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }) => {
|
||||
// 如果没有数据,返回空
|
||||
if (csvData.value.length === 0) {
|
||||
return {
|
||||
items: [],
|
||||
total: 0,
|
||||
};
|
||||
}
|
||||
|
||||
// 计算分页参数
|
||||
const currentPage = page.currentPage || 1;
|
||||
const pageSize = page.pageSize || 50;
|
||||
const startIndex = (currentPage - 1) * pageSize;
|
||||
const endIndex = startIndex + pageSize;
|
||||
|
||||
// 从 csvData 中截取当前页的数据
|
||||
const pageData = csvData.value.slice(startIndex, endIndex);
|
||||
|
||||
return {
|
||||
items: pageData,
|
||||
total: csvData.value.length,
|
||||
};
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const [Grid, gridApi] = useVbenVxeGrid({
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
// 更新表格数据和列
|
||||
// 更新表格列配置(不再更新 data,data 由 proxyConfig 管理)
|
||||
const updateTable = () => {
|
||||
gridApi.setGridOptions({
|
||||
columns: gridColumns.value,
|
||||
data: csvData.value,
|
||||
});
|
||||
// 触发重新加载数据
|
||||
gridApi.reload();
|
||||
};
|
||||
|
||||
// 处理文件上传
|
||||
|
||||
Reference in New Issue
Block a user