feat: add renderIcon
parent
3274f757b9
commit
2f284d31c3
|
@ -1,4 +1,5 @@
|
||||||
import { DictTag } from '@/components/DictTag'
|
import { DictTag } from '@/components/DictTag'
|
||||||
|
import Icon from '@/components/Icon'
|
||||||
import { Image, Tag } from 'ant-design-vue'
|
import { Image, Tag } from 'ant-design-vue'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { h } from 'vue'
|
import { h } from 'vue'
|
||||||
|
@ -58,5 +59,10 @@ export const useRender = {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
|
},
|
||||||
|
renderIcon: (text) => {
|
||||||
|
if (text) {
|
||||||
|
return h(Icon, { icon: text })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
import Icon from '@/components/Icon'
|
|
||||||
import { listSimpleMenus } from '@/api/system/menu'
|
import { listSimpleMenus } from '@/api/system/menu'
|
||||||
import { BasicColumn, FormSchema, useRender } from '@/components/Table'
|
import { BasicColumn, FormSchema, useRender } from '@/components/Table'
|
||||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
||||||
import { SystemMenuTypeEnum } from '@/enums/systemEnum'
|
import { SystemMenuTypeEnum } from '@/enums/systemEnum'
|
||||||
import { h } from 'vue'
|
|
||||||
|
|
||||||
export const columns: BasicColumn[] = [
|
export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
|
@ -25,7 +23,7 @@ export const columns: BasicColumn[] = [
|
||||||
dataIndex: 'icon',
|
dataIndex: 'icon',
|
||||||
width: 60,
|
width: 60,
|
||||||
customRender: ({ record }) => {
|
customRender: ({ record }) => {
|
||||||
return h(Icon, { icon: record.icon })
|
return useRender.renderIcon(record.icon)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue