ant-design-vue/components/image/index.tsx
Zou Jian 5913cf9c5c
feat: add image (#3235)
* feat: 🆕 image组件 - 添加样式

* feat: 🆕 增加 AImage 组件

* feat: 🆕 参考 ant-design 增加 相关 Image 组件的less定义

* feat: 🆕 Image placeholder 的修改

* fix: 🐞 去除 onPreviewClose 相关

* test: 🧪 image width/height 以及相关测试

* fix: 🐞 fix lint no-setup-props-destructure

* test: 🧪 image test snap file

* refactor: 💡 去掉多加了的文件,重构文件以使逻辑清晰

* feat: 🆕 rc-image 相关内容 列入 vc-image 文件夹中

* feat: 🆕 antd 4.9.1 增加 image-preview-group

* feat: 🆕 add ImagePropsType

* feat: udpate image components

* feat: update image

* feat: update image

Co-authored-by: tanjinzhou <415800467@qq.com>
2020-12-18 18:02:51 +08:00

36 lines
1.1 KiB
Vue

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;
};