单件商品金额计算和单选全选功能

new Vue({
el: '#app',
data: {
totalMoney: 0,
productList: []
},
filters: {
formatMoney: function (value) {
return "¥ " + value.toFixed(2);
},
},
mounted: function() {
this.$nextTick(function(){
this.cartView();
});
},
methods: {
cartView: function() {
let _this = this;
this.$http.get("data/cartData.json", {"id":123}).then(res=>{
this.productList = res.body.result.list;
this.totalMoney = res.body.result.totalMoney;
});
}
}
});
Vue.filter("money", function(value,type) {
return "¥ "+value.toFixed(2) + type;
})
changeMoney: function(product, way){
if(way>0){
product.productQuentity++;
}else{
product.productQuentity--;
if(product.productQuentity<1){
product.productQuentity = 1;
}
}
}
selectedProduct: function (item) {
if(typeof item.checked == 'undefined'){
Vue.set(item, "checked", true);
}else {
item.checked = !item.checked;
}
}

地址列表

new Vue({
el: '.container',
data: {
addressList: []
},
mounted: function() {
this.$nextTick(function(){
});
},
methods: {
getAddressList: function() {
var _this = this;
this.$http.get("data/address.json").then(function (response){
var res = response.data;
if(res.status == "0"){
_this.addressList = res.result;
}
});
}
}
});

v-model v-text v-show v-if v-bind v-for v-on

axios


请点赞!因为你的鼓励是我写作的最大动力!

吹逼交流群:711613774

最新文章

  1. .NET LINQ 转换数据类型
  2. PS切图篇
  3. 移动端弹性布局--flex
  4. nodejs解决找不到express命令的问题
  5. Android消息机制源码分析
  6. Maven 库
  7. map函数
  8. 随便谈谈用canvas来实现文字图片粒子化
  9. Q3: Linked List Cycle II
  10. sqlplus 远程oracle
  11. Python学习笔记——面向对象基础
  12. CSS3 概览 更新时间 2014-0412-1317
  13. deb文件安装命令
  14. 优先队列(和fence repair完全一样)
  15. Enze fifth day(循环语句2)
  16. 全面了解Android热修复技术
  17. linux shell 推断文件或目录是否真的存在
  18. snmp监控f5
  19. chat.css
  20. Java向下转型的意义

热门文章

  1. CCF 2016-04-2 俄罗斯方块
  2. java之hibernate之配置讲解
  3. 平衡二叉树详解——PHP代码实现
  4. vue 自定义image组件
  5. Jenkins多环境持续集成架构实践
  6. 7.nth-of-type | nth-child?【CSS】
  7. Mac 下 安装Python3
  8. Android笔记(四十八) Android中的资源访问——SDCard
  9. 关于类型为numpy,TensorFlow.tensor,torch.tensor的shape变化以及相互转化
  10. 漫谈五种IO模型(主讲IO多路复用)