浩晨众云网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
本篇文章给大家分享的是有关ant design vue中表格如何实现指定格式渲染,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。
渲染方法1:
指定渲染函数:
const columns = [ { title: '排名', dataIndex: 'key', customRender: renderContent // 渲染函数的规则 }, { title: '搜索关键词', dataIndex: 'keyword', customRender: (text, row, index) => { if (index < 4) { // 前4行数据以a标签的形式被渲染 return {text} } return { // 否则以独占4列的文本形式被渲染 children: text, attrs: { colSpan: 4 } } } } ] const renderContent = (value, row, index) => { const obj = { children: value, attrs: {} } return obj }