小试购物车,熟练一下dom的增删改查


最近疫情影响很大,在家也出不去,只能学习啦,下面是效果,废话不多说,直接上代码

ps:明天我会继续改进,后续我会继续改进购物车以及服务器版本的购物车

更多案例请参考我的gitee:https://gitee.com/thomas-001/my-code


"en">

<head>
    "UTF-8">
    "X-UA-Compatible" content="IE=edge">
    "viewport" content="width=device-width, initial-scale=1.0">
    Document
    
head>


    
            <tr>
                tr>
        "cart">
            <tr>
                tr>
            <tr>
                tr>
        
            <tr>
                tr>
        
商品名称 数量 单价 小计 操作
肉夹馍 "num">0 单价:"price">18 小计:"sum">0 操作"del" type="button" value="删除" /> 凉皮 "num">0 单价:"price">16 小计:"sum">0 操作:"del" type="button" value="删除" />
"5"> 一共"goods-total-num">0件商品,共计花费"goods-total-price">0元。
<tr> tr> "store"> <tr> tr> <tr> tr>
商品名称 单价 操作
"name">西红柿 单价:"single-price">1 操作:"add" type="button" value="添加" /> "name">鸡蛋 单价:"single-price">33 操作:"add" type="button" value="添加" />