Authored by 陈轩

响应 app 刷新购物车的事件

@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 }; 23 };
24 }, 24 },
25 methods: { 25 methods: {
26 - selectItem(item) { 26 + selectItem() {
27 this.hide(); 27 this.hide();
28 return true; 28 return true;
29 }, 29 },
@@ -49,7 +49,6 @@ @@ -49,7 +49,6 @@
49 z-index: 2010; 49 z-index: 2010;
50 overflow: auto; 50 overflow: auto;
51 51
52 -  
53 &.filter-sub-open { 52 &.filter-sub-open {
54 transform: translate3d(0, 0, 0); 53 transform: translate3d(0, 0, 0);
55 } 54 }
@@ -85,6 +84,10 @@ @@ -85,6 +84,10 @@
85 padding: 0 $w; 84 padding: 0 $w;
86 height: 100px; 85 height: 100px;
87 line-height: 100px; 86 line-height: 100px;
  87 + overflow: hidden;
  88 + text-overflow: ellipsis;
  89 + white-space: nowrap;
  90 +
88 } 91 }
89 } 92 }
90 </style> 93 </style>
@@ -409,6 +409,7 @@ @@ -409,6 +409,7 @@
409 const tip = require('common/tip'); 409 const tip = require('common/tip');
410 const yoho = require('yoho'); 410 const yoho = require('yoho');
411 const share = require('common/share'); 411 const share = require('common/share');
  412 + const bus = require('common/vue-bus');
412 413
413 require('vue-swipe/dist/vue-swipe.css'); 414 require('vue-swipe/dist/vue-swipe.css');
414 415
@@ -498,6 +499,17 @@ @@ -498,6 +499,17 @@
498 }); 499 });
499 } 500 }
500 }); 501 });
  502 + },
  503 +
  504 + /*
  505 + 刷新购物车
  506 + */
  507 + refreshCart: function() {
  508 + $.get('/product/cart-count.json').then(result=> {
  509 + if (result.code === 200) {
  510 + this.cartCount = result.data.cart_goods_count;
  511 + }
  512 + });
501 } 513 }
502 }, 514 },
503 created() { 515 created() {
@@ -555,11 +567,8 @@ @@ -555,11 +567,8 @@
555 567
556 // 读取购物车数量 568 // 读取购物车数量
557 if (this.isApp) { 569 if (this.isApp) {
558 - $.get('/product/cart-count.json').then(result=> {  
559 - if (result.code === 200) {  
560 - this.cartCount = result.data.cart_goods_count;  
561 - }  
562 - }); 570 + this.refreshCart();
  571 + bus.on('app.shoppingcart,refresh', () => this.refreshCart);
563 } 572 }
564 } 573 }
565 }; 574 };