Commit d68ca51e by wangshuo

组件优化

parent e2ecada9
import React from 'react' import React, {Component} from 'react'
import './index.scss' import './index.scss';
const HeaderBar = (props) => { class HeaderBar extends Component {
return ( constructor(props) {
<div className="detail-header" style={{...props.style}}> super(props);
<i className={`iconfont ${props.arrow ? 'iconiconfront-68' : ''} return`} onClick={props.goBack}></i> }
<span className='herder'>{props.title}</span> goBack = () => {
<i className={`iconfont ${props.cart ? 'icongouwuche-xianxing' : ''} shopping-cart`} onClick={props.goShop}></i> window.history.go(-1);
</div> }
); goShop = () => {
location.replace('/shopcart');
}
render() {
return (
<div className="detail-header" style={{...this.props.style}}>
<i className={`iconfont ${this.props.arrow ? 'iconiconfront-68' : ''} return`} onClick={this.goBack}></i>
<span className='herder'>{this.props.title}</span>
<i className={`iconfont ${this.props.cart ? 'icongouwuche-xianxing' : ''} shopping-cart`} onClick={this.goShop}></i>
</div>
);
}
}; };
export default HeaderBar; export default HeaderBar;
...@@ -79,7 +79,7 @@ const MyForm = withFormik({ ...@@ -79,7 +79,7 @@ const MyForm = withFormik({
return; return;
} }
Toast.info('保存成功!', undefined, undefined, false); Toast.info('保存成功!', undefined, undefined, false);
FormBag.props.history.push({ FormBag.props.history.replace({
pathname: '/order', pathname: '/order',
state: values state: values
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment