ant-design-vue/components/input/Group.jsx

37 lines
818 B
Vue
Raw Normal View History

2019-01-12 03:33:27 +00:00
import { filterEmpty } from '../_util/props-util';
2017-12-06 10:54:20 +00:00
export default {
2018-04-08 13:17:20 +00:00
name: 'AInputGroup',
2017-12-06 10:54:20 +00:00
props: {
prefixCls: {
default: 'ant-input-group',
type: String,
},
size: {
2019-01-12 03:33:27 +00:00
validator(value) {
return ['small', 'large', 'default'].includes(value);
2017-12-06 10:54:20 +00:00
},
},
compact: Boolean,
},
computed: {
2019-01-12 03:33:27 +00:00
classes() {
const { prefixCls, size, compact = false } = this;
2017-12-06 10:54:20 +00:00
return {
[`${prefixCls}`]: true,
[`${prefixCls}-lg`]: size === 'large',
[`${prefixCls}-sm`]: size === 'small',
[`${prefixCls}-compact`]: compact,
2019-01-12 03:33:27 +00:00
};
2017-12-06 10:54:20 +00:00
},
},
2019-01-12 03:33:27 +00:00
methods: {},
render() {
const { $listeners } = this;
2018-03-19 01:43:31 +00:00
return (
2019-01-12 03:33:27 +00:00
<span class={this.classes} {...{ on: $listeners }}>
{filterEmpty(this.$slots.default)}
2018-03-19 01:43:31 +00:00
</span>
2019-01-12 03:33:27 +00:00
);
2018-03-19 01:43:31 +00:00
},
2019-01-12 03:33:27 +00:00
};