23 lines
		
	
	
		
			512 B
		
	
	
	
		
			JavaScript
		
	
	
		
		
			
		
	
	
			23 lines
		
	
	
		
			512 B
		
	
	
	
		
			JavaScript
		
	
	
|  | import { Tag, Tooltip } from "antd"; | ||
|  | import PreviewImg from "~/components/PreviewImg"; | ||
|  | 
 | ||
|  | const TooltipPreviewImg = (props) => { | ||
|  |   const { files = [], fileUrlKey = "filePath" } = props; | ||
|  | 
 | ||
|  |   const renderContent = () => { | ||
|  |     return ( | ||
|  |       files.length > 0 | ||
|  |         ? <PreviewImg files={files} fileUrlKey={fileUrlKey} /> | ||
|  |         : <span>暂无图片</span> | ||
|  |     ); | ||
|  |   }; | ||
|  | 
 | ||
|  |   return ( | ||
|  |     <Tooltip placement="top" title={renderContent()}> | ||
|  |       <Tag>预览</Tag> | ||
|  |     </Tooltip> | ||
|  |   ); | ||
|  | }; | ||
|  | 
 | ||
|  | export default TooltipPreviewImg; |