vue的$http的get請求要加上params操作
vue GET傳遞參數(shù)要加上params
this.$http.get(’/operation/customer/question/edits’,{params:{id: 10}})
另外說一句,現(xiàn)在VUE官方推薦使用axios
vue-resource不更新了
補(bǔ)充知識(shí):vue請求中 post get傳參方式是不同的哦
我在學(xué)習(xí)vue,項(xiàng)目中post請求,get請求都用到了,我發(fā)現(xiàn)傳參方式是不一樣的。
post請求的例子:
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請求的例子:
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請求要加上params操作就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. 利用promise及參數(shù)解構(gòu)封裝ajax請求的方法2. Nginx+php配置文件及原理解析3. windows服務(wù)器使用IIS時(shí)thinkphp搜索中文無效問題4. .NET中l(wèi)ambda表達(dá)式合并問題及解決方法5. JSP數(shù)據(jù)交互實(shí)現(xiàn)過程解析6. 淺談python出錯(cuò)時(shí)traceback的解讀7. python matplotlib:plt.scatter() 大小和顏色參數(shù)詳解8. Ajax實(shí)現(xiàn)表格中信息不刷新頁面進(jìn)行更新數(shù)據(jù)9. Python importlib動(dòng)態(tài)導(dǎo)入模塊實(shí)現(xiàn)代碼10. ASP 信息提示函數(shù)并作返回或者轉(zhuǎn)向
