methods:{ cartview:function(){ var _this = this; this.$http.get("data/cartData.json").then(function(res){ _this.productList = res.result.list; _this.totalMoney = res.result.totalMaoney; }); } }
methods:{ cartview:function(){ var _this = this; this.$http.get("data/cartData.json").then(function(res){ _this.productList = res.data.result.list; _this.totalMoney = res.data.result.totalMaoney; }); } }
{ "status":1, "result":{ "totalMoney":109, "list":[ { "productId":"600100002115", "productName":"黄鹤楼香烟", "productPrice":19, "productQuantity":1, "productImage":"img/goods-1.webp", "parts":[ { "partsId":"10001", "partsName":"打火机", "imgSrc":"img/part-1.webp" }, { "partsId":"10002", "partsName":"打火机", "imgSrc":"img/part-1.webp" } ] }, { "productId":"600100002120", "productName":"加多宝", "productPrice":8, "productQuantity":5, "productImage":"img/goods-2.webp", "parts":[ { "partsId":"20001", "partsName":"吸管", "imgSrc":"img/part-2.webp" } ] }, { "productId":"600100002117", "productName":"金装黄鹤楼", "productPrice":25, "productQuantity":2, "productImage":"img/goods-1.webp", "parts":[ { "partsId":"10001", "partsName":"打火机-1", "imgSrc":"img/part-1.webp" }, { "partsId":"10002", "partsName":"打火机-2", "imgSrc":"img/part-1.webp" } ] } ] }, "message":""
以上这篇使用vue-resource进行数据交互的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。