-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path5_testShop.html
39 lines (39 loc) · 1.4 KB
/
5_testShop.html
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
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>vue商品练习</title>
<link rel="stylesheet" type="text/css" href="5_testShop.css">
</head>
<body>
<div id = 'app' v-cloak>
<template v-if='list.length'>
<div class="shopTitle">
<div class="number titleNumber">编号</div>
<div class="name titleName">商品名称</div>
<div class="price titlePrice">商品单价</div>
<div class="amount titleAmout">购买数量</div>
<div class="opearate titleOperate">操作</div>
</div>
<div class="shopCont" v-for='(item,index) in list'>
<div class="number contNumber">{{index+1}}</div>
<div class="name contName">{{item.name}}</div>
<div class="price contPrice">{{item.price}}</div>
<div class="amount titleAmout">
<div class="reduceCount btn" @click="reduceFn(index)" :class={disabled:item.disableFlag}>减少</div>
<div class="countNum">{{item.count}}</div>
<div class="addCount btn" @click = 'addFn(index)'>增加</div>
</div>
<div class="opearate titleOperate">
<div class="addList btn" @click='addList'>增加</div>
<div class="removeList btn" @click='removeList(index)'>减少</div>
</div>
</div>
</template>
<div v-else class="text">购物车为空</div>
<div class="account text">总计为:{{total}}</div>
</div>
</body>
<script src="vue.js"></script>
<script type="text/javascript" src="5_testShop.js"></script>
</html>