Skip to content

Commit

Permalink
fix(image-viewer): props类型检测
Browse files Browse the repository at this point in the history
closed #1402
  • Loading branch information
sinbadmaster committed Sep 2, 2022
1 parent 5c2bd95 commit eea371f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/image-viewer/base/ImageViewerModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { computed, defineComponent, PropType } from 'vue';
import { CloseIcon } from 'tdesign-icons-vue-next';
import TDialog from '../../dialog';
import TImageItem from './ImageItem';
import TImageViewerUtils from './ImageViewerUtils';
import TImageViewerUtils, { PropFn } from './ImageViewerUtils';
import { usePrefixClass } from '../../hooks/useConfig';
import { useTNodeJSX } from '../../hooks/tnode';
import { ImageInfo, TdImageViewerProps } from '../type';
Expand All @@ -24,11 +24,11 @@ export default defineComponent({
return {};
},
},
onRotate: Function,
onZoomIn: Function,
onZoomOut: Function,
onMirror: Function,
onReset: Function,
onRotate: Function as PropType<PropFn>,
onZoomIn: Function as PropType<PropFn>,
onZoomOut: Function as PropType<PropFn>,
onMirror: Function as PropType<PropFn>,
onReset: Function as PropType<PropFn>,
onClose: Function as PropType<TdImageViewerProps['onClose']>,
draggable: {
type: Boolean,
Expand Down
12 changes: 7 additions & 5 deletions src/image-viewer/base/ImageViewerUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ import { downloadFile } from '../utils';

import { ImageInfo } from '../type';

export type PropFn = () => void;

export default defineComponent({
name: 'TImageViewerUtils',
props: {
scale: Number,
onRotate: Function,
onZoomIn: Function,
onZoomOut: Function,
onMirror: Function,
onReset: Function,
onRotate: Function as PropType<PropFn>,
onZoomIn: Function as PropType<PropFn>,
onZoomOut: Function as PropType<PropFn>,
onMirror: Function as PropType<PropFn>,
onReset: Function as PropType<PropFn>,
currentImage: {
type: Object as PropType<ImageInfo>,
default() {
Expand Down

0 comments on commit eea371f

Please sign in to comment.