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 {
constructor(props) {
super(props);
}
goBack = () => {
window.history.go(-1);
}
goShop = () => {
location.replace('/shopcart');
}
render() {
return ( return (
<div className="detail-header" style={{...props.style}}> <div className="detail-header" style={{...this.props.style}}>
<i className={`iconfont ${props.arrow ? 'iconiconfront-68' : ''} return`} onClick={props.goBack}></i> <i className={`iconfont ${this.props.arrow ? 'iconiconfront-68' : ''} return`} onClick={this.goBack}></i>
<span className='herder'>{props.title}</span> <span className='herder'>{this.props.title}</span>
<i className={`iconfont ${props.cart ? 'icongouwuche-xianxing' : ''} shopping-cart`} onClick={props.goShop}></i> <i className={`iconfont ${this.props.cart ? 'icongouwuche-xianxing' : ''} shopping-cart`} onClick={this.goShop}></i>
</div> </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