ant-design-vue/components/button/button-group.vue

46 lines
830 B
Vue
Raw Normal View History

2017-10-26 07:18:08 +00:00
<script>
2018-01-24 07:39:21 +00:00
import { filterEmpty } from '../_util/vnode'
2017-10-26 07:18:08 +00:00
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,
},
]
},
},
2018-01-24 07:39:21 +00:00
render () {
const { classes, $slots } = this
return (
<div class={classes}>
{filterEmpty($slots.default)}
</div>
)
},
2017-10-26 07:18:08 +00:00
}
</script>