36 lines
		
	
	
		
			906 B
		
	
	
	
		
			JavaScript
		
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			906 B
		
	
	
	
		
			JavaScript
		
	
	
| import { ArrowLeftOutlined } from "@ant-design/icons";
 | |
| import { Divider } from "antd";
 | |
| import "./index.less";
 | |
| 
 | |
| /**
 | |
|  * 头部返回组件
 | |
|  */
 | |
| function HeaderBack(props) {
 | |
|   const { title, history, previous = true, style = {} } = props;
 | |
| 
 | |
|   return (
 | |
|     <div className="header-back" style={style}>
 | |
|       <div className="action">
 | |
|         {
 | |
|           previous
 | |
|           && (
 | |
|             <>
 | |
|               <div
 | |
|                 className="back"
 | |
|                 onClick={() => history?.goBack?.() || window.history.back()}
 | |
|               >
 | |
|                 <ArrowLeftOutlined style={{ fontSize: 14 }} />
 | |
|                 <span>返回</span>
 | |
|               </div>
 | |
|               <Divider type="vertical" style={{ backgroundColor: "#dcdfe6", marginLeft: 15, marginRight: 15 }} />
 | |
|             </>
 | |
|           )
 | |
|         }
 | |
|         <div className="title">{title}</div>
 | |
|       </div>
 | |
|     </div>
 | |
|   );
 | |
| }
 | |
| 
 | |
| export default HeaderBack;
 |