ant-design-vue/components/button/button-group.vue
tangjinzhou f4f3a5ecbc fix md
2018-01-24 15:39:21 +08:00

46 lines
830 B
Vue

<script>
import { filterEmpty } from '../_util/vnode'
export default {
name: 'ButtonGroup',
props: {
prefixCls: {
default: 'ant-btn-group',
type: String,
},
size: {
validator (value) {
return ['small', 'large', 'default'].includes(value)
},
},
},
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>
)
},
}
</script>