vben
2020-11-28 de499a145556427304abe075b62e6869f44dc640
src/components/Table/src/components/TableAction.tsx
@@ -2,8 +2,8 @@
import { Dropdown, Menu, Popconfirm } from 'ant-design-vue';
import Icon from '/@/components/Icon/index';
import { DownOutlined } from '@ant-design/icons-vue';
import { ActionItem } from '../types/tableAction';
import Button from '/@/components/Button/index.vue';
import { ActionItem } from '/@/components/Table';
import { Button } from '/@/components/Button';
const prefixCls = 'basic-table-action';
export default defineComponent({
  name: 'TableAction',
@@ -24,13 +24,20 @@
  },
  setup(props) {
    function renderButton(action: ActionItem, index: number) {
      const { disabled = false, label, icon, color = '', type = 'link' } = action;
      const { disabled = false, label, icon, color = '', type = 'link', ...actionProps } = action;
      const button = (
        <Button type={type} size="small" disabled={disabled} color={color} {...action} key={index}>
        <Button
          type={type}
          size="small"
          disabled={disabled}
          color={color}
          {...actionProps}
          key={`${index}-${label}`}
        >
          {() => (
            <>
              {icon && <Icon icon={icon} class="mr-1" />}
              {label}
              {icon && <Icon icon={icon} />}
            </>
          )}
        </Button>
@@ -53,7 +60,7 @@
      } = popConfirm;
      return (
        <Popconfirm
          key={`P-${index}`}
          key={`p-${index}-${title}`}
          title={title}
          onConfirm={confirm}
          onCancel={cancel}
@@ -84,11 +91,12 @@
      const { dropDownActions = [], actions } = props;
      return (
        <div class={prefixCls}>
          {actions?.map((action, index) => {
            return renderPopConfirm(action, index);
          })}
          {dropDownActions?.length && (
            <Dropdown>
          {actions &&
            actions.map((action, index) => {
              return renderPopConfirm(action, index);
            })}
          {dropDownActions && dropDownActions.length && (
            <Dropdown overlayClassName="basic-tale-action-dropdown">
              {{
                default: dropdownDefaultSLot,
                overlay: () => {
@@ -98,6 +106,7 @@
                        default: () => {
                          return dropDownActions.map((action, index) => {
                            const { disabled = false } = action;
                            action.ghost = true;
                            return (
                              <Menu.Item key={`${index}`} disabled={disabled}>
                                {() => {