fix(image-group): props definition (#6621)

* fix(image-group): props definition

* feat: add ImageGroupProps type definition
This commit is contained in:
bqy_fe 2023-06-01 14:58:30 +08:00 committed by GitHub
parent 1001ff3834
commit 80edf86d18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 13 deletions

View File

@ -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));

View File

@ -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 = {