2020-10-12 19:19:10 +08:00
|
|
|
import { defineComponent, inject } from 'vue';
|
2019-01-12 11:33:27 +08:00
|
|
|
import PropTypes from '../_util/vue-types';
|
2020-09-30 10:47:18 +08:00
|
|
|
import { defaultConfigProvider } from '../config-provider';
|
2020-06-22 23:22:52 +08:00
|
|
|
import { getSlot } from '../_util/props-util';
|
2018-01-20 14:33:42 +08:00
|
|
|
|
2020-10-12 19:19:10 +08:00
|
|
|
export default defineComponent({
|
2018-04-08 21:17:20 +08:00
|
|
|
name: 'ACardGrid',
|
2018-09-05 21:28:54 +08:00
|
|
|
__ANT_CARD_GRID: true,
|
2018-01-20 14:33:42 +08:00
|
|
|
props: {
|
2019-09-10 18:57:08 +08:00
|
|
|
prefixCls: PropTypes.string,
|
2020-10-10 18:16:28 +08:00
|
|
|
hoverable: PropTypes.looseBool,
|
2018-01-20 14:33:42 +08:00
|
|
|
},
|
2020-06-22 23:22:52 +08:00
|
|
|
setup() {
|
|
|
|
return {
|
2020-09-30 10:47:18 +08:00
|
|
|
configProvider: inject('configProvider', defaultConfigProvider),
|
2020-06-22 23:22:52 +08:00
|
|
|
};
|
2019-03-13 21:32:14 +08:00
|
|
|
},
|
2019-01-12 11:33:27 +08:00
|
|
|
render() {
|
2020-03-07 19:45:13 +08:00
|
|
|
const { prefixCls: customizePrefixCls, hoverable = true } = this.$props;
|
2019-03-13 21:32:14 +08:00
|
|
|
|
2020-10-12 19:19:10 +08:00
|
|
|
const { getPrefixCls } = this.configProvider;
|
2019-03-13 21:32:14 +08:00
|
|
|
const prefixCls = getPrefixCls('card', customizePrefixCls);
|
|
|
|
|
2018-01-20 14:33:42 +08:00
|
|
|
const classString = {
|
|
|
|
[`${prefixCls}-grid`]: true,
|
2020-03-07 19:45:13 +08:00
|
|
|
[`${prefixCls}-grid-hoverable`]: hoverable,
|
2019-01-12 11:33:27 +08:00
|
|
|
};
|
2020-06-22 23:22:52 +08:00
|
|
|
return <div class={classString}>{getSlot(this)}</div>;
|
2018-01-20 14:33:42 +08:00
|
|
|
},
|
2020-10-12 19:19:10 +08:00
|
|
|
});
|