/* * @Author: your name * @Date: 2021-12-17 10:42:24 * @Description: * @FilePath: \zl-business\src\components\Unit\button\index.tsx */ import React, { useMemo, useRef } from 'react'; import { Upload } from 'antd'; import '../g.scss'; function LabelUploadLinkButton(props: LabelUploadLinkButton) { const { value, imgUrl, title='label', defaultButtonText, change, wrapStyle = { padding: '6px 20px 6px 20px' } } = props; const isShow = useRef(null); const enter = (e: any) => { isShow.current.style.display = 'block'; }; const leave = (e: any) => { isShow.current.style.display = 'none'; }; const Dom = useMemo(() => { return (
{title} { change?.([file, fileList], 'beforeUpload'); }} // onChange={(file, fileList, event) => { // change?.([file, fileList, event], 'change'); // }} >
{imgUrl ? : <>}
{ // e.stopPropagation(); change?.(null, '更改'); }} > 更改 { e.stopPropagation(); change?.(null, '删除'); }} > 删除
{defaultButtonText}
); }, [value, title, imgUrl, defaultButtonText]); return Dom; } export default LabelUploadLinkButton; export interface LabelUploadLinkButton { value?: string; imgUrl?: string; title?: string; defaultButtonText?: string; change?: Function; wrapStyle?: React.CSSProperties; }