2018-03-19 02:16:27 +00:00
|
|
|
|
2018-02-24 10:12:24 +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: {
|
|
|
|
validator (value) {
|
|
|
|
return ['small', 'large', 'default'].includes(value)
|
2017-10-26 07:18:08 +00:00
|
|
|
},
|
|
|
|
},
|
2018-01-29 10:57:20 +00:00
|
|
|
}
|
|
|
|
export { ButtonGroupProps }
|
|
|
|
export default {
|
2018-04-08 13:17:20 +00:00
|
|
|
name: 'AButtonGroup',
|
2018-01-29 10:57:20 +00:00
|
|
|
props: ButtonGroupProps,
|
2017-10-26 07:18:08 +00:00
|
|
|
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
|
|
|
}
|
2018-03-19 02:16:27 +00:00
|
|
|
|