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.tsx

37 lines
1.1 KiB

import { defineComponent, inject } from 'vue';
5 years ago
import PropTypes from '../_util/vue-types';
import { getSlot } from '../_util/props-util';
import { defaultConfigProvider } from '../config-provider';
import { tuple } from '../_util/type';
6 years ago
export default defineComponent({
name: 'AInputGroup',
7 years ago
props: {
5 years ago
prefixCls: PropTypes.string,
size: PropTypes.oneOf(tuple('small', 'large', 'default')),
compact: PropTypes.looseBool,
7 years ago
},
setup() {
return {
configProvider: inject('configProvider', defaultConfigProvider),
};
6 years ago
},
7 years ago
computed: {
classes() {
const { prefixCls: customizePrefixCls, size, compact = false, configProvider } = this as any;
const getPrefixCls = 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
},
},
render() {
return <span class={this.classes}>{getSlot(this)}</span>;
},
});