index_20190428151853.js 1.18 KB
Newer Older
baiguangyao committed
1 2 3 4 5 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
import React, { Component } from 'react'

import CartItem from '@/components/Cart/CartItem'

class CratList extends Component {
    render() {
        return (
            <div className="cart-main">
                {/* 遍历购物车商品列表 */}
                <div className="cart-c-body">
                    {
                        this.props.data.length > 0 ?
                            this.props.data.map((item, i) => {
                                return (
                                    <CartItem index={i} changeStock={(id, val) => {
                                        this.props.changeStock(id, val)
                                    }} checkChange={(id, val) => {
                                        this.props.checkChange(id, val)
                                    }} getCartList={() => {
                                        this.props.getCartList()
                                    }} key={i} item={item}></CartItem>
                                )
                            })
                            : <div className="cart-tip">暂无商品</div>
                    }
                </div>
            </div>
        )
    }
}
export default CratList