fix: 冲突解决
This commit is contained in:
@@ -6,6 +6,7 @@ import { nextTick, onMounted, watch } from 'vue';
|
||||
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
|
||||
|
||||
import { useImageGridColumns } from './data';
|
||||
import { $t } from '@vben/locales';
|
||||
|
||||
const props = defineProps<{
|
||||
list: MpMaterialApi.Material[];
|
||||
@@ -14,6 +15,7 @@ const props = defineProps<{
|
||||
|
||||
const emit = defineEmits<{
|
||||
delete: [v: number];
|
||||
refresh: [];
|
||||
}>();
|
||||
|
||||
const columns = useImageGridColumns();
|
||||
@@ -35,6 +37,21 @@ const [Grid, gridApi] = useVbenVxeGrid<MpMaterialApi.Material>({
|
||||
refresh: true,
|
||||
},
|
||||
showOverflow: 'tooltip',
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async () => {
|
||||
// 数据由父组件管理,触发刷新事件后返回当前数据
|
||||
emit('refresh');
|
||||
// 返回当前数据,避免覆盖
|
||||
return {
|
||||
list: Array.isArray(props.list) ? props.list : [],
|
||||
total: props.list?.length || 0,
|
||||
};
|
||||
},
|
||||
},
|
||||
enabled: true,
|
||||
autoLoad: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -53,7 +70,7 @@ watch(
|
||||
await nextTick();
|
||||
updateGridData(data);
|
||||
},
|
||||
{ flush: 'post' },
|
||||
{ immediate: true, flush: 'post' },
|
||||
);
|
||||
|
||||
watch(
|
||||
@@ -89,7 +106,7 @@ onMounted(async () => {
|
||||
<TableAction
|
||||
:actions="[
|
||||
{
|
||||
label: '删除',
|
||||
label: $t('common.delete'),
|
||||
type: 'link',
|
||||
danger: true,
|
||||
icon: ACTION_ICON.DELETE,
|
||||
|
||||
Reference in New Issue
Block a user