get请求cartData.json时候会报错,这是跨域问题,同学们可以在本机用iis搭建一个服务器站点,具体的教程可以去搜下,然后用localhost来访问
2018-05-25
官方推荐使用Axio,老师没有介绍created勾子函数,这个函数内就不用在computed函数中调用了:
created:function(){
axios.get('data/address.json').then(response=>{
if (response.status=='200') {
this.addressList = response.data.result;
}
console.log(response)
}).catch(error=>{
console.log(error)
})
}
created:function(){
axios.get('data/address.json').then(response=>{
if (response.status=='200') {
this.addressList = response.data.result;
}
console.log(response)
}).catch(error=>{
console.log(error)
})
}
代码分享:https://github.com/wuln/vue-demos/tree/master/shoppingCart-vue2.0
有需要的同学可自行下载~~
有需要的同学可自行下载~~
2018-05-14
商品单价没有渲染出来: {{item.productPrice}}, console.log(res.data.result.list.productPrice); // undefined 添加索引后:console.log(res.data.result.list[0].productPrice); // 19 这是为什么啊
2018-05-01