File tree Expand file tree Collapse file tree 4 files changed +11
-15
lines changed Expand file tree Collapse file tree 4 files changed +11
-15
lines changed Original file line number Diff line number Diff 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 \| function \| slot | - | 3.2.0 |
25+ | previewMask | custom mask | false \| function \| slot | - | 3.2.0 |
2626| width | Image width | string \| number | - | 2.0.0 |
2727
2828### events
Original file line number Diff line number Diff line change @@ -41,24 +41,20 @@ const Image = defineComponent<ImageProps>({
4141
4242 return ( ) => {
4343 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 ;
4551 return (
4652 < ImageInternal
4753 { ...{ ...attrs , ...props , prefixCls : prefixCls . value } }
4854 preview = { mergedPreview . value }
4955 v-slots = { {
5056 ...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 ,
6258 } }
6359 > </ ImageInternal >
6460 ) ;
Original file line number Diff line number Diff 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 \| function \| slot | - | 3.2.0 |
26+ | previewMask | 自定义 mask | false \| function \| slot | - | 3.2.0 |
2727| width | 图像宽度 | string \| number | - | 2.0.0 |
2828
2929### 事件
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export const imageProps = () => ({
3333 prefixCls : String ,
3434 previewPrefixCls : String ,
3535 previewMask : {
36- type : [ Boolean , Function ] as PropType < boolean | ( ( ) => any ) > ,
36+ type : [ Boolean , Function ] as PropType < false | ( ( ) => any ) > ,
3737 default : undefined ,
3838 } ,
3939 placeholder : PropTypes . any ,
You can’t perform that action at this time.
0 commit comments