diff --git a/src/components/Table/src/hooks/useRender.ts b/src/components/Table/src/hooks/useRender.ts index 85d04903..5ac41366 100644 --- a/src/components/Table/src/hooks/useRender.ts +++ b/src/components/Table/src/hooks/useRender.ts @@ -1,4 +1,5 @@ import { DictTag } from '@/components/DictTag' +import Icon from '@/components/Icon' import { Image, Tag } from 'ant-design-vue' import dayjs from 'dayjs' import { h } from 'vue' @@ -58,5 +59,10 @@ export const useRender = { }) } return '' + }, + renderIcon: (text) => { + if (text) { + return h(Icon, { icon: text }) + } } } diff --git a/src/views/system/menu/menu.data.ts b/src/views/system/menu/menu.data.ts index 3080de04..457e1112 100644 --- a/src/views/system/menu/menu.data.ts +++ b/src/views/system/menu/menu.data.ts @@ -1,9 +1,7 @@ -import Icon from '@/components/Icon' import { listSimpleMenus } from '@/api/system/menu' import { BasicColumn, FormSchema, useRender } from '@/components/Table' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { SystemMenuTypeEnum } from '@/enums/systemEnum' -import { h } from 'vue' export const columns: BasicColumn[] = [ { @@ -25,7 +23,7 @@ export const columns: BasicColumn[] = [ dataIndex: 'icon', width: 60, customRender: ({ record }) => { - return h(Icon, { icon: record.icon }) + return useRender.renderIcon(record.icon) } }, {