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.
44 lines
1.2 KiB
44 lines
1.2 KiB
import type { App, ExtractPropTypes, ImgHTMLAttributes, Plugin } from 'vue';
|
|
import { defineComponent } from 'vue';
|
|
import ImageInternal from '../vc-image';
|
|
import { imageProps } from '../vc-image/src/Image';
|
|
import useConfigInject from '../_util/hooks/useConfigInject';
|
|
import PreviewGroup from './PreviewGroup';
|
|
|
|
export type ImageProps = Partial<
|
|
ExtractPropTypes<typeof imageProps> & Omit<ImgHTMLAttributes, 'placeholder' | 'onClick'>
|
|
>;
|
|
const Image = defineComponent<ImageProps>({
|
|
name: 'AImage',
|
|
inheritAttrs: false,
|
|
props: imageProps as any,
|
|
setup(props, { slots, attrs }) {
|
|
const { prefixCls } = useConfigInject('image', props);
|
|
return () => {
|
|
return (
|
|
<ImageInternal
|
|
{...{ ...attrs, ...props, prefixCls: prefixCls.value }}
|
|
v-slots={slots}
|
|
></ImageInternal>
|
|
);
|
|
};
|
|
},
|
|
});
|
|
|
|
export { imageProps };
|
|
|
|
Image.PreviewGroup = PreviewGroup;
|
|
|
|
Image.install = function (app: App) {
|
|
app.component(Image.name, Image);
|
|
app.component(Image.PreviewGroup.name, Image.PreviewGroup);
|
|
return app;
|
|
};
|
|
|
|
export { PreviewGroup as ImagePreviewGroup };
|
|
|
|
export default Image as typeof Image &
|
|
Plugin & {
|
|
readonly PreviewGroup: typeof PreviewGroup;
|
|
};
|