File tree 4 files changed +11
-15
lines changed
4 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ Previewable image.
22
22
| placeholder | Load placeholder, use default placeholder when set ` true ` | boolean \| slot | - | 2.0.0 |
23
23
| preview | preview config, disabled when ` false ` | boolean \| [ previewType] ( #previewType ) | true | 2.0.0 |
24
24
| src | Image path | string | - | 2.0.0 |
25
- | previewMask | custom mask | boolean \| function \| slot | - | 3.2.0 |
25
+ | previewMask | custom mask | false \| function \| slot | - | 3.2.0 |
26
26
| width | Image width | string \| number | - | 2.0.0 |
27
27
28
28
### events
Original file line number Diff line number Diff line change @@ -41,24 +41,20 @@ const Image = defineComponent<ImageProps>({
41
41
42
42
return ( ) => {
43
43
const imageLocale = configProvider . locale ?. Image || defaultLocale . Image ;
44
-
44
+ const defaultPreviewMask = ( ) => (
45
+ < div class = { `${ prefixCls . value } -mask-info` } >
46
+ < EyeOutlined />
47
+ { imageLocale ?. preview }
48
+ </ div >
49
+ ) ;
50
+ const { previewMask = slots . previewMask || defaultPreviewMask } = props ;
45
51
return (
46
52
< ImageInternal
47
53
{ ...{ ...attrs , ...props , prefixCls : prefixCls . value } }
48
54
preview = { mergedPreview . value }
49
55
v-slots = { {
50
56
...slots ,
51
- previewMask :
52
- props . previewMask === false
53
- ? null
54
- : props . previewMask ??
55
- slots . previewMask ??
56
- ( ( ) => (
57
- < div class = { `${ prefixCls . value } -mask-info` } >
58
- < EyeOutlined />
59
- { imageLocale ?. preview }
60
- </ div >
61
- ) ) ,
57
+ previewMask : typeof previewMask === 'function' ? previewMask : null ,
62
58
} }
63
59
> </ ImageInternal >
64
60
) ;
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/D1dXz9PZqa/image.svg
23
23
| placeholder | 加载占位, 为 ` true ` 时使用默认占位 | boolean \| slot | - | 2.0.0 |
24
24
| preview | 预览参数,为 ` false ` 时禁用 | boolean \| [ previewType] ( #previewType ) | true | 2.0.0 |
25
25
| src | 图片地址 | string | - | 2.0.0 |
26
- | previewMask | 自定义 mask | boolean \| function \| slot | - | 3.2.0 |
26
+ | previewMask | 自定义 mask | false \| function \| slot | - | 3.2.0 |
27
27
| width | 图像宽度 | string \| number | - | 2.0.0 |
28
28
29
29
### 事件
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export const imageProps = () => ({
33
33
prefixCls : String ,
34
34
previewPrefixCls : String ,
35
35
previewMask : {
36
- type : [ Boolean , Function ] as PropType < boolean | ( ( ) => any ) > ,
36
+ type : [ Boolean , Function ] as PropType < false | ( ( ) => any ) > ,
37
37
default : undefined ,
38
38
} ,
39
39
placeholder : PropTypes . any ,
You can’t perform that action at this time.
0 commit comments