You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

41 lines
835 B

2 years ago
import { DictTag } from '@/components/DictTag'
import { Image, Tag } from 'ant-design-vue'
import dayjs from 'dayjs'
import { h } from 'vue'
export const useRender = {
// 渲染图片
renderImg: (text) => {
if (text) {
return h(Image, {
src: text,
height: 80,
width: 80
})
}
},
renderTag: (text, color?) => {
if (!color) {
return h(Tag, { color }, () => text)
} else {
return h('span', text)
}
},
renderDate: (text, format?) => {
if (!format) {
return dayjs(text).format('YYYY-MM-DD HH:mm:ss')
} else {
return dayjs(text).format(format)
}
},
2 years ago
renderDict: (text, type, dictType?) => {
2 years ago
if (type) {
return h(DictTag, {
type: type,
2 years ago
value: text,
dictType: dictType || 'number'
2 years ago
})
}
}
}