mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-02 12:07:54 +08:00
40 lines
1.0 KiB
Vue
40 lines
1.0 KiB
Vue
import { inject } from 'vue';
|
|
import PropTypes from '../_util/vue-types';
|
|
import { getSlot } from '../_util/props-util';
|
|
import { defaultConfigProvider } from '../config-provider';
|
|
|
|
export default {
|
|
name: 'AInputGroup',
|
|
props: {
|
|
prefixCls: PropTypes.string,
|
|
size: {
|
|
validator(value) {
|
|
return ['small', 'large', 'default'].includes(value);
|
|
},
|
|
},
|
|
compact: PropTypes.looseBool,
|
|
},
|
|
setup() {
|
|
return {
|
|
configProvider: inject('configProvider', defaultConfigProvider),
|
|
};
|
|
},
|
|
computed: {
|
|
classes() {
|
|
const { prefixCls: customizePrefixCls, size, compact = false } = this;
|
|
const getPrefixCls = this.configProvider.getPrefixCls;
|
|
const prefixCls = getPrefixCls('input-group', customizePrefixCls);
|
|
|
|
return {
|
|
[`${prefixCls}`]: true,
|
|
[`${prefixCls}-lg`]: size === 'large',
|
|
[`${prefixCls}-sm`]: size === 'small',
|
|
[`${prefixCls}-compact`]: compact,
|
|
};
|
|
},
|
|
},
|
|
render() {
|
|
return <span class={this.classes}>{getSlot(this)}</span>;
|
|
},
|
|
};
|