ant-design-vue/components/transfer/operation.jsx

36 lines
906 B
Vue
Raw Normal View History

2020-03-28 07:52:26 +00:00
import LeftOutlined from '@ant-design/icons-vue/LeftOutlined';
import RightOutlined from '@ant-design/icons-vue/RightOutlined';
2019-01-12 03:33:27 +00:00
import Button from '../button';
2018-04-06 16:20:45 +00:00
2019-01-12 03:33:27 +00:00
function noop() {}
2018-04-06 16:20:45 +00:00
2020-07-19 14:40:35 +00:00
const Operation = (_, { attrs }) => {
const {
disabled,
moveToLeft = noop,
moveToRight = noop,
leftArrowText = '',
rightArrowText = '',
leftActive,
rightActive,
class: className,
style,
} = attrs;
2018-04-06 16:20:45 +00:00
2020-07-19 14:40:35 +00:00
return (
<div class={className} style={style}>
<Button type="primary" size="small" disabled={disabled || !rightActive} onClick={moveToRight}>
<RightOutlined slot="icon" />
{rightArrowText}
</Button>
<Button type="primary" size="small" disabled={disabled || !leftActive} onClick={moveToLeft}>
<LeftOutlined slot="icon" />
{leftArrowText}
</Button>
</div>
);
2019-01-12 03:33:27 +00:00
};
2020-07-19 14:40:35 +00:00
Operation.inheritAttrs = false;
export default Operation;