代码拉取完成,页面将自动刷新
window.vm = new Vue({
el: "#app"
, data: {
showModal: false
, productList: []
, totalMoney: 0
, checkAll: false
, currentProduct: ""
}
, mounted: function () {
var _this = this;
this.cartView();
}
, filters: {
formatMoney: function (value, quentity) {
if(!quentity){
quentity = 1;
}
return "¥ "+ (value * quentity).toFixed(2) + "元";
}
}
, methods: {
cartView: function () {
this.$http.get("data/cartData.json").then(function (response) {
var res = response.data;
if(res && res.status == '1'){
this.productList = res.result.list;
this.calcTotalMoney();
}
});
}
, selectAll: function (isCheck) {
this.checkAll = isCheck;
this.productList.forEach(function (item) {
if(typeof item.checked == "undefined"){
$.set(item, "checked", isCheck);
}else{
item.checked = isCheck;
}
})
this.calcTotalMoney();
}
}
});
<!--参数绑定-->
v-bind:class="{'check':product.checked}" v-on:click="selectedProduct(product)"
<!--总金额 filters格式化-->
<div class="item-price-total">
{{product.productPrice | formatMoney(product.productQuentity)}}
</div>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。