| | |
| | | import Icon from '/@/components/Icon/index'; |
| | | import { DownOutlined } from '@ant-design/icons-vue'; |
| | | import { ActionItem } from '/@/components/Table'; |
| | | import Button from '/@/components/Button/index.vue'; |
| | | import { Button } from '/@/components/Button'; |
| | | const prefixCls = 'basic-table-action'; |
| | | export default defineComponent({ |
| | | name: 'TableAction', |
| | |
| | | }, |
| | | 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 as any} |
| | | type={type} |
| | | size="small" |
| | | disabled={disabled} |
| | | color={color} |
| | | {...action} |
| | | key={index} |
| | | {...actionProps} |
| | | key={`${index}-${label}`} |
| | | > |
| | | {() => ( |
| | | <> |
| | | {icon && <Icon icon={icon} class="mr-1" />} |
| | | {label} |
| | | {icon && <Icon icon={icon} />} |
| | | </> |
| | | )} |
| | | </Button> |
| | |
| | | } = popConfirm; |
| | | return ( |
| | | <Popconfirm |
| | | key={`P-${index}`} |
| | | key={`p-${index}-${title}`} |
| | | title={title} |
| | | onConfirm={confirm} |
| | | onCancel={cancel} |
| | |
| | | return renderPopConfirm(action, index); |
| | | })} |
| | | {dropDownActions && dropDownActions.length && ( |
| | | <Dropdown> |
| | | <Dropdown overlayClassName="basic-tale-action-dropdown"> |
| | | {{ |
| | | default: dropdownDefaultSLot, |
| | | overlay: () => { |
| | |
| | | default: () => { |
| | | return dropDownActions.map((action, index) => { |
| | | const { disabled = false } = action; |
| | | action.ghost = true; |
| | | return ( |
| | | <Menu.Item key={`${index}`} disabled={disabled}> |
| | | {() => { |