admin-vben5/playground/src/views/examples/vxe-table/edit-cell.vue
Vben 2dbd323b2a
fix: fix the form-api reactive failure inside the form (#4590)
* fix: fix the form-api reactive failure inside the form
2024-10-08 22:43:02 +08:00

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>