forked from vueComponent/ant-design-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
35 lines (30 loc) · 1.06 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { App, defineComponent, inject, Plugin } from 'vue';
import { defaultConfigProvider } from '../config-provider';
import ImageInternal from '../vc-image';
import { ImageProps, ImagePropsType } from '../vc-image/src/Image';
import PreviewGroup from './PreviewGroup';
const Image = defineComponent({
name: 'AImage',
inheritAttrs: false,
props: ImageProps,
setup(props, ctx) {
const { slots, attrs } = ctx;
const configProvider = inject('configProvider', defaultConfigProvider);
return () => {
const { getPrefixCls } = configProvider;
const prefixCls = getPrefixCls('image', props.prefixCls);
return <ImageInternal {...{ ...attrs, ...props, prefixCls }} v-slots={slots}></ImageInternal>;
};
},
});
export { ImageProps, ImagePropsType };
Image.PreviewGroup = PreviewGroup;
Image.install = function(app: App) {
app.component(Image.name, Image);
app.component(Image.PreviewGroup.name, Image.PreviewGroup);
return app;
};
export default Image as typeof Image &
Plugin & {
readonly PreviewGroup: typeof PreviewGroup;
};