在ant desiagn pro中提供了一个access用于对权限进行控制,需引入useAccess和 Access,
以下实例为对界面的按钮进行权限控制
//引入useAccess, Access
import { useAccess, Access } from 'umi';
function DataList() {
const access = useAccess();
const columns = [
{
title: '序号',
dataIndex: 'index',
width: '50px',
render: (text: string, record: any, index: number) => <span>{index + 1}</span>,
},
{
title: '类型',
dataIndex: 'integType',
width: '120px',
render: (text: string) => {
const string: any = integralType.find((item: any) => item.value === text);
return string ? string.title : '';
},
},
{
title: '名称',
dataIndex: 'paramName',
width: '120px',
},
{
title: '操作',
width: '120px',