使用 iview Table 表格组件修改操作的显示隐藏,如下图
如何设置 table 操作按后台传入的状态值去显示或隐藏按钮?
{
title: '操作',
align: 'center',
width: 120,
render: (h, params) => {
console.log('params='+JSON.stringify(params))
return h('div', [
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '5px',
display:(params.row.picNames==null)?"none":"inline-block",
},
on: { click: () => {
this.showPicModal(params.index)
}
}
}, '查看图像'),
])
}
}
params.row.picNames是后台给我的值,如果等于 null 这个按钮隐藏,否则显示,希望对你有帮助