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

36 lines
906 B
Vue
Raw Normal View History

2020-03-28 15:52:26 +08:00
import LeftOutlined from '@ant-design/icons-vue/LeftOutlined';
import RightOutlined from '@ant-design/icons-vue/RightOutlined';
2019-01-12 11:33:27 +08:00
import Button from '../button';
2018-04-07 00:20:45 +08:00
2019-01-12 11:33:27 +08:00
function noop() {}
2018-04-07 00:20:45 +08:00
2020-07-19 22:40:35 +08:00
const Operation = (_, { attrs }) => {
const {
disabled,
moveToLeft = noop,
moveToRight = noop,
leftArrowText = '',
rightArrowText = '',
leftActive,
rightActive,
class: className,
style,
} = attrs;
2018-04-07 00:20:45 +08:00
2020-07-19 22:40:35 +08: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 11:33:27 +08:00
};
2020-07-19 22:40:35 +08:00
Operation.inheritAttrs = false;
export default Operation;