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 2a510c3877..744e46c341 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 0000000000..3cb1270b7b --- /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 509de4f480..cc05160144 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' } } },