vue的$http的get請(qǐng)求要加上params操作
vue GET傳遞參數(shù)要加上params
this.$http.get(’/operation/customer/question/edits’,{params:{id: 10}})
另外說一句,現(xiàn)在VUE官方推薦使用axios
vue-resource不更新了
補(bǔ)充知識(shí):vue請(qǐng)求中 post get傳參方式是不同的哦
我在學(xué)習(xí)vue,項(xiàng)目中post請(qǐng)求,get請(qǐng)求都用到了,我發(fā)現(xiàn)傳參方式是不一樣的。
post請(qǐng)求的例子:
checkin (){this.$http.post(’my url’,{mobilePhone:this.phone,password:this.password},{emulateJSON: true}).then(function(res){this.$root.userid=res.data.userid;console.log(this.$root.userid)this.$router.push(’/content’) ;});}
get請(qǐng)求的例子:
nextOne2 (){this.$http.get(’http://192.168.100.31:8080/wenchuang/guid/addProductFile’,{params: {filename:this.formData.chanpinjia,userid: this.$root.userid},},{emulateJSON: true}).then(function(res){this.step++;this.bianliang= res.data.files.id;});},
以上這篇vue的$http的get請(qǐng)求要加上params操作就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. 淺談XML Schema中的elementFormDefault屬性2. jsp學(xué)習(xí)之scriptlet的使用方法詳解3. ASP.NET MVC獲取多級(jí)類別組合下的產(chǎn)品4. ASP.NET MVC實(shí)現(xiàn)橫向展示購物車5. ThinkPHP5 通過ajax插入圖片并實(shí)時(shí)顯示(完整代碼)6. Docker 容器健康檢查機(jī)制7. python實(shí)現(xiàn)PolynomialFeatures多項(xiàng)式的方法8. ASP.NET MVC使用Session會(huì)話保持表單狀態(tài)9. Python列表嵌套常見坑點(diǎn)及解決方案10. 解決python使用list()時(shí)總是報(bào)錯(cuò)的問題
