forgeplus-react/src/forge/Branch/CloneAddress.js

34 lines
1.2 KiB
JavaScript

import React , { Component } from 'react';
import { Dropdown , Icon , Tooltip } from 'antd';
import "./branch.css";
class CloneAddress extends Component{
// 点击按钮复制功能
jsCopy=()=>{
var e = document.getElementById("copy_rep_content");
e.select();
document.execCommand("Copy");
// this.props.showNotification('复制成功');
}
render(){
const { http_url , downloadUrl } = this.props;
return(
<div className="gitAddressClone">
<span className={"addressType active"} onClick={()=>this.changeAddress("http")}>HTTP</span>
{/* <span className={address ==="ssh" ? "addressType active":"addressType"} onClick={()=>this.changeAddress("ssh")}>SSH</span> */}
<input type="text" id="copy_rep_content" value={ http_url }/>
<Tooltip title="复制链接">
<span onClick={()=>this.jsCopy()}><i className="iconfont icon-fuzhi"></i></span>
</Tooltip>
<span>
<Dropdown overlay={downloadUrl} trigger={['click']} placement="bottomRight">
<a className="ant-dropdown-link">
<Icon type="cloud-download" className="font-18 fl"/>
</a>
</Dropdown></span>
</div>
)
}
}
export default CloneAddress;