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.
ant-design-vue/components/button/button-group.jsx

48 lines
868 B

7 years ago
import { filterEmpty } from '../_util/props-util'
7 years ago
const ButtonGroupProps = {
prefixCls: {
default: 'ant-btn-group',
type: String,
},
size: {
validator (value) {
return ['small', 'large', 'default'].includes(value)
7 years ago
},
},
7 years ago
}
export { ButtonGroupProps }
export default {
name: 'ButtonGroup',
props: ButtonGroupProps,
7 years ago
data () {
return {
sizeMap: {
large: 'lg',
small: 'sm',
},
}
},
computed: {
classes () {
const { prefixCls, size, sizeMap } = this
const sizeCls = sizeMap[size] || ''
return [
{
[`${prefixCls}`]: true,
[`${prefixCls}-${sizeCls}`]: sizeCls,
},
]
},
},
7 years ago
render () {
const { classes, $slots } = this
return (
<div class={classes}>
{filterEmpty($slots.default)}
</div>
)
},
7 years ago
}