mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-11-30 02:57:50 +08:00
fix(image-group): props definition (#6621)
* fix(image-group): props definition * feat: add ImageGroupProps type definition
This commit is contained in:
parent
1001ff3834
commit
80edf86d18
@ -1,4 +1,5 @@
|
||||
import PreviewGroup from '../vc-image/src/PreviewGroup';
|
||||
import PreviewGroup, { imageGroupProps } from '../vc-image/src/PreviewGroup';
|
||||
import type { ExtractPropTypes } from 'vue';
|
||||
import { computed, defineComponent } from 'vue';
|
||||
import useConfigInject from '../_util/hooks/useConfigInject';
|
||||
|
||||
@ -20,11 +21,13 @@ export const icons = {
|
||||
right: <RightOutlined />,
|
||||
};
|
||||
|
||||
export type ImageGroupProps = Partial<ExtractPropTypes<ReturnType<typeof imageGroupProps>>>;
|
||||
|
||||
const InternalPreviewGroup = defineComponent({
|
||||
compatConfig: { MODE: 3 },
|
||||
name: 'AImagePreviewGroup',
|
||||
inheritAttrs: false,
|
||||
props: { previewPrefixCls: String },
|
||||
props: imageGroupProps(),
|
||||
setup(props, { attrs, slots }) {
|
||||
const { getPrefixCls } = useConfigInject('image', props);
|
||||
const prefixCls = computed(() => getPrefixCls('image-preview', props.previewPrefixCls));
|
||||
|
@ -56,21 +56,23 @@ export const context = {
|
||||
},
|
||||
};
|
||||
|
||||
export const imageGroupProps = () => ({
|
||||
previewPrefixCls: String,
|
||||
preview: {
|
||||
type: [Boolean, Object] as PropType<boolean | ImagePreviewType>,
|
||||
default: true as boolean | ImagePreviewType,
|
||||
},
|
||||
icons: {
|
||||
type: Object as PropType<PreviewProps['icons']>,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
|
||||
const Group = defineComponent({
|
||||
compatConfig: { MODE: 3 },
|
||||
name: 'PreviewGroup',
|
||||
inheritAttrs: false,
|
||||
props: {
|
||||
previewPrefixCls: String,
|
||||
preview: {
|
||||
type: [Boolean, Object] as PropType<boolean | ImagePreviewType>,
|
||||
default: true as boolean | ImagePreviewType,
|
||||
},
|
||||
icons: {
|
||||
type: Object as PropType<PreviewProps['icons']>,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
props: imageGroupProps(),
|
||||
setup(props, { slots }) {
|
||||
const preview = computed<PreviewGroupPreview>(() => {
|
||||
const defaultValues = {
|
||||
|
Loading…
Reference in New Issue
Block a user