fix: 优化代码变量名
This commit is contained in:
parent
94ca0181ec
commit
2ed69cc1f2
@ -7,7 +7,7 @@ import { ConfigProvider,CropperImage} from '@zhst/meta';
|
||||
import './index.less'
|
||||
|
||||
type ViewLargerImageModalParams = {
|
||||
imgSrc?: string;
|
||||
imageKey?: string;
|
||||
warningData?: {
|
||||
label?: string;
|
||||
value?: string;
|
||||
@ -30,7 +30,7 @@ export interface ViewLargerImageModalRef {
|
||||
export interface ViewLargerImageModalProps {
|
||||
prefixCls?: string
|
||||
imgStyle?: React.CSSProperties;
|
||||
downloadImg?: (imgSrc?: string) => void;
|
||||
downloadImg?: (imageKey?: string) => void;
|
||||
title?: string;
|
||||
downloadText?: string;
|
||||
modalProps?: ModalProps
|
||||
@ -49,7 +49,7 @@ export const ViewLargerImageModal = forwardRef<ViewLargerImageModalRef, ViewLarg
|
||||
const { useToken } = theme
|
||||
const { token } = useToken()
|
||||
const [open, setOpen] = useState<boolean>(false);
|
||||
const [imgSrc, setimgSrc] = useState<string>();
|
||||
const [imageKey, setimageKey] = useState<string>();
|
||||
const [odRect, setOdRect] = useState<ViewLargerImageModalParams['odRect']>();
|
||||
const [warningData, setWarningData] = useState<ViewLargerImageModalParams['warningData']>();
|
||||
const odRectDefault = odRect?.map(rect => ({
|
||||
@ -65,7 +65,7 @@ export const ViewLargerImageModal = forwardRef<ViewLargerImageModalRef, ViewLarg
|
||||
return {
|
||||
show: (_params) => {
|
||||
setOpen(true);
|
||||
setimgSrc(_params?.imgSrc)
|
||||
setimageKey(_params?.imageKey)
|
||||
setWarningData(_params?.warningData)
|
||||
setOdRect(_params?.odRect)
|
||||
},
|
||||
@ -90,7 +90,7 @@ export const ViewLargerImageModal = forwardRef<ViewLargerImageModalRef, ViewLarg
|
||||
<CropperImage
|
||||
// editAble={true}
|
||||
odList={odRectDefault}
|
||||
url={imgSrc}
|
||||
url={imageKey}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -101,7 +101,7 @@ export const ViewLargerImageModal = forwardRef<ViewLargerImageModalRef, ViewLarg
|
||||
{value}
|
||||
</div>
|
||||
))}
|
||||
{imgSrc && downloadImg && <div className='img-download' style={{ color: token.colorPrimary }} onClick={() => downloadImg?.(imgSrc)} ><DownloadOutlined /><span style={{ paddingLeft: 3 }}>{downloadText}</span></div>}
|
||||
{imageKey && downloadImg && <div className='img-download' style={{ color: token.colorPrimary }} onClick={() => downloadImg?.(imageKey)} ><DownloadOutlined /><span style={{ paddingLeft: 3 }}>{downloadText}</span></div>}
|
||||
</div>
|
||||
</Space>
|
||||
</Modal>
|
||||
|
Loading…
Reference in New Issue
Block a user