關于JSON的問題:XMLHttpRequest cannot load file:///E:/static/cartData.json. Cross origin requests are ...(此處省略)。
谷歌瀏覽器打開會有以上的提示(跨域訪問的問題);如果用火狐打開,沒有任何提示,但代碼沒有正常運行。
網(wǎng)上能搜到解決此類問題的方法。。。
我解決的方法:用WebStorm 打開(),并且代碼“ res.result.list;”改為 “res.body.result.list”;
谷歌瀏覽器打開會有以上的提示(跨域訪問的問題);如果用火狐打開,沒有任何提示,但代碼沒有正常運行。
網(wǎng)上能搜到解決此類問題的方法。。。
我解決的方法:用WebStorm 打開(),并且代碼“ res.result.list;”改為 “res.body.result.list”;
2017-09-12
這個項目主要練習的是CRUD操作,老師講的非常詳細,非常贊~666666
畢竟和ng1.x版本類似,所以理解起來不難~
畢竟和ng1.x版本類似,所以理解起來不難~
2017-09-11
selectedproduct: function (i) {
if(i.checked){
i.checked = !i.checked;
}else{
this.$set(i,"checked",true);
}
this.checkall = true;
for(let v of this.productlist){
if(!v.checked) return this.checkall = false;
}
}
if(i.checked){
i.checked = !i.checked;
}else{
this.$set(i,"checked",true);
}
this.checkall = true;
for(let v of this.productlist){
if(!v.checked) return this.checkall = false;
}
}
2017-09-09
可以給more添加一個click事件toggleMore,可以實現(xiàn)收起更多:
toggleMore:function() {
if(this.limitNum==3){
this.limitNum=this.addressList.length;
}else{
this.limitNum=3;
}
}
toggleMore:function() {
if(this.limitNum==3){
this.limitNum=this.addressList.length;
}else{
this.limitNum=3;
}
}
2017-09-06
cart.js:20 Uncaught (in promise) TypeError: Cannot read property 'result' of undefined
這是啥意思,照著老師的:
this.$http.get("data/cartData.json",{"id":123}).then(function (res) {
_this.productList = res.body.result.list;
_this.totalMoney = res.body.result.totalMoney;
這是啥意思,照著老師的:
this.$http.get("data/cartData.json",{"id":123}).then(function (res) {
_this.productList = res.body.result.list;
_this.totalMoney = res.body.result.totalMoney;
2017-09-05