Skip to content

Commit 70fb553

Browse files
committed
update code
1 parent 4782cb4 commit 70fb553

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

components/image/index.en-US.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Previewable image.
2222
| placeholder | Load placeholder, use default placeholder when set `true` | boolean \| slot | - | 2.0.0 |
2323
| preview | preview config, disabled when `false` | boolean \| [previewType](#previewType) | true | 2.0.0 |
2424
| src | Image path | string | - | 2.0.0 |
25-
| previewMask | custom mask | boolean \| VNode \| VNode[] \| slot | true | 3.2.0 |
25+
| previewMask | custom mask | boolean \| function \| slot | - | 3.2.0 |
2626
| width | Image width | string \| number | - | 2.0.0 |
2727

2828
### events

components/image/index.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { App, ExtractPropTypes, ImgHTMLAttributes, Plugin } from 'vue';
2-
import { defineComponent, computed, isVNode } from 'vue';
2+
import { defineComponent, computed } from 'vue';
33
import ImageInternal from '../vc-image';
44
import { imageProps } from '../vc-image/src/Image';
55
import defaultLocale from '../locale/en_US';
@@ -51,9 +51,8 @@ const Image = defineComponent<ImageProps>({
5151
previewMask:
5252
props.previewMask === false
5353
? null
54-
: isVNode(props.previewMask)
55-
? props.previewMask
56-
: slots.previewMask ??
54+
: props.previewMask ??
55+
slots.previewMask ??
5756
(() => (
5857
<div class={`${prefixCls.value}-mask-info`}>
5958
<EyeOutlined />

components/image/index.zh-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/D1dXz9PZqa/image.svg
2323
| placeholder | 加载占位, 为 `true` 时使用默认占位 | boolean \| slot | - | 2.0.0 |
2424
| preview | 预览参数,为 `false` 时禁用 | boolean \| [previewType](#previewType) | true | 2.0.0 |
2525
| src | 图片地址 | string | - | 2.0.0 |
26-
| previewMask | 自定义 mask | boolean \| VNode \| VNode[] \| slot | true | 3.2.0 |
26+
| previewMask | 自定义 mask | boolean \| function \| slot | - | 3.2.0 |
2727
| width | 图像宽度 | string \| number | - | 2.0.0 |
2828

2929
### 事件

components/vc-image/src/Image.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { ImgHTMLAttributes, CSSProperties, PropType, VNode } from 'vue';
1+
import type { ImgHTMLAttributes, CSSProperties, PropType } from 'vue';
22
import { ref, watch, defineComponent, computed, onMounted, onUnmounted } from 'vue';
33
import isNumber from 'lodash-es/isNumber';
44
import cn from '../../_util/classNames';
@@ -33,8 +33,8 @@ export const imageProps = () => ({
3333
prefixCls: String,
3434
previewPrefixCls: String,
3535
previewMask: {
36-
type: [Boolean, Object, Array] as PropType<boolean | VNode | VNode[]>,
37-
default: true,
36+
type: [Boolean, Function] as PropType<boolean | (() => any)>,
37+
default: undefined,
3838
},
3939
placeholder: PropTypes.any,
4040
fallback: String,

0 commit comments

Comments
 (0)