cartList.js 1.12 KB
Newer Older
zhanghaozhe committed
1 2 3
import React, { Component } from "react"
import { Link } from "react-router-dom"
import CartItem from "./cartItem"
4

xuzhenghua committed
5
class cartList extends Component {
zhanghaozhe committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  render() {
    return (
      <div className="cart-main">
        {/* 遍历购物车商品列表 */}
        <div className="cart-c-body">
          {this.props.data.length > 0 ? (
            this.props.data.map((item, index) => {
              return (
                <CartItem
                  index={index}
                  changeStock={(id, val) => {
                    this.props.changeStock(id, val)
                  }}
                  checkChange={(id, val) => {
                    this.props.checkChange(id, val)
                  }}
                  key={index}
                  item={item}
                  toDetail={this.props.toDetail}
                />
              )
            })
          ) : (
            <div className="cart-tip">
              <p className="cart-mess">这里是空的,快去逛逛吧~</p>
              <Link to="/classify">去逛逛</Link>
.  
baiguangyao committed
32
            </div>
zhanghaozhe committed
33 34 35 36 37
          )}
        </div>
      </div>
    )
  }
.  
baiguangyao committed
38 39
}

zhanghaozhe committed
40
export default cartList