You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
884 B
29 lines
884 B
import React, { Component } from 'react';
|
|
import {Link} from 'react-router-dom'
|
|
|
|
const map={"blue":"blueFull","greyBack":"greyBack","grey":"greyWidthFixed","green":"greenBack",
|
|
'colorBlue': 'colorBlue', // 蓝字白底
|
|
}
|
|
class ActionBtn extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
}
|
|
|
|
render() {
|
|
let{to, children, style, className, ...others}=this.props
|
|
return(
|
|
<React.Fragment>
|
|
{
|
|
to==undefined ?
|
|
<a href="javascript:void(0)" onClick={this.props.onClick}
|
|
{...others}
|
|
className={"Actionbtn "+`${map[style]} ${this.props.className}`}
|
|
>{children}</a>
|
|
:
|
|
<Link to={to} className={"btn "+`${map[this.props.style]} ${this.props.className}`}>{this.props.children}</Link>
|
|
}
|
|
</React.Fragment>
|
|
)
|
|
}
|
|
}
|
|
export default ActionBtn; |