index.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import React, {Component} from 'react'
  2. import {withRouter} from "react-router-dom"
  3. import cart_empty from '../../../images/cart_empty.jpg'
  4. import './index.css'
  5. class Empty extends Component {
  6. constructor(props) {
  7. super(props)
  8. this.state = {}
  9. }
  10. render() {
  11. let contentHeight = window.innerHeight - 95
  12. return (
  13. <div className="cart-empty" style={{height: contentHeight}}>
  14. <div>
  15. <img src={cart_empty} alt="img" width={100}/>
  16. </div>
  17. <div>购物车空空如此</div>
  18. <div>
  19. <button className="empty-button"
  20. onClick={() => {
  21. this.props.history.push({
  22. pathname: `/`
  23. })
  24. }}>
  25. 去逛逛
  26. </button>
  27. </div>
  28. </div>
  29. )
  30. }
  31. }
  32. export default withRouter(Empty)