index.jsx 697 Bytes
Newer Older
wuhao's avatar
wuhao committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
import React, { useState } from 'react';
import { Popconfirm, Button } from 'antd';
import { useModel } from '@umijs/max';

function PremButton(props) {
  const { initialState, setInitialState } = useModel('@@initialState');
  const { children, btn, pop, access } = props;
  let accesses = access ? ['havePrem'].includes(access) : true;
  //配置按钮权限接口

  return pop ? (
    <Popconfirm {...pop} disabled={pop?.disabled || !accesses}>
      <Button {...btn} disabled={btn?.disabled || !accesses}>
        {children}
      </Button>
    </Popconfirm>
  ) : (
    <Button {...btn} disabled={btn?.disabled || !accesses}>
      {children}
    </Button>
  );
}

export default PremButton;