feat: add renderIcon

pull/5/MERGE
xingyu 2023-04-24 19:54:54 +08:00
parent 3274f757b9
commit 2f284d31c3
2 changed files with 7 additions and 3 deletions

View File

@ -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 })
}
}
}

View File

@ -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)
}
},
{