58 lines
1.3 KiB
Vue
58 lines
1.3 KiB
Vue
<script lang="ts" setup>
|
|
import type { VxeGridProps } from '#/adapter';
|
|
|
|
import { Page } from '@vben/common-ui';
|
|
|
|
import { useVbenVxeGrid } from '#/adapter';
|
|
import { getExampleTableApi } from '#/api';
|
|
|
|
interface RowType {
|
|
category: string;
|
|
color: string;
|
|
id: string;
|
|
price: string;
|
|
productName: string;
|
|
releaseDate: string;
|
|
}
|
|
|
|
const gridOptions: VxeGridProps<RowType> = {
|
|
columns: [
|
|
{ title: '序号', type: 'seq', width: 50 },
|
|
{ editRender: { name: 'input' }, field: 'category', title: 'Category' },
|
|
{ editRender: { name: 'input' }, field: 'color', title: 'Color' },
|
|
{
|
|
editRender: { name: 'input' },
|
|
field: 'productName',
|
|
title: 'Product Name',
|
|
},
|
|
{ field: 'price', title: 'Price' },
|
|
{ field: 'releaseDate', formatter: 'formatDateTime', title: 'Date' },
|
|
],
|
|
editConfig: {
|
|
mode: 'cell',
|
|
trigger: 'click',
|
|
},
|
|
height: 'auto',
|
|
pagerConfig: {},
|
|
proxyConfig: {
|
|
ajax: {
|
|
query: async ({ page }) => {
|
|
return await getExampleTableApi({
|
|
page: page.currentPage,
|
|
pageSize: page.pageSize,
|
|
});
|
|
},
|
|
},
|
|
},
|
|
showOverflow: true,
|
|
};
|
|
|
|
const [Grid] = useVbenVxeGrid({ gridOptions });
|
|
</script>
|
|
|
|
<template>
|
|
<Page auto-content-height>
|
|
<Grid />
|
|
</Page>
|
|
</template>
|