2019-01-12 03:33:27 +00:00
|
|
|
import { filterEmpty } from '../_util/props-util';
|
2018-01-29 10:57:20 +00:00
|
|
|
const ButtonGroupProps = {
|
|
|
|
prefixCls: {
|
|
|
|
default: 'ant-btn-group',
|
|
|
|
type: String,
|
|
|
|
},
|
|
|
|
size: {
|
2019-01-12 03:33:27 +00:00
|
|
|
validator(value) {
|
|
|
|
return ['small', 'large', 'default'].includes(value);
|
2017-10-26 07:18:08 +00:00
|
|
|
},
|
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
|
|
|
export { ButtonGroupProps };
|
2018-01-29 10:57:20 +00:00
|
|
|
export default {
|
2018-04-08 13:17:20 +00:00
|
|
|
name: 'AButtonGroup',
|
2018-01-29 10:57:20 +00:00
|
|
|
props: ButtonGroupProps,
|
2019-01-12 03:33:27 +00:00
|
|
|
data() {
|
2017-10-26 07:18:08 +00:00
|
|
|
return {
|
|
|
|
sizeMap: {
|
|
|
|
large: 'lg',
|
|
|
|
small: 'sm',
|
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
2017-10-26 07:18:08 +00:00
|
|
|
},
|
|
|
|
computed: {
|
2019-01-12 03:33:27 +00:00
|
|
|
classes() {
|
|
|
|
const { prefixCls, size, sizeMap } = this;
|
|
|
|
const sizeCls = sizeMap[size] || '';
|
2017-10-26 07:18:08 +00:00
|
|
|
return [
|
|
|
|
{
|
|
|
|
[`${prefixCls}`]: true,
|
|
|
|
[`${prefixCls}-${sizeCls}`]: sizeCls,
|
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
];
|
2017-10-26 07:18:08 +00:00
|
|
|
},
|
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
render() {
|
|
|
|
const { classes, $slots } = this;
|
|
|
|
return <div class={classes}>{filterEmpty($slots.default)}</div>;
|
2018-01-24 07:39:21 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|