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