feat: add vxe renderer

This commit is contained in:
xingyu4j 2022-11-18 17:26:04 +08:00
parent b081bb8e71
commit aaab618493
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,32 @@
import { VXETable } from 'vxe-table'
// 超链接渲染
VXETable.renderer.add('XLink', {
// 默认显示模板
renderDefault(renderOpts, params) {
const { row, column } = params
const { events = {} } = renderOpts
return (
<a class="link" onClick={() => events.click(params)}>
{row[column.field]}
</a>
)
}
})
// 图片渲染
VXETable.renderer.add('XImg', {
// 默认显示模板
renderDefault(_renderOpts, params) {
const { row, column } = params
return (
<el-image
style="width: 80px; height: 50px"
src={row[column.field]}
key={row[column.field]}
fit="contain"
lazy
></el-image>
)
}
})

View File

@ -1,2 +1,3 @@
import './dataTimePicker'
import './dict'
import './default'