diff --git a/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/index.tsx b/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/index.tsx index 2a510c387..744e46c34 100644 --- a/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/index.tsx +++ b/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/index.tsx @@ -4,3 +4,4 @@ import './dict' import './html' import './link' import './img' +import './preview' diff --git a/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/preview.tsx b/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/preview.tsx new file mode 100644 index 000000000..3cb1270b7 --- /dev/null +++ b/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/preview.tsx @@ -0,0 +1,34 @@ +import { VXETable } from 'vxe-table' +import { ElImage, ElLink } from 'element-plus' + +// 图片渲染 +VXETable.renderer.add('XPreview', { + // 默认显示模板 + renderDefault(_renderOpts, params) { + const { row, column } = params + if (row.type.indexOf('image/') === 0) { + return ( + + ) + } else if (row.type.indexOf('video/') === 0) { + return ( + + ) + } else { + return ( + + {row[column.field]} + + ) + } + } +}) diff --git a/yudao-ui-admin-vue3/src/views/infra/fileList/fileList.data.ts b/yudao-ui-admin-vue3/src/views/infra/fileList/fileList.data.ts index 509de4f48..cc0516014 100644 --- a/yudao-ui-admin-vue3/src/views/infra/fileList/fileList.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/fileList/fileList.data.ts @@ -23,7 +23,7 @@ const crudSchemas = reactive({ field: 'url', table: { cellRender: { - name: 'XImg' + name: 'XPreview' } } },