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/input/Group.jsx

42 lines
1.1 KiB

5 years ago
import PropTypes from '../_util/vue-types';
import { filterEmpty, getListeners } from '../_util/props-util';
6 years ago
import { ConfigConsumerProps } from '../config-provider';
7 years ago
export default {
name: 'AInputGroup',
7 years ago
props: {
5 years ago
prefixCls: PropTypes.string,
7 years ago
size: {
validator(value) {
return ['small', 'large', 'default'].includes(value);
7 years ago
},
},
compact: Boolean,
},
6 years ago
inject: {
configProvider: { default: () => ConfigConsumerProps },
6 years ago
},
7 years ago
computed: {
classes() {
6 years ago
const { prefixCls: customizePrefixCls, size, compact = false } = this;
const getPrefixCls = this.configProvider.getPrefixCls;
6 years ago
const prefixCls = getPrefixCls('input-group', customizePrefixCls);
7 years ago
return {
[`${prefixCls}`]: true,
[`${prefixCls}-lg`]: size === 'large',
[`${prefixCls}-sm`]: size === 'small',
[`${prefixCls}-compact`]: compact,
};
7 years ago
},
},
methods: {},
render() {
return (
<span class={this.classes} {...{ on: getListeners(this) }}>
{filterEmpty(this.$slots.default)}
</span>
);
},
};