You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
844 B
42 lines
844 B
import { filterEmpty } from '../_util/props-util';
|
|
const ButtonGroupProps = {
|
|
prefixCls: {
|
|
default: 'ant-btn-group',
|
|
type: String,
|
|
},
|
|
size: {
|
|
validator(value) {
|
|
return ['small', 'large', 'default'].includes(value);
|
|
},
|
|
},
|
|
};
|
|
export { ButtonGroupProps };
|
|
export default {
|
|
name: 'AButtonGroup',
|
|
props: ButtonGroupProps,
|
|
data() {
|
|
return {
|
|
sizeMap: {
|
|
large: 'lg',
|
|
small: 'sm',
|
|
},
|
|
};
|
|
},
|
|
computed: {
|
|
classes() {
|
|
const { prefixCls, size, sizeMap } = this;
|
|
const sizeCls = sizeMap[size] || '';
|
|
return [
|
|
{
|
|
[`${prefixCls}`]: true,
|
|
[`${prefixCls}-${sizeCls}`]: sizeCls,
|
|
},
|
|
];
|
|
},
|
|
},
|
|
render() {
|
|
const { classes, $slots } = this;
|
|
return <div class={classes}>{filterEmpty($slots.default)}</div>;
|
|
},
|
|
};
|