From 7b2871ac72c562cc1c68e3243fb1270e904fe0c1 Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Tue, 22 Nov 2022 14:56:29 +0800 Subject: [PATCH] perf: vxe renderer --- .../src/plugins/vxeTable/renderer/html.tsx | 10 ++++++++++ .../vxeTable/renderer/{default.tsx => img.tsx} | 14 -------------- .../src/plugins/vxeTable/renderer/index.tsx | 3 ++- .../src/plugins/vxeTable/renderer/link.tsx | 15 +++++++++++++++ 4 files changed, 27 insertions(+), 15 deletions(-) create mode 100644 yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/html.tsx rename yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/{default.tsx => img.tsx} (55%) create mode 100644 yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/link.tsx diff --git a/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/html.tsx b/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/html.tsx new file mode 100644 index 000000000..46483a1c6 --- /dev/null +++ b/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/html.tsx @@ -0,0 +1,10 @@ +import { VXETable } from 'vxe-table' + +// 图片渲染 +VXETable.renderer.add('XHtml', { + // 默认显示模板 + renderDefault(_renderOpts, params) { + const { row, column } = params + return + } +}) diff --git a/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/default.tsx b/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/img.tsx similarity index 55% rename from yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/default.tsx rename to yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/img.tsx index ec30646d5..8b67e0ea7 100644 --- a/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/default.tsx +++ b/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/img.tsx @@ -1,19 +1,5 @@ import { VXETable } from 'vxe-table' -// 超链接渲染 -VXETable.renderer.add('XLink', { - // 默认显示模板 - renderDefault(renderOpts, params) { - const { row, column } = params - const { events = {} } = renderOpts - return ( - events.click(params)}> - {row[column.field]} - - ) - } -}) - // 图片渲染 VXETable.renderer.add('XImg', { // 默认显示模板 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 50a41bcbb..9e048dddd 100644 --- a/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/index.tsx +++ b/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/index.tsx @@ -1,3 +1,4 @@ import './dataTimePicker' import './dict' -import './default' +import './link' +import './img' diff --git a/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/link.tsx b/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/link.tsx new file mode 100644 index 000000000..84e1a5a14 --- /dev/null +++ b/yudao-ui-admin-vue3/src/plugins/vxeTable/renderer/link.tsx @@ -0,0 +1,15 @@ +import { VXETable } from 'vxe-table' + +// 超链接渲染 +VXETable.renderer.add('XLink', { + // 默认显示模板 + renderDefault(renderOpts, params) { + const { row, column } = params + const { events = {} } = renderOpts + return ( + events.click(params)}> + {row[column.field]} + + ) + } +})